RSX/Qt: add the possibility to center the performance overlay

This commit is contained in:
Megamouse 2018-07-21 21:37:53 +02:00
parent 67aff85e8e
commit 2211e95e41
6 changed files with 58 additions and 10 deletions

View file

@ -43,6 +43,16 @@ namespace rsx
break;
}
if (g_cfg.video.perf_overlay.center_x)
{
pos.x = (virtual_width - m_body.w) / 2;
}
if (g_cfg.video.perf_overlay.center_y)
{
pos.y = (virtual_height - m_body.h) / 2;
}
elm.set_pos(pos.x, pos.y);
elm.set_padding(padding.x1, padding.x2, padding.y1, padding.y2);
}

View file

@ -456,8 +456,10 @@ struct cfg_root : cfg::node
cfg::_int<4, 36> font_size{ this, "Font size (px)", 10 };
cfg::_enum<screen_quadrant> position{this, "Position", screen_quadrant::top_left};
cfg::string font{this, "Font", "n023055ms.ttf"};
cfg::_int<0, 500> margin_x{this, "Horizontal Margin (px)", 50}; // horizontal distance to the screen border relative to the screen_quadrant in px
cfg::_int<0, 500> margin_y{this, "Vertical Margin (px)", 50}; // vertical distance to the screen border relative to the screen_quadrant in px
cfg::_int<0, 1280> margin_x{this, "Horizontal Margin (px)", 50}; // horizontal distance to the screen border relative to the screen_quadrant in px
cfg::_int<0, 720> margin_y{this, "Vertical Margin (px)", 50}; // vertical distance to the screen border relative to the screen_quadrant in px
cfg::_bool center_x{ this, "Center Horizontally", false };
cfg::_bool center_y{ this, "Center Vertically", false };
cfg::_int<0, 100> opacity{this, "Opacity (%)", 70};
} perf_overlay{this};

View file

@ -79,7 +79,9 @@
"perfOverlayFontSize": "Sets the font size of the performance overlay (measured in pixels).",
"perfOverlayOpacity": "Sets the opacity of the performance overlay (measured in %).",
"perfOverlayMarginX": "Sets the horizontal distance to the screen border relative to the screen quadrant (measured in pixels).",
"perfOverlayMarginY": "Sets the vertical distance to the screen border relative to the screen quadrant (measured in pixels)."
"perfOverlayMarginY": "Sets the vertical distance to the screen border relative to the screen quadrant (measured in pixels).",
"perfOverlayCenterX": "Centers the performance overlay horizontally and overrides the horizontal margin.",
"perfOverlayCenterY": "Centers the performance overlay vertically and overrides the vertical margin."
}
},
"gpu": {

View file

@ -86,6 +86,8 @@ public:
PerfOverlayOpacity,
PerfOverlayMarginX,
PerfOverlayMarginY,
PerfOverlayCenterX,
PerfOverlayCenterY,
// Audio
AudioRenderer,
@ -277,6 +279,8 @@ private:
{ PerfOverlayOpacity, { "Video", "Performance Overlay", "Opacity (%)" } },
{ PerfOverlayMarginX, { "Video", "Performance Overlay", "Horizontal Margin (px)" } },
{ PerfOverlayMarginY, { "Video", "Performance Overlay", "Vertical Margin (px)" } },
{ PerfOverlayCenterX, { "Video", "Performance Overlay", "Center Horizontally" } },
{ PerfOverlayCenterY, { "Video", "Performance Overlay", "Center Vertically" } },
// Audio
{ AudioRenderer, { "Audio", "Renderer"}},

View file

@ -812,6 +812,22 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
xemu_settings->EnhanceCheckBox(ui->showShaderCompilationHint, emu_settings::ShowShaderCompilationHint);
SubscribeTooltip(ui->showShaderCompilationHint, json_emu_misc["showShaderCompilationHint"].toString());
xemu_settings->EnhanceCheckBox(ui->perfOverlayCenterX, emu_settings::PerfOverlayCenterX);
SubscribeTooltip(ui->perfOverlayCenterX, json_emu_overlay["perfOverlayCenterX"].toString());
connect(ui->perfOverlayCenterX, &QCheckBox::clicked, [this](bool checked)
{
ui->perfOverlayMarginX->setEnabled(!checked);
});
ui->perfOverlayMarginX->setEnabled(!ui->perfOverlayCenterX->isChecked());
xemu_settings->EnhanceCheckBox(ui->perfOverlayCenterY, emu_settings::PerfOverlayCenterY);
SubscribeTooltip(ui->perfOverlayCenterY, json_emu_overlay["perfOverlayCenterY"].toString());
connect(ui->perfOverlayCenterY, &QCheckBox::clicked, [this](bool checked)
{
ui->perfOverlayMarginY->setEnabled(!checked);
});
ui->perfOverlayMarginY->setEnabled(!ui->perfOverlayCenterY->isChecked());
xemu_settings->EnhanceCheckBox(ui->perfOverlayEnabled, emu_settings::PerfOverlayEnabled);
SubscribeTooltip(ui->perfOverlayEnabled, json_emu_overlay["perfOverlayEnabled"].toString());
auto EnablePerfOverlayOptions = [this](bool enabled)

View file

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>703</width>
<height>482</height>
<height>499</height>
</rect>
</property>
<property name="sizePolicy">
@ -1433,11 +1433,18 @@
<widget class="QComboBox" name="perfOverlayPosition"/>
</item>
<item>
<layout class="QHBoxLayout" name="layout_margin_x" stretch="2,1">
<widget class="QLabel" name="label_margin_x">
<property name="text">
<string>Horizontal Margin:</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="layout_margin_x" stretch="0,0">
<item>
<widget class="QLabel" name="label_margin_x">
<widget class="QCheckBox" name="perfOverlayCenterX">
<property name="text">
<string>Horizontal Margin:</string>
<string>Centered</string>
</property>
</widget>
</item>
@ -1447,11 +1454,18 @@
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="layout_margin_y" stretch="2,1">
<widget class="QLabel" name="label_margin_y">
<property name="text">
<string>Vertical Margin:</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="layout_margin_y" stretch="0,0">
<item>
<widget class="QLabel" name="label_margin_y">
<widget class="QCheckBox" name="perfOverlayCenterY">
<property name="text">
<string>Vertical Margin:</string>
<string>Centered</string>
</property>
</widget>
</item>