]> git.tdb.fi Git - libs/gui.git/blob - source/keyboard.cpp
Add input hub
[libs/gui.git] / source / keyboard.cpp
1 /* $Id$
2
3 This file is part of libmspgbase
4 Copyright © 2007 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
6 */
7
8 #include "keyboard.h"
9 #include "window.h"
10
11 namespace Msp {
12 namespace Input {
13
14 Keyboard::Keyboard(Window &window)
15 {
16         buttons.resize(256, false);
17
18         window.signal_key_press.connect(sigc::mem_fun(this, &Keyboard::key_press));
19         window.signal_key_release.connect(sigc::mem_fun(this, &Keyboard::key_release));
20 }
21
22 void Keyboard::key_press(unsigned key, unsigned, unsigned)
23 {
24         set_button_state(key, true, true);
25 }
26
27 void Keyboard::key_release(unsigned key, unsigned)
28 {
29         set_button_state(key, false, true);
30 }
31
32 } // namespace Input
33 } // namespace Msp