X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Finput%2Fandroid%2Fkeyboard.cpp;fp=source%2Finput%2Fandroid%2Fkeyboard.cpp;h=631b04853f56b896f24addb17033277abe818663;hb=a0584001d28ae224e0065c3c11b09d7965e78963;hp=0000000000000000000000000000000000000000;hpb=0c9df2a54cd38ba14ffc651bc96914614a08db46;p=libs%2Fgui.git diff --git a/source/input/android/keyboard.cpp b/source/input/android/keyboard.cpp new file mode 100644 index 0000000..631b048 --- /dev/null +++ b/source/input/android/keyboard.cpp @@ -0,0 +1,35 @@ +#include +#include +#include "keyboard.h" +#include "keys_private.h" + +using namespace std; + +namespace Msp { +namespace Input { + +string Keyboard::get_button_name(unsigned btn) const +{ + return Device::get_button_name(btn); +} + +void Keyboard::input_event(const Graphics::Window::Event &event) +{ + int type = AInputEvent_getType(event.aevent); + if(type!=AINPUT_EVENT_TYPE_KEY) + return; + + int action = AKeyEvent_getAction(event.aevent); + switch(action) + { + case AKEY_EVENT_ACTION_DOWN: + case AKEY_EVENT_ACTION_UP: + if(unsigned key = key_from_sys(AKeyEvent_getKeyCode(event.aevent))) + set_button_state(key, action==AKEY_EVENT_ACTION_DOWN, true); + break; + default:; + } +} + +} // namespace Input +} // namespace Msp