/* SDL - Simple DirectMedia Layer Copyright (C) 1997-2012 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Sam Lantinga slouken@libsdl.org */ #include "SDL_config.h" #include "SDL.h" #include "../../events/SDL_sysevents.h" #include "../../events/SDL_events_c.h" #include "../SDL_cursor_c.h" #include #include "SDL_prizmvideo.h" #include "SDL_prizmevents_c.h" static int nspk_keymap[PRZ_NUMKEYS]; static SDLKey sdlk_keymap[PRZ_NUMKEYS]; static Uint8 key_state[PRZ_NUMKEYS]; static SDLKey sdlak_keymap[4] = {SDLK_UP, SDLK_RIGHT, SDLK_DOWN, SDLK_LEFT}; static Uint8 arrow_key_state[4]; static void nsp_update_keyboard(void) { int i; for ( i = 0; i < PRZ_NUMKEYS; ++i ) { bool key_pressed; if ( sdlk_keymap[i] == SDLK_UNKNOWN ) continue; key_pressed = keydown(nspk_keymap[i]); PRZ_UPDATE_KEY_EVENT(sdlk_keymap[i], i, key_state[i], key_pressed); } } static void nsp_update_arrow_keys(void) { bool arrow_key_pressed[4] = { keydown(KEY_UP), keydown(KEY_RIGHT), keydown(KEY_DOWN), keydown(KEY_LEFT) }; int i; for ( i = 0; i < 4; ++i ) PRZ_UPDATE_KEY_EVENT(sdlak_keymap[i], i, arrow_key_state[i], arrow_key_pressed[i]); } void PRZ_PumpEvents(_THIS) { nsp_update_keyboard(); nsp_update_arrow_keys(); } void PRZ_InitOSKeymap(_THIS) { /* Enum value -> KEY_NSPIRE_* */ //nspk_keymap[NSP_KEY_RET] = KEY_NSPIRE_RET; /* ** ** ** ** */ /* Enum value -> SDLK_* This is the actual key mapping part. */ // sdlk_keymap[NSP_KEY_A] = SDLK_a; /* ** ** ** ** */ } /* end of SDL_tinspireevents.c ... */