fix overlay alphas for multiple button presses

This commit is contained in:
Toad King 2013-12-26 21:39:07 -05:00
parent da75ee5a88
commit c8677891e1
3 changed files with 10 additions and 10 deletions

View File

@ -744,8 +744,6 @@ void input_overlay_poll(input_overlay_t *ol, input_overlay_state_t *out, int16_t
x /= ol->active->mod_w;
y /= ol->active->mod_h;
input_overlay_set_alpha_mod(ol, g_settings.input.overlay_opacity);
for (i = 0; i < ol->active->size; i++)
{
struct overlay_desc *desc = &ol->active->descs[i];
@ -754,10 +752,6 @@ void input_overlay_poll(input_overlay_t *ol, input_overlay_state_t *out, int16_t
desc->updated = true;
if (desc->image.image)
ol->iface->set_alpha(ol->iface_data, desc->image_index,
desc->alpha_mod * g_settings.input.overlay_opacity);
if (desc->type == OVERLAY_TYPE_BUTTONS)
{
uint64_t mask = desc->key_mask;
@ -783,10 +777,12 @@ void input_overlay_poll(input_overlay_t *ol, input_overlay_state_t *out, int16_t
memset(out, 0, sizeof(*out));
}
void input_overlay_update_range_mod(input_overlay_t *ol)
void input_overlay_post_poll(input_overlay_t *ol)
{
size_t i;
input_overlay_set_alpha_mod(ol, g_settings.input.overlay_opacity);
for (i = 0; i < ol->active->size; i++)
{
struct overlay_desc *desc = &ol->active->descs[i];
@ -796,6 +792,10 @@ void input_overlay_update_range_mod(input_overlay_t *ol)
// If pressed this frame, change the hitbox.
desc->range_x_mod = desc->range_x * desc->range_mod;
desc->range_y_mod = desc->range_y * desc->range_mod;
if (desc->image.image)
ol->iface->set_alpha(ol->iface_data, desc->image_index,
desc->alpha_mod * g_settings.input.overlay_opacity);
}
else
{

View File

@ -46,8 +46,8 @@ bool input_overlay_full_screen(input_overlay_t *ol);
// norm_x and norm_y are the result of input_translate_coord_viewport().
void input_overlay_poll(input_overlay_t *ol, input_overlay_state_t *out, int16_t norm_x, int16_t norm_y);
// called after all the input_overlay_poll calls to update the range modifiers for pressed/unpressed regions
void input_overlay_update_range_mod(input_overlay_t *ol);
// called after all the input_overlay_poll calls to update the range modifiers for pressed/unpressed regions and alpha mods
void input_overlay_post_poll(input_overlay_t *ol);
// Call when there is nothing to poll. Allows overlay to clear certain state.
void input_overlay_poll_clear(input_overlay_t *ol);

View File

@ -519,7 +519,7 @@ static inline void input_poll_overlay(void)
}
if (polled)
input_overlay_update_range_mod(driver.overlay);
input_overlay_post_poll(driver.overlay);
else
input_overlay_poll_clear(driver.overlay);
}