Touch input WIP

This commit is contained in:
Cameron Gutman 2018-09-29 22:43:28 -07:00
commit 4a452a2467
3 changed files with 218 additions and 1 deletions

View file

@ -17,6 +17,7 @@ struct GamepadState {
};
#define MAX_GAMEPADS 4
#define MAX_FINGERS 3
class SdlInputHandler
{
@ -41,6 +42,8 @@ public:
void handleJoystickArrivalEvent(SDL_JoyDeviceEvent* event);
void handleTouchFingerEvent(SDL_TouchFingerEvent* event);
int getAttachedGamepadMask();
static
@ -52,11 +55,29 @@ private:
void sendGamepadState(GamepadState* state);
static
Uint32 releaseLeftButtonTimerCallback(Uint32 interval, void* param);
static
Uint32 releaseRightButtonTimerCallback(Uint32 interval, void* param);
static
Uint32 dragTimerCallback(Uint32 interval, void* param);
Uint32 m_LastMouseMotionTime;
bool m_MultiController;
bool m_NeedsInputDelay;
int m_GamepadMask;
GamepadState m_GamepadState[MAX_GAMEPADS];
SDL_TouchFingerEvent m_TouchDownEvent[MAX_FINGERS];
float m_LastPrimaryTouchX;
float m_LastPrimaryTouchY;
SDL_TimerID m_LeftButtonReleaseTimer;
SDL_TimerID m_RightButtonReleaseTimer;
SDL_TimerID m_DragTimer;
char m_DragButton;
int m_NumFingersDown;
static const int k_ButtonMap[];
};