]> git.tdb.fi Git - libs/gui.git/blob - source/keyboard.cpp
4bc586ca3ff5deb0c61cccd4208e42aa8ac3e240
[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 }
20
21 void Keyboard::key_press(unsigned key, unsigned, unsigned)
22 {
23         set_button_state(key, true, true);
24 }
25
26 void Keyboard::key_release(unsigned key, unsigned)
27 {
28         set_button_state(key, false, true);
29 }
30
31 } // namespace Input
32 } // namespace Msp