|
|
SDL_KEYDOWN, SDL_KEYUP, SDL_JOYBUTTONDOWN, SDL_JOYBUTTONUP, | SDL_KEYDOWN, SDL_KEYUP, SDL_JOYBUTTONDOWN, SDL_JOYBUTTONUP, |
SDL_JOYAXISMOTION, SDL_JOYHATMOTION, -1 | SDL_JOYAXISMOTION, SDL_JOYHATMOTION, -1 |
}; | }; |
static int SDL_EventMask; |
static int SDLEventMask; |
| |
InputHandler_SDL::InputHandler_SDL() | InputHandler_SDL::InputHandler_SDL() |
{ | { |
|
|
for(i = 0; Handled_SDL_Events[i] != -1; ++i) | for(i = 0; Handled_SDL_Events[i] != -1; ++i) |
{ | { |
mySDL_EventState(Handled_SDL_Events[i], SDL_ENABLE); | mySDL_EventState(Handled_SDL_Events[i], SDL_ENABLE); |
SDL_EventMask |= SDL_EVENTMASK(Handled_SDL_Events[i]); |
SDLEventMask |= SDL_EVENTMASK(Handled_SDL_Events[i]); |
} | } |
} | } |
| |
|
|
void InputHandler_SDL::Update(float fDeltaTime) | void InputHandler_SDL::Update(float fDeltaTime) |
{ | { |
SDL_Event event; | SDL_Event event; |
while(SDL_GetEvent(event, SDL_EventMask)) |
while(SDL_GetEvent(event, SDLEventMask)) |
{ | { |
switch(event.type) | switch(event.type) |
{ | { |