Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gamepad API #393

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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: 6 additions & 0 deletions sokol_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -1622,6 +1622,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 @@ -7024,6 +7025,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