|
|
|
@@ -48,6 +48,8 @@ static void sdl_input_done(nes_Input_Reader* input) { |
|
|
|
sdl_lose_gamepad(input->data); |
|
|
|
} |
|
|
|
|
|
|
|
static const int sdl_reset_key = SDLK_ESCAPE; |
|
|
|
|
|
|
|
static const int sdl_keycodes[nes_controller_num_buttons] = { |
|
|
|
SDLK_a, |
|
|
|
SDLK_s, |
|
|
|
@@ -78,13 +80,12 @@ static int button_index(int keycode, const int* codes) { |
|
|
|
|
|
|
|
static int sdl_input_update(nes_Input_Reader* reader, |
|
|
|
nes_input* input) { |
|
|
|
int status = 0; |
|
|
|
int status = input_Result_OK; |
|
|
|
|
|
|
|
SDL_Event event = {0}; |
|
|
|
while (0 != SDL_PollEvent(&event)) { |
|
|
|
while (0 == status && 0 != SDL_PollEvent(&event)) { |
|
|
|
if (SDL_QUIT == event.type) { |
|
|
|
status = -1; |
|
|
|
break; |
|
|
|
status = input_Result_Quit; |
|
|
|
|
|
|
|
} else if ( SDL_KEYDOWN == event.type || |
|
|
|
SDL_KEYUP == event.type) { |
|
|
|
@@ -97,6 +98,10 @@ static int sdl_input_update(nes_Input_Reader* reader, |
|
|
|
} else { |
|
|
|
input->controllers[0].buttons &= ~mask; |
|
|
|
} |
|
|
|
|
|
|
|
} else if ( event.key.keysym.sym == sdl_reset_key && |
|
|
|
SDL_KEYDOWN == event.type) { |
|
|
|
status = input_Result_Reset; |
|
|
|
} |
|
|
|
|
|
|
|
} else if ( SDL_CONTROLLERBUTTONDOWN == event.type || |
|
|
|
|