SDL: Add Pandora bindings
Jeffrey Pfau jeffrey@endrift.com
Tue, 17 Mar 2015 22:30:58 -0700
2 files changed,
18 insertions(+),
3 deletions(-)
M
CMakeLists.txt
→
CMakeLists.txt
@@ -136,10 +136,14 @@ set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -flto")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -flto") endif() -if(BUILD_BBB OR BUILD_RASPI) +if(BUILD_BBB OR BUILD_RASPI OR BUILD_PANDORA) if(NOT BUILD_EGL) add_definitions(-DCOLOR_16_BIT -DCOLOR_5_6_5) endif() +endif() + +if(BUILD_PANDORA) + add_definitions(-DBUILD_PANDORA) endif() if(CMAKE_SYSTEM_PROCESSOR MATCHES "arm.*")
M
src/platform/sdl/sdl-events.c
→
src/platform/sdl/sdl-events.c
@@ -35,7 +35,18 @@ return true;
} void GBASDLInitBindings(struct GBAInputMap* inputMap) { -#if SDL_VERSION_ATLEAST(2, 0, 0) +#ifdef BUILD_PANDORA + GBAInputBindKey(inputMap, SDL_BINDING_KEY, SDLK_PAGEDOWN, GBA_KEY_A); + GBAInputBindKey(inputMap, SDL_BINDING_KEY, SDLK_END, GBA_KEY_B); + GBAInputBindKey(inputMap, SDL_BINDING_KEY, SDLK_RSHIFT, GBA_KEY_L); + GBAInputBindKey(inputMap, SDL_BINDING_KEY, SDLK_RCTRL, GBA_KEY_R); + GBAInputBindKey(inputMap, SDL_BINDING_KEY, SDLK_LALT, GBA_KEY_START); + GBAInputBindKey(inputMap, SDL_BINDING_KEY, SDLK_LCTRL, GBA_KEY_SELECT); + GBAInputBindKey(inputMap, SDL_BINDING_KEY, SDLK_UP, GBA_KEY_UP); + GBAInputBindKey(inputMap, SDL_BINDING_KEY, SDLK_DOWN, GBA_KEY_DOWN); + GBAInputBindKey(inputMap, SDL_BINDING_KEY, SDLK_LEFT, GBA_KEY_LEFT); + GBAInputBindKey(inputMap, SDL_BINDING_KEY, SDLK_RIGHT, GBA_KEY_RIGHT); +#elif SDL_VERSION_ATLEAST(2, 0, 0) GBAInputBindKey(inputMap, SDL_BINDING_KEY, SDL_SCANCODE_X, GBA_KEY_A); GBAInputBindKey(inputMap, SDL_BINDING_KEY, SDL_SCANCODE_Z, GBA_KEY_B); GBAInputBindKey(inputMap, SDL_BINDING_KEY, SDL_SCANCODE_A, GBA_KEY_L);@@ -105,7 +116,7 @@
static void _GBASDLHandleKeypress(struct GBAThread* context, struct GBASDLEvents* sdlContext, const struct SDL_KeyboardEvent* event) { enum GBAKey key = GBA_KEY_NONE; if (!event->keysym.mod) { -#if SDL_VERSION_ATLEAST(2, 0, 0) +#if !defined(BUILD_PANORA) && SDL_VERSION_ATLEAST(2, 0, 0) key = GBAInputMapKey(sdlContext->bindings, SDL_BINDING_KEY, event->keysym.scancode); #else key = GBAInputMapKey(sdlContext->bindings, SDL_BINDING_KEY, event->keysym.sym);