1 #ifndef RADIX_GWENINPUT_HPP
2 #define RADIX_GWENINPUT_HPP
4 #include <Gwen/InputHandler.h>
6 #include <Gwen/Controls/Canvas.h>
8 #include <SDL2/SDL_events.h>
9 #include <SDL2/SDL_keycode.h>
19 void init(Gwen::Controls::Canvas *c) {
26 return Gwen::Key::Backspace;
29 return Gwen::Key::Return;
32 return Gwen::Key::Escape;
35 return Gwen::Key::Tab;
38 return Gwen::Key::Space;
44 return Gwen::Key::Down;
47 return Gwen::Key::Left;
50 return Gwen::Key::Right;
53 return Gwen::Key::Home;
56 return Gwen::Key::End;
59 return Gwen::Key::Delete;
63 return Gwen::Key::Control;
67 return Gwen::Key::Alt;
71 return Gwen::Key::Shift;
76 return Gwen::Key::Invalid;
86 return canvas->InputMouseMoved(evt.motion.x, evt.motion.y, evt.motion.xrel, evt.motion.yrel);
89 return canvas->InputMouseWheel(evt.wheel.y);
91 case SDL_MOUSEBUTTONDOWN:
92 case SDL_MOUSEBUTTONUP: {
94 switch (evt.button.button) {
98 case SDL_BUTTON_RIGHT:
101 case SDL_BUTTON_MIDDLE:
105 return canvas->InputMouseButton(button, evt.type == SDL_MOUSEBUTTONDOWN);
115 bool down = (evt.type == SDL_KEYDOWN);
117 if (evt.key.keysym.sym and down and
118 evt.key.keysym.sym >=
' ' and evt.key.keysym.sym <=
'~') {
119 return canvas->InputCharacter(evt.key.keysym.sym);
123 return canvas->InputKey(key, down);
Definition: GameController.hpp:7