(Overlay) Cleanups
This commit is contained in:
parent
fa2e1fb0c1
commit
fa990849ba
|
@ -200,40 +200,8 @@ typedef struct
|
||||||
struct overlay *active;
|
struct overlay *active;
|
||||||
} overlay_task_data_t;
|
} overlay_task_data_t;
|
||||||
|
|
||||||
/**
|
|
||||||
* input_overlay_free:
|
|
||||||
*
|
|
||||||
* Frees overlay handle.
|
|
||||||
**/
|
|
||||||
void input_overlay_free(input_overlay_t *ol);
|
|
||||||
|
|
||||||
void input_overlay_free_overlay(struct overlay *overlay);
|
void input_overlay_free_overlay(struct overlay *overlay);
|
||||||
|
|
||||||
/**
|
|
||||||
* input_overlay_set_alpha_mod:
|
|
||||||
* @mod : New modulating factor to apply.
|
|
||||||
*
|
|
||||||
* Sets a modulating factor for alpha channel. Default is 1.0.
|
|
||||||
* The alpha factor is applied for all overlays.
|
|
||||||
**/
|
|
||||||
void input_overlay_set_alpha_mod(input_overlay_t *ol, float mod);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* input_overlay_set_scale_factor:
|
|
||||||
* @scale : Factor of scale to apply.
|
|
||||||
*
|
|
||||||
* Scales the overlay by a factor of scale.
|
|
||||||
**/
|
|
||||||
void input_overlay_set_scale_factor(input_overlay_t *ol, float scale);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* input_overlay_next:
|
|
||||||
*
|
|
||||||
* Switch to the next available overlay
|
|
||||||
* screen.
|
|
||||||
**/
|
|
||||||
void input_overlay_next(input_overlay_t *ol, float opacity);
|
|
||||||
|
|
||||||
bool input_overlay_key_pressed(input_overlay_t *ol, unsigned key);
|
bool input_overlay_key_pressed(input_overlay_t *ol, unsigned key);
|
||||||
|
|
||||||
void input_overlay_loaded(retro_task_t *task,
|
void input_overlay_loaded(retro_task_t *task,
|
||||||
|
|
124
retroarch.c
124
retroarch.c
|
@ -3915,7 +3915,7 @@ static void input_overlay_set_vertex_geom(input_overlay_t *ol)
|
||||||
*
|
*
|
||||||
* Scales the overlay by a factor of scale.
|
* Scales the overlay by a factor of scale.
|
||||||
**/
|
**/
|
||||||
void input_overlay_set_scale_factor(input_overlay_t *ol, float scale)
|
static void input_overlay_set_scale_factor(input_overlay_t *ol, float scale)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
|
@ -3963,6 +3963,47 @@ static void input_overlay_free_overlays(input_overlay_t *ol)
|
||||||
ol->overlays = NULL;
|
ol->overlays = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static enum overlay_visibility input_overlay_get_visibility(int overlay_idx)
|
||||||
|
{
|
||||||
|
if (!visibility)
|
||||||
|
return OVERLAY_VISIBILITY_DEFAULT;
|
||||||
|
if ((overlay_idx < 0) || (overlay_idx >= MAX_VISIBILITY))
|
||||||
|
return OVERLAY_VISIBILITY_DEFAULT;
|
||||||
|
return visibility[overlay_idx];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static bool input_overlay_is_hidden(int overlay_idx)
|
||||||
|
{
|
||||||
|
return (input_overlay_get_visibility(overlay_idx)
|
||||||
|
== OVERLAY_VISIBILITY_HIDDEN);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* input_overlay_set_alpha_mod:
|
||||||
|
* @ol : Overlay handle.
|
||||||
|
* @mod : New modulating factor to apply.
|
||||||
|
*
|
||||||
|
* Sets a modulating factor for alpha channel. Default is 1.0.
|
||||||
|
* The alpha factor is applied for all overlays.
|
||||||
|
**/
|
||||||
|
static void input_overlay_set_alpha_mod(input_overlay_t *ol, float mod)
|
||||||
|
{
|
||||||
|
unsigned i;
|
||||||
|
|
||||||
|
if (!ol)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (i = 0; i < ol->active->load_images_size; i++)
|
||||||
|
{
|
||||||
|
if (input_overlay_is_hidden(i))
|
||||||
|
ol->iface->set_alpha(ol->iface_data, i, 0.0);
|
||||||
|
else
|
||||||
|
ol->iface->set_alpha(ol->iface_data, i, mod);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void input_overlay_load_active(input_overlay_t *ol, float opacity)
|
static void input_overlay_load_active(input_overlay_t *ol, float opacity)
|
||||||
{
|
{
|
||||||
if (ol->iface->load)
|
if (ol->iface->load)
|
||||||
|
@ -4193,26 +4234,6 @@ static void input_overlay_poll_clear(input_overlay_t *ol, float opacity)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* input_overlay_next:
|
|
||||||
* @ol : Overlay handle.
|
|
||||||
*
|
|
||||||
* Switch to the next available overlay
|
|
||||||
* screen.
|
|
||||||
**/
|
|
||||||
void input_overlay_next(input_overlay_t *ol, float opacity)
|
|
||||||
{
|
|
||||||
if (!ol)
|
|
||||||
return;
|
|
||||||
|
|
||||||
ol->index = ol->next_index;
|
|
||||||
ol->active = &ol->overlays[ol->index];
|
|
||||||
|
|
||||||
input_overlay_load_active(ol, opacity);
|
|
||||||
|
|
||||||
ol->blocked = true;
|
|
||||||
ol->next_index = (unsigned)((ol->index + 1) % ol->size);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* input_overlay_free:
|
* input_overlay_free:
|
||||||
|
@ -4220,7 +4241,7 @@ void input_overlay_next(input_overlay_t *ol, float opacity)
|
||||||
*
|
*
|
||||||
* Frees overlay handle.
|
* Frees overlay handle.
|
||||||
**/
|
**/
|
||||||
void input_overlay_free(input_overlay_t *ol)
|
static void input_overlay_free(input_overlay_t *ol)
|
||||||
{
|
{
|
||||||
if (!ol)
|
if (!ol)
|
||||||
return;
|
return;
|
||||||
|
@ -4325,45 +4346,6 @@ void input_overlay_set_visibility(int overlay_idx,
|
||||||
ol->iface->set_alpha(ol->iface_data, overlay_idx, 0.0);
|
ol->iface->set_alpha(ol->iface_data, overlay_idx, 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum overlay_visibility input_overlay_get_visibility(int overlay_idx)
|
|
||||||
{
|
|
||||||
if (!visibility)
|
|
||||||
return OVERLAY_VISIBILITY_DEFAULT;
|
|
||||||
if ((overlay_idx < 0) || (overlay_idx >= MAX_VISIBILITY))
|
|
||||||
return OVERLAY_VISIBILITY_DEFAULT;
|
|
||||||
return visibility[overlay_idx];
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool input_overlay_is_hidden(int overlay_idx)
|
|
||||||
{
|
|
||||||
return (input_overlay_get_visibility(overlay_idx)
|
|
||||||
== OVERLAY_VISIBILITY_HIDDEN);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* input_overlay_set_alpha_mod:
|
|
||||||
* @ol : Overlay handle.
|
|
||||||
* @mod : New modulating factor to apply.
|
|
||||||
*
|
|
||||||
* Sets a modulating factor for alpha channel. Default is 1.0.
|
|
||||||
* The alpha factor is applied for all overlays.
|
|
||||||
**/
|
|
||||||
void input_overlay_set_alpha_mod(input_overlay_t *ol, float mod)
|
|
||||||
{
|
|
||||||
unsigned i;
|
|
||||||
|
|
||||||
if (!ol)
|
|
||||||
return;
|
|
||||||
|
|
||||||
for (i = 0; i < ol->active->load_images_size; i++)
|
|
||||||
{
|
|
||||||
if (input_overlay_is_hidden(i))
|
|
||||||
ol->iface->set_alpha(ol->iface_data, i, 0.0);
|
|
||||||
else
|
|
||||||
ol->iface->set_alpha(ol->iface_data, i, mod);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool input_overlay_key_pressed(input_overlay_t *ol, unsigned key)
|
bool input_overlay_key_pressed(input_overlay_t *ol, unsigned key)
|
||||||
{
|
{
|
||||||
input_overlay_state_t *ol_state = ol ? &ol->overlay_state : NULL;
|
input_overlay_state_t *ol_state = ol ? &ol->overlay_state : NULL;
|
||||||
|
@ -4531,10 +4513,28 @@ static void input_poll_overlay(input_overlay_t *ol, float opacity,
|
||||||
input_overlay_poll_clear(ol, opacity);
|
input_overlay_poll_clear(ol, opacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* retroarch_overlay_next:
|
||||||
|
* @ol : Overlay handle.
|
||||||
|
*
|
||||||
|
* Switch to the next available overlay
|
||||||
|
* screen.
|
||||||
|
**/
|
||||||
void retroarch_overlay_next(void)
|
void retroarch_overlay_next(void)
|
||||||
{
|
{
|
||||||
settings_t *settings = configuration_settings;
|
settings_t *settings = configuration_settings;
|
||||||
input_overlay_next(overlay_ptr, settings->floats.input_overlay_opacity);
|
float opacity = settings->floats.input_overlay_opacity;
|
||||||
|
|
||||||
|
if (!overlay_ptr)
|
||||||
|
return;
|
||||||
|
|
||||||
|
overlay_ptr->index = overlay_ptr->next_index;
|
||||||
|
overlay_ptr->active = &overlay_ptr->overlays[overlay_ptr->index];
|
||||||
|
|
||||||
|
input_overlay_load_active(overlay_ptr, opacity);
|
||||||
|
|
||||||
|
overlay_ptr->blocked = true;
|
||||||
|
overlay_ptr->next_index = (unsigned)((overlay_ptr->index + 1) % overlay_ptr->size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void retroarch_overlay_set_scale_factor(void)
|
void retroarch_overlay_set_scale_factor(void)
|
||||||
|
|
Loading…
Reference in New Issue