SDL: Load SDLK and SDLB input maps
Jeffrey Pfau jeffrey@endrift.com
Mon, 03 Nov 2014 23:28:33 -0800
3 files changed,
10 insertions(+),
0 deletions(-)
M
src/platform/sdl/gl-main.c
→
src/platform/sdl/gl-main.c
@@ -119,6 +119,7 @@ GBASDLInitAudio(&renderer.audio);
renderer.events.bindings = &context.inputMap; GBASDLInitEvents(&renderer.events); + GBASDLEventsLoadConfig(&renderer.events, &config); GBAThreadStart(&context);
M
src/platform/sdl/sdl-events.c
→
src/platform/sdl/sdl-events.c
@@ -45,7 +45,13 @@ GBAInputBindKey(context->bindings, SDL_BINDING_BUTTON, 4, GBA_KEY_UP);
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, 5, GBA_KEY_RIGHT); + 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) {
M
src/platform/sdl/sdl-events.h
→
src/platform/sdl/sdl-events.h
@@ -11,6 +11,7 @@ #define SDL_BINDING_KEY 0x53444C4B
#define SDL_BINDING_BUTTON 0x53444C42 struct GBAVideoSoftwareRenderer; +struct Configuration; struct GBASDLEvents { struct GBAInputMap* bindings;@@ -24,6 +25,8 @@ };
bool GBASDLInitEvents(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);