mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-11 20:44:24 +00:00
Fix overlay calculations with rect.
This commit is contained in:
parent
96352a13c5
commit
b17d113ac4
@ -190,12 +190,17 @@ static void input_overlay_scale(struct overlay *overlay, float scale)
|
||||
for (size_t i = 0; i < overlay->size; i++)
|
||||
{
|
||||
struct overlay_desc *desc = &overlay->descs[i];
|
||||
desc->mod_w = 2.0f * scale * desc->range_x;
|
||||
desc->mod_h = 2.0f * scale * desc->range_y;
|
||||
float center_x = (desc->x - overlay->center_x) * scale + overlay->center_x;
|
||||
float center_y = (desc->y - overlay->center_y) * scale + overlay->center_y;
|
||||
desc->mod_x = center_x - scale * desc->range_x;
|
||||
desc->mod_y = center_y - scale * desc->range_y;
|
||||
|
||||
float scale_w = overlay->mod_w * desc->range_x;
|
||||
float scale_h = overlay->mod_h * desc->range_y;
|
||||
|
||||
desc->mod_w = 2.0f * scale_w;
|
||||
desc->mod_h = 2.0f * scale_h;
|
||||
|
||||
float adj_center_x = overlay->mod_x + desc->x * overlay->mod_w;
|
||||
float adj_center_y = overlay->mod_y + desc->y * overlay->mod_h;
|
||||
desc->mod_x = adj_center_x - scale_w;
|
||||
desc->mod_y = adj_center_y - scale_h;
|
||||
}
|
||||
}
|
||||
|
||||
@ -658,7 +663,7 @@ input_overlay_t *input_overlay_new(const char *overlay)
|
||||
ol->enable = true;
|
||||
|
||||
input_overlay_set_alpha_mod(ol, g_settings.input.overlay_opacity);
|
||||
input_overlay_set_scale_factor(ol, 1.0f);
|
||||
input_overlay_set_scale_factor(ol, g_settings.input.overlay_scale);
|
||||
ol->next_index = (ol->index + 1) % ol->size;
|
||||
|
||||
return ol;
|
||||
|
@ -1,22 +1,22 @@
|
||||
overlays = 1
|
||||
# overlay0_overlay omitted. We don't need to splat an overlay across the screen.
|
||||
overlay0_rect = "0.50,0.50,0.50,0.50" # Place entire overlay in bottom right part of screen.
|
||||
overlay0_full_screen = true
|
||||
|
||||
# These set defaults across the entire overlay. They can be overridden per-desc with overlayN_descM_alpha_mod = foo, etc.
|
||||
overlay0_alpha_mod = 2.0 # If we press a button desc, it will have twice the alpha.
|
||||
overlay0_range_mod = 1.5 # If we press a button desc, the hitbox range will be 1.5x the size until it's released.
|
||||
overlay0_normalized = true # Descriptor coordinates use normalized coordinates [0, 1] instead of pixels.
|
||||
|
||||
overlay0_descs = 5
|
||||
overlay0_desc0_overlay = left.png
|
||||
overlay0_desc1_overlay = right.png
|
||||
overlay0_desc2_overlay = up.png
|
||||
overlay0_desc3_overlay = down.png
|
||||
overlay0_desc0 = "left,0.25,0.50,rect,0.125,0.125"
|
||||
overlay0_desc1 = "right,0.75,0.50,rect,0.125,0.125"
|
||||
overlay0_desc2 = "up,0.50,0.25,rect,0.125,0.125"
|
||||
overlay0_desc3 = "down,0.50,0.75,rect,0.125,0.125"
|
||||
|
||||
overlay0_desc4 = "nul,0.30,0.90,rect,0.28,0.08" # Paste an arbitrary image. Input associated with this is nul.
|
||||
overlay0_desc4_overlay = logo.png
|
||||
overlays = 1
|
||||
# overlay0_overlay omitted. We don't need to splat an overlay across the screen.
|
||||
overlay0_rect = "0.35,0.35,0.65,0.65" # Place overlay somewhere.
|
||||
overlay0_full_screen = true
|
||||
|
||||
# These set defaults across the entire overlay. They can be overridden per-desc with overlayN_descM_alpha_mod = foo, etc.
|
||||
overlay0_alpha_mod = 2.0 # If we press a button desc, it will have twice the alpha.
|
||||
overlay0_range_mod = 1.5 # If we press a button desc, the hitbox range will be 1.5x the size until it's released.
|
||||
overlay0_normalized = true # Descriptor coordinates use normalized coordinates [0, 1] instead of pixels.
|
||||
|
||||
overlay0_descs = 5
|
||||
overlay0_desc0_overlay = left.png
|
||||
overlay0_desc1_overlay = right.png
|
||||
overlay0_desc2_overlay = up.png
|
||||
overlay0_desc3_overlay = down.png
|
||||
overlay0_desc0 = "left,0.25,0.50,rect,0.125,0.125"
|
||||
overlay0_desc1 = "right,0.75,0.50,rect,0.125,0.125"
|
||||
overlay0_desc2 = "up,0.50,0.25,rect,0.125,0.125"
|
||||
overlay0_desc3 = "down,0.50,0.75,rect,0.125,0.125"
|
||||
|
||||
overlay0_desc4 = "nul,0.30,0.90,rect,0.28,0.08" # Paste an arbitrary image. Input associated with this is nul.
|
||||
overlay0_desc4_overlay = logo.png
|
||||
|
Loading…
Reference in New Issue
Block a user