mirror of
https://github.com/libretro/RetroArch
synced 2025-02-11 06:40:48 +00:00
fix overlay alphas for multiple button presses
This commit is contained in:
parent
da75ee5a88
commit
c8677891e1
@ -744,8 +744,6 @@ void input_overlay_poll(input_overlay_t *ol, input_overlay_state_t *out, int16_t
|
|||||||
x /= ol->active->mod_w;
|
x /= ol->active->mod_w;
|
||||||
y /= ol->active->mod_h;
|
y /= ol->active->mod_h;
|
||||||
|
|
||||||
input_overlay_set_alpha_mod(ol, g_settings.input.overlay_opacity);
|
|
||||||
|
|
||||||
for (i = 0; i < ol->active->size; i++)
|
for (i = 0; i < ol->active->size; i++)
|
||||||
{
|
{
|
||||||
struct overlay_desc *desc = &ol->active->descs[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;
|
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)
|
if (desc->type == OVERLAY_TYPE_BUTTONS)
|
||||||
{
|
{
|
||||||
uint64_t mask = desc->key_mask;
|
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));
|
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;
|
size_t i;
|
||||||
|
|
||||||
|
input_overlay_set_alpha_mod(ol, g_settings.input.overlay_opacity);
|
||||||
|
|
||||||
for (i = 0; i < ol->active->size; i++)
|
for (i = 0; i < ol->active->size; i++)
|
||||||
{
|
{
|
||||||
struct overlay_desc *desc = &ol->active->descs[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.
|
// If pressed this frame, change the hitbox.
|
||||||
desc->range_x_mod = desc->range_x * desc->range_mod;
|
desc->range_x_mod = desc->range_x * desc->range_mod;
|
||||||
desc->range_y_mod = desc->range_y * 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
|
else
|
||||||
{
|
{
|
||||||
|
@ -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().
|
// 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);
|
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
|
// called after all the input_overlay_poll calls to update the range modifiers for pressed/unpressed regions and alpha mods
|
||||||
void input_overlay_update_range_mod(input_overlay_t *ol);
|
void input_overlay_post_poll(input_overlay_t *ol);
|
||||||
|
|
||||||
// Call when there is nothing to poll. Allows overlay to clear certain state.
|
// Call when there is nothing to poll. Allows overlay to clear certain state.
|
||||||
void input_overlay_poll_clear(input_overlay_t *ol);
|
void input_overlay_poll_clear(input_overlay_t *ol);
|
||||||
|
@ -519,7 +519,7 @@ static inline void input_poll_overlay(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (polled)
|
if (polled)
|
||||||
input_overlay_update_range_mod(driver.overlay);
|
input_overlay_post_poll(driver.overlay);
|
||||||
else
|
else
|
||||||
input_overlay_poll_clear(driver.overlay);
|
input_overlay_poll_clear(driver.overlay);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user