src/video/haiku/SDL_bkeyboard.cc
changeset 12082 09999a0e8f9a
parent 11811 5d94cb6b24d3
child 12201 8bdc4d340419
equal deleted inserted replaced
12081:277e57c09ff4 12082:09999a0e8f9a
    39 
    39 
    40 
    40 
    41 static SDL_Scancode keymap[KEYMAP_SIZE];
    41 static SDL_Scancode keymap[KEYMAP_SIZE];
    42 static int8 keystate[KEYMAP_SIZE];
    42 static int8 keystate[KEYMAP_SIZE];
    43 
    43 
    44 void BE_InitOSKeymap(void) {
    44 void HAIKU_InitOSKeymap(void) {
    45 		for( uint i = 0; i < SDL_TABLESIZE(keymap); ++i ) {
    45 		for( uint i = 0; i < SDL_TABLESIZE(keymap); ++i ) {
    46 			keymap[i] = SDL_SCANCODE_UNKNOWN;
    46 			keymap[i] = SDL_SCANCODE_UNKNOWN;
    47 		}
    47 		}
    48 
    48 
    49 		for( uint i = 0; i < KEYMAP_SIZE; ++i ) {
    49 		for( uint i = 0; i < KEYMAP_SIZE; ++i ) {
   157 		keymap[0x69]		= SDL_GetScancodeFromKey(SDLK_2); /* SDLK_EURO */
   157 		keymap[0x69]		= SDL_GetScancodeFromKey(SDLK_2); /* SDLK_EURO */
   158 		keymap[0x6a]		= SDL_GetScancodeFromKey(SDLK_KP_EQUALS);
   158 		keymap[0x6a]		= SDL_GetScancodeFromKey(SDLK_KP_EQUALS);
   159 		keymap[0x6b]		= SDL_GetScancodeFromKey(SDLK_POWER);
   159 		keymap[0x6b]		= SDL_GetScancodeFromKey(SDLK_POWER);
   160 }
   160 }
   161 
   161 
   162 SDL_Scancode BE_GetScancodeFromBeKey(int32 bkey) {
   162 SDL_Scancode HAIKU_GetScancodeFromBeKey(int32 bkey) {
   163 	if(bkey > 0 && bkey < (int32)SDL_TABLESIZE(keymap)) {
   163 	if(bkey > 0 && bkey < (int32)SDL_TABLESIZE(keymap)) {
   164 		return keymap[bkey];
   164 		return keymap[bkey];
   165 	} else {
   165 	} else {
   166 		return SDL_SCANCODE_UNKNOWN;
   166 		return SDL_SCANCODE_UNKNOWN;
   167 	}
   167 	}
   168 }
   168 }
   169 
   169 
   170 int8 BE_GetKeyState(int32 bkey) {
   170 int8 HAIKU_GetKeyState(int32 bkey) {
   171 	if(bkey > 0 && bkey < KEYMAP_SIZE) {
   171 	if(bkey > 0 && bkey < KEYMAP_SIZE) {
   172 		return keystate[bkey];
   172 		return keystate[bkey];
   173 	} else {
   173 	} else {
   174 		return SDL_RELEASED;
   174 		return SDL_RELEASED;
   175 	}
   175 	}
   176 }
   176 }
   177 
   177 
   178 void BE_SetKeyState(int32 bkey, int8 state) {
   178 void HAIKU_SetKeyState(int32 bkey, int8 state) {
   179 	if(bkey > 0 && bkey < KEYMAP_SIZE) {
   179 	if(bkey > 0 && bkey < KEYMAP_SIZE) {
   180 		keystate[bkey] = state;
   180 		keystate[bkey] = state;
   181 	}
   181 	}
   182 }
   182 }
   183 
   183