Start reimplementing Zarch joypad input

This commit is contained in:
twinaphex 2016-02-26 22:29:10 +01:00
parent 2c69bc7d79
commit 0f8f980c8f
4 changed files with 17 additions and 4 deletions

View File

@ -397,7 +397,7 @@ bool input_translate_coord_viewport(int mouse_x, int mouse_y,
return true;
}
static const struct retro_keybind *libretro_input_binds[MAX_USERS];
const struct retro_keybind *libretro_input_binds[MAX_USERS];
/**
* input_poll:

View File

@ -291,6 +291,8 @@ const input_driver_t **input_get_double_ptr(void);
void **input_driver_get_data_ptr(void);
const struct retro_keybind *libretro_input_binds[MAX_USERS];
#ifdef __cplusplus
}
#endif

View File

@ -241,6 +241,8 @@ enum zarch_zui_input_state
static int16_t zarch_zui_input_state(zui_t *zui, enum zarch_zui_input_state state)
{
static bool old_b_pressed = false;
switch (state)
{
case MENU_ZARCH_MOUSE_X:
@ -255,8 +257,17 @@ static int16_t zarch_zui_input_state(zui_t *zui, enum zarch_zui_input_state stat
if ( menu_input_mouse_state(MENU_MOUSE_LEFT_BUTTON)
|| menu_input_pointer_state(MENU_POINTER_PRESSED))
return 1;
if (zui->action == MENU_ACTION_OK)
return 1;
if (input_driver_state(libretro_input_binds,
0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B))
{
if (!old_b_pressed)
{
old_b_pressed = true;
return 1;
}
}
else
old_b_pressed = false;
break;
}

View File

@ -1228,8 +1228,8 @@ int runloop_iterate(unsigned *sleep_ms)
{
unsigned i;
event_cmd_state_t cmd;
event_cmd_state_t *cmd_ptr = &cmd;
retro_time_t current, target, to_sleep_ms;
event_cmd_state_t *cmd_ptr = &cmd;
static retro_usec_t frame_time_last = 0;
static retro_time_t frame_limit_minimum_time = 0.0;
static retro_time_t frame_limit_last_time = 0.0;