22 #ifndef BACKEND_EVENTS_SDL_H 23 #define BACKEND_EVENTS_SDL_H 25 #include "backends/platform/sdl/sdl-sys.h" 26 #include "backends/graphics/sdl/sdl-graphics.h" 28 #include "common/events.h" 31 #if !SDL_VERSION_ATLEAST(2, 0, 0) 32 typedef SDLKey SDL_Keycode;
33 typedef SDLMod SDL_Keymod;
34 typedef SDL_keysym SDL_Keysym;
76 #if SDL_VERSION_ATLEAST(2, 0, 0) 78 SDL_GameController *_controller;
128 virtual bool handleKeyDown(SDL_Event &ev,
Common::Event &event);
129 virtual bool handleKeyUp(SDL_Event &ev,
Common::Event &event);
130 virtual bool handleMouseMotion(SDL_Event &ev,
Common::Event &event);
131 virtual bool handleMouseButtonDown(SDL_Event &ev,
Common::Event &event);
132 virtual bool handleMouseButtonUp(SDL_Event &ev,
Common::Event &event);
133 virtual bool handleSysWMEvent(SDL_Event &ev,
Common::Event &event);
134 virtual int mapSDLJoystickButtonToOSystem(Uint8 sdlButton);
135 virtual bool handleJoyButtonDown(SDL_Event &ev,
Common::Event &event);
136 virtual bool handleJoyButtonUp(SDL_Event &ev,
Common::Event &event);
137 virtual bool handleJoyAxisMotion(SDL_Event &ev,
Common::Event &event);
138 virtual bool handleJoyHatMotion(SDL_Event &ev,
Common::Event &event);
140 #if SDL_VERSION_ATLEAST(2, 0, 0) 141 virtual bool handleJoystickAdded(
const SDL_JoyDeviceEvent &device,
Common::Event &event);
142 virtual bool handleJoystickRemoved(
const SDL_JoyDeviceEvent &device,
Common::Event &event);
143 virtual int mapSDLControllerButtonToOSystem(Uint8 sdlButton);
144 virtual bool handleControllerButton(
const SDL_Event &ev,
Common::Event &event,
bool buttonUp);
145 virtual bool handleControllerAxisMotion(
const SDL_Event &ev,
Common::Event &event);
147 virtual bool isTouchPortTouchpadMode(SDL_TouchID port);
148 virtual bool isTouchPortActive(SDL_TouchID port);
150 virtual void convertTouchXYToGameXY(
float touchX,
float touchY,
int *gameX,
int *gameY);
171 virtual int mapKey(SDL_Keycode key, SDL_Keymod mod, Uint16 unicode);
211 uint8 _lastHatPosition;
213 #if SDL_VERSION_ATLEAST(2, 0, 0) 217 bool _queuedFakeKeyUp;
228 MAX_TAP_MOTION_DISTANCE = 10,
229 SIMULATED_CLICK_DURATION = 50,
230 FINGER_SUBPIXEL_MULTIPLIER = 16
235 uint32 timeLastDown = 0;
248 struct TouchPanelState {
249 TouchFinger _finger[MAX_NUM_FINGERS];
250 DraggingType _multiFingerDragging = DRAG_NONE;
251 unsigned int _simulatedClickStartTime[2] = {0, 0};
254 bool _tapMade =
false;
260 void preprocessFingerDown(SDL_Event *event);
261 bool preprocessFingerUp(SDL_Event *event,
Common::Event *ev);
262 void preprocessFingerMotion(SDL_Event *event);
263 void finishSimulatedMouseClicks(
void);
void setEngineRunning(bool value)
virtual bool dispatchSDLEvent(SDL_Event &ev, Common::Event &event)
SdlGraphicsManager * _graphicsManager
Definition: sdl-events.h:87
Definition: sdl-events.h:40
bool _queuedFakeMouseMove
Definition: sdl-events.h:202
Definition: sdl-graphics.h:38
bool _scrollLock
Definition: sdl-events.h:66
void fakeWarpMouse(const int x, const int y)
bool handleResizeEvent(Common::Event &event, int w, int h)
void loadGameControllerMappingFile()
virtual int mapKey(SDL_Keycode key, SDL_Keymod mod, Uint16 unicode)
void openJoystick(int joystickIndex)
virtual bool pollEvent(Common::Event &event)
uint32 obtainUnicode(const SDL_Keysym keySym)
bool isJoystickConnected() const
virtual void SDLModToOSystemKeyFlags(SDL_Keymod mod, Common::Event &event)
virtual void preprocessEvents(SDL_Event *event)
Definition: sdl-events.h:112
int _lastScreenID
Definition: sdl-events.h:82
Common::Event _fakeMouseMove
Definition: sdl-events.h:209
virtual bool processMouseEvent(Common::Event &event, int x, int y, int relx=0, int rely=0)
Common::KeyCode SDLToOSystemKeycode(const SDL_Keycode key)
SDL_Joystick * _joystick
Definition: sdl-events.h:74
virtual bool remapKey(SDL_Event &ev, Common::Event &event)
SDL_Keycode obtainKeycode(const SDL_Keysym keySym)