Create input_overlay_key_pressed

This commit is contained in:
twinaphex 2015-07-12 06:54:35 +02:00
parent 1a4954ce55
commit 86e7f34666
3 changed files with 14 additions and 8 deletions

View File

@ -216,9 +216,6 @@ retro_input_t input_driver_keys_pressed(void)
retro_input_t ret = 0;
driver_t *driver = driver_get_ptr();
const input_driver_t *input = input_get_ptr(driver);
#ifdef HAVE_OVERLAY
input_overlay_state_t *ol_state = input_overlay_get_state_ptr();
#endif
for (key = 0; key < RARCH_BIND_LIST_END; key++)
{
@ -228,8 +225,7 @@ retro_input_t input_driver_keys_pressed(void)
state = input->key_pressed(driver->input_data, key);
#ifdef HAVE_OVERLAY
if (ol_state)
state = state || (ol_state->buttons & (1ULL << key));
state = state || input_overlay_key_pressed(key);
#endif
#ifdef HAVE_COMMAND

View File

@ -1408,7 +1408,7 @@ void input_overlay_set_alpha_mod(input_overlay_t *ol, float mod)
ol->iface->set_alpha(ol->iface_data, i, mod);
}
bool input_overlay_is_alive(input_overlay_t *ol)
static bool input_overlay_is_alive(input_overlay_t *ol)
{
if (!ol)
return false;
@ -1595,3 +1595,13 @@ void input_state_overlay(int16_t *ret, unsigned port, unsigned device, unsigned
break;
}
}
bool input_overlay_key_pressed(int key)
{
input_overlay_state_t *ol_state = input_overlay_get_state_ptr();
if (!ol_state)
return false;
return (ol_state->buttons & (1ULL << key));
}

View File

@ -228,8 +228,6 @@ void input_overlay_free_ptr(void);
int input_overlay_new_ptr(void);
bool input_overlay_is_alive(input_overlay_t *ol);
enum overlay_status input_overlay_status(input_overlay_t *ol);
/*
@ -244,6 +242,8 @@ void input_state_overlay(int16_t *ret,
unsigned port, unsigned device, unsigned idx,
unsigned id);
bool input_overlay_key_pressed(int key);
#ifdef __cplusplus
}
#endif