mirror of https://github.com/mgba-emu/mgba.git
SDL: Load SDLK and SDLB input maps
This commit is contained in:
parent
3e75a8e3fe
commit
629196e7a1
|
@ -119,6 +119,7 @@ int main(int argc, char** argv) {
|
||||||
|
|
||||||
renderer.events.bindings = &context.inputMap;
|
renderer.events.bindings = &context.inputMap;
|
||||||
GBASDLInitEvents(&renderer.events);
|
GBASDLInitEvents(&renderer.events);
|
||||||
|
GBASDLEventsLoadConfig(&renderer.events, &config);
|
||||||
|
|
||||||
GBAThreadStart(&context);
|
GBAThreadStart(&context);
|
||||||
|
|
||||||
|
|
|
@ -45,9 +45,15 @@ bool GBASDLInitEvents(struct GBASDLEvents* context) {
|
||||||
GBAInputBindKey(context->bindings, SDL_BINDING_BUTTON, 6, GBA_KEY_DOWN);
|
GBAInputBindKey(context->bindings, SDL_BINDING_BUTTON, 6, GBA_KEY_DOWN);
|
||||||
GBAInputBindKey(context->bindings, SDL_BINDING_BUTTON, 7, GBA_KEY_LEFT);
|
GBAInputBindKey(context->bindings, SDL_BINDING_BUTTON, 7, GBA_KEY_LEFT);
|
||||||
GBAInputBindKey(context->bindings, SDL_BINDING_BUTTON, 5, GBA_KEY_RIGHT);
|
GBAInputBindKey(context->bindings, SDL_BINDING_BUTTON, 5, GBA_KEY_RIGHT);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GBASDLEventsLoadConfig(struct GBASDLEvents* context, const struct Configuration* config) {
|
||||||
|
GBAInputMapLoad(context->bindings, SDL_BINDING_KEY, config);
|
||||||
|
GBAInputMapLoad(context->bindings, SDL_BINDING_BUTTON, config);
|
||||||
|
}
|
||||||
|
|
||||||
void GBASDLDeinitEvents(struct GBASDLEvents* context) {
|
void GBASDLDeinitEvents(struct GBASDLEvents* context) {
|
||||||
SDL_JoystickClose(context->joystick);
|
SDL_JoystickClose(context->joystick);
|
||||||
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
|
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#define SDL_BINDING_BUTTON 0x53444C42
|
#define SDL_BINDING_BUTTON 0x53444C42
|
||||||
|
|
||||||
struct GBAVideoSoftwareRenderer;
|
struct GBAVideoSoftwareRenderer;
|
||||||
|
struct Configuration;
|
||||||
|
|
||||||
struct GBASDLEvents {
|
struct GBASDLEvents {
|
||||||
struct GBAInputMap* bindings;
|
struct GBAInputMap* bindings;
|
||||||
|
@ -25,6 +26,8 @@ struct GBASDLEvents {
|
||||||
bool GBASDLInitEvents(struct GBASDLEvents*);
|
bool GBASDLInitEvents(struct GBASDLEvents*);
|
||||||
void GBASDLDeinitEvents(struct GBASDLEvents*);
|
void GBASDLDeinitEvents(struct GBASDLEvents*);
|
||||||
|
|
||||||
|
void GBASDLEventsLoadConfig(struct GBASDLEvents*, const struct Configuration*);
|
||||||
|
|
||||||
void GBASDLHandleEvent(struct GBAThread* context, struct GBASDLEvents* sdlContext, const union SDL_Event* event);
|
void GBASDLHandleEvent(struct GBAThread* context, struct GBASDLEvents* sdlContext, const union SDL_Event* event);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue