Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion gl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
#include <stdlib.h>

#include <EGL/egl.h>
#include <GLES/gl.h>
#if defined(__arm__)
#include <GLES/gl.h>
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ARM doesn't automatically mean GLES, just use HAVE_GLES.

#else
#include <GL/gl.h>
#endif
#include "gl_platform.h"
#include "gl.h"

Expand Down
6 changes: 5 additions & 1 deletion gl_platform.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#include <stdio.h>
#include <stdlib.h>
#include <EGL/egl.h>
#include <GLES/gl.h>
#if defined(__arm__)
#include <GLES/gl.h>
#else
#include <GL/gl.h>
#endif

#include "gl.h"
#include "gl_platform.h"
Expand Down
28 changes: 28 additions & 0 deletions in_sdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,34 @@ static int handle_joy_event(struct in_sdl_state *state, SDL_Event *event,
}
break;

case SDL_JOYHATMOTION:
if (event->jhat.which != state->joy_id)
return -2;
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't you need a check that event->jhat.hat is < 2, like in the SDL_JOYAXISMOTION case, or are there only 2 hats possible? It fear may overflow axis_keydown[] array.

if (event->jhat.value == SDL_HAT_CENTERED) {
kc = state->axis_keydown[event->jhat.hat];
state->axis_keydown[event->jhat.hat] = 0;
ret = 1;
}
else if (event->jhat.value & SDL_HAT_UP || event->jhat.value & SDL_HAT_LEFT) {
kc = state->axis_keydown[event->jhat.hat];
if (kc)
update_keystate(state->keystate, kc, 0);
kc = (event->jhat.value & SDL_HAT_UP) ? SDLK_UP : SDLK_LEFT;
state->axis_keydown[event->jhat.hat] = kc;
down = 1;
ret = 1;
}
else if (event->jhat.value & SDL_HAT_DOWN || event->jhat.value & SDL_HAT_RIGHT) {
kc = state->axis_keydown[event->jhat.hat];
if (kc)
update_keystate(state->keystate, kc, 0);
kc = (event->jhat.value & SDL_HAT_DOWN) ? SDLK_DOWN : SDLK_RIGHT;
state->axis_keydown[event->jhat.hat] = kc;
down = 1;
ret = 1;
}
break;

case SDL_JOYBUTTONDOWN:
case SDL_JOYBUTTONUP:
if (event->jbutton.which != state->joy_id)
Expand Down