X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Finput%2Fkeyboard.cpp;h=0a690d1b686a569a790d187224a3fb4e725e93ec;hb=9580908b4c206675f912c0639d8f450bc42c504b;hp=240d700fccc4b45620cbd40c4f728face25f7c58;hpb=999ca92aa9ee10585c0b2094d84364159253982f;p=libs%2Fgui.git diff --git a/source/input/keyboard.cpp b/source/input/keyboard.cpp index 240d700..0a690d1 100644 --- a/source/input/keyboard.cpp +++ b/source/input/keyboard.cpp @@ -1,13 +1,6 @@ -/* $Id$ - -This file is part of libmspgbase -Copyright © 2007 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - -#include -#include "../gbase/display.h" +#include #include "keyboard.h" +#include "keys.h" namespace Msp { namespace Input { @@ -15,36 +8,15 @@ namespace Input { Keyboard::Keyboard(Graphics::Window &w): window(w) { - name="Keyboard"; - - buttons.resize(256, false); - - window.signal_key_press.connect(sigc::mem_fun(this, &Keyboard::key_press)); - window.signal_key_release.connect(sigc::mem_fun(this, &Keyboard::key_release)); -} + name = "Keyboard"; -std::string Keyboard::get_button_name(unsigned btn) const -{ -#ifndef WIN32 - KeySym ksym=XKeycodeToKeysym(window.get_display().get_display(), btn, 0); - return XKeysymToString(ksym); -#else - char buf[128]; - if(!GetKeyNameText(btn<<16, buf, sizeof(buf))) - return format("Key %d", btn); - return buf; -#endif -} + buttons.resize(N_KEYS_, false); -void Keyboard::key_press(unsigned key, unsigned, unsigned) -{ - set_button_state(key, true, true); + window.signal_input_event.connect(sigc::mem_fun(this, &Keyboard::input_event)); } -void Keyboard::key_release(unsigned key, unsigned) -{ - set_button_state(key, false, true); -} +Keyboard::~Keyboard() +{ } } // namespace Input } // namespace Msp