mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-26 04:32:35 +01:00
overlays: Fix text rendering position
- It should be offset by one line, not half - Also tweak every overlay element affected by this to look as it used to
This commit is contained in:
parent
44449dd9e9
commit
07731d0228
@ -794,9 +794,9 @@ namespace rsx
|
||||
text_extents_w = std::max(v.values[0], text_extents_w);
|
||||
|
||||
//Apply transform.
|
||||
//(0, 0) has text sitting 50% off the top left corner (text is outside the rect) hence the offset by text height / 2
|
||||
//(0, 0) has text sitting one line off the top left corner (text is outside the rect) hence the offset by text height
|
||||
v.values[0] += x + padding_left;
|
||||
v.values[1] += y + padding_top + (f32)renderer->size_px * 0.5f;
|
||||
v.values[1] += y + padding_top + (f32)renderer->size_px;
|
||||
}
|
||||
|
||||
if (alignment == center)
|
||||
@ -1201,7 +1201,8 @@ namespace rsx
|
||||
|
||||
struct image_button : public image_view
|
||||
{
|
||||
u16 text_offset = 0;
|
||||
const u16 text_horizontal_offset = 25;
|
||||
u16 m_text_offset = 0;
|
||||
|
||||
image_button()
|
||||
{
|
||||
@ -1219,7 +1220,7 @@ namespace rsx
|
||||
void set_size(u16 /*w*/, u16 h) override
|
||||
{
|
||||
image_view::set_size(h, h);
|
||||
text_offset = (h / 2) + 10; //By default text is at the horizontal center
|
||||
m_text_offset = (h / 2) + text_horizontal_offset; //By default text is at the horizontal center
|
||||
}
|
||||
|
||||
compiled_resource& get_compiled() override
|
||||
@ -1227,18 +1228,14 @@ namespace rsx
|
||||
if (!is_compiled)
|
||||
{
|
||||
auto& compiled = image_view::get_compiled();
|
||||
for (auto &cmd : compiled.draw_commands)
|
||||
for (auto& cmd : compiled.draw_commands)
|
||||
{
|
||||
if (cmd.config.texture_ref == image_resource_id::font_file)
|
||||
{
|
||||
//Text, translate geometry to the right
|
||||
const f32 text_height = font_ref ? font_ref->size_px : 16.f;
|
||||
const f32 offset_y = (h > text_height) ? (f32)(h - text_height) : ((f32)h - text_height);
|
||||
|
||||
for (auto &v : cmd.verts)
|
||||
{
|
||||
v.values[0] += text_offset + 15.f;
|
||||
v.values[1] += offset_y + 5.f;
|
||||
v.values[0] += m_text_offset;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1317,7 +1314,7 @@ namespace rsx
|
||||
{
|
||||
u16 text_w, text_h;
|
||||
text_view.measure_text(text_w, text_h);
|
||||
text_h += 5;
|
||||
text_h += 13;
|
||||
|
||||
overlay_element::set_pos(_x, _y + text_h);
|
||||
indicator.set_pos(_x, _y + text_h);
|
||||
|
@ -491,7 +491,7 @@ namespace rsx
|
||||
std::unique_ptr<overlay_element> header_text = std::make_unique<label>(text1);
|
||||
std::unique_ptr<overlay_element> subtext = std::make_unique<label>(text2);
|
||||
|
||||
padding->set_size(1, 10);
|
||||
padding->set_size(1, 1);
|
||||
header_text->set_size(800, 40);
|
||||
header_text->text = text1;
|
||||
header_text->set_font("Arial", 16);
|
||||
@ -550,11 +550,11 @@ namespace rsx
|
||||
m_list->set_pos(20, 85);
|
||||
|
||||
m_description->set_font("Arial", 20);
|
||||
m_description->set_pos(20, 50);
|
||||
m_description->set_pos(20, 37);
|
||||
m_description->text = "Save Dialog";
|
||||
|
||||
m_time_thingy->set_font("Arial", 14);
|
||||
m_time_thingy->set_pos(1000, 40);
|
||||
m_time_thingy->set_pos(1000, 30);
|
||||
m_time_thingy->text = current_time();
|
||||
|
||||
static_cast<label*>(m_description.get())->auto_resize();
|
||||
@ -736,7 +736,7 @@ namespace rsx
|
||||
background.back_color.a = 0.85f;
|
||||
|
||||
text_display.set_size(1100, 40);
|
||||
text_display.set_pos(90, 375);
|
||||
text_display.set_pos(90, 364);
|
||||
text_display.set_font("Arial", 16);
|
||||
text_display.align_text(overlay_element::text_align::center);
|
||||
text_display.set_wrap_text(true);
|
||||
@ -844,13 +844,13 @@ namespace rsx
|
||||
num_progress_bars = type.progress_bar_count;
|
||||
if (num_progress_bars)
|
||||
{
|
||||
u16 offset = 50;
|
||||
progress_1.set_pos(240, 420);
|
||||
u16 offset = 58;
|
||||
progress_1.set_pos(240, 412);
|
||||
|
||||
if (num_progress_bars > 1)
|
||||
{
|
||||
progress_2.set_pos(240, 470);
|
||||
offset = 90;
|
||||
progress_2.set_pos(240, 462);
|
||||
offset = 98;
|
||||
}
|
||||
|
||||
//Push the other stuff down
|
||||
@ -1003,7 +1003,7 @@ namespace rsx
|
||||
image.back_color.a = 0.f;
|
||||
|
||||
text_view.set_pos(85, 0);
|
||||
text_view.set_padding(0.f, 0.f, 30.f, 0.f);
|
||||
text_view.set_padding(0.f, 0.f, 24.f, 0.f);
|
||||
text_view.set_font("Arial", 8);
|
||||
text_view.align_text(overlay_element::text_align::center);
|
||||
text_view.back_color.a = 0.f;
|
||||
@ -1072,7 +1072,7 @@ namespace rsx
|
||||
m_text.set_font("Arial", 16);
|
||||
m_text.set_text("Compiling shaders");
|
||||
m_text.auto_resize();
|
||||
m_text.set_pos(20, 700);
|
||||
m_text.set_pos(20, 690);
|
||||
|
||||
m_text.back_color.a = 0.f;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user