Skip to content

Commit

Permalink
Add gamepad API
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiopolimeni committed Jan 29, 2022
1 parent 7594925 commit ec4a9b6
Show file tree
Hide file tree
Showing 2 changed files with 679 additions and 0 deletions.
6 changes: 6 additions & 0 deletions sokol_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -2313,6 +2313,7 @@ typedef struct {
EGLDisplay display;
EGLContext context;
EGLSurface surface;
bool (*gamepad_event_handler)(const AInputEvent*);
} _sapp_android_t;

#endif // _SAPP_ANDROID
Expand Down Expand Up @@ -8564,6 +8565,11 @@ _SOKOL_PRIVATE int _sapp_android_input_cb(int fd, int events, void* data) {
continue;
}
int32_t handled = 0;
if (_sapp.android.gamepad_event_handler) {
if (_sapp.android.gamepad_event_handler(event)) {
handled = 1;
}
}
if (_sapp_android_touch_event(event) || _sapp_android_key_event(event)) {
handled = 1;
}
Expand Down
Loading

0 comments on commit ec4a9b6

Please sign in to comment.