diff options
| -rw-r--r-- | src/video_core/renderer_base.cpp | 1 | ||||
| -rw-r--r-- | src/video_core/renderer_base.h | 1 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/renderer_opengl.cpp | 6 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_graphics.cpp | 16 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_graphics.h | 1 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_graphics.ui | 21 |
6 files changed, 46 insertions, 0 deletions
diff --git a/src/video_core/renderer_base.cpp b/src/video_core/renderer_base.cpp index be17a2b9c..0df3725c2 100644 --- a/src/video_core/renderer_base.cpp +++ b/src/video_core/renderer_base.cpp | |||
| @@ -19,6 +19,7 @@ void RendererBase::RefreshBaseSettings() { | |||
| 19 | UpdateCurrentFramebufferLayout(); | 19 | UpdateCurrentFramebufferLayout(); |
| 20 | 20 | ||
| 21 | renderer_settings.use_framelimiter = Settings::values.use_frame_limit; | 21 | renderer_settings.use_framelimiter = Settings::values.use_frame_limit; |
| 22 | renderer_settings.set_background_color = true; | ||
| 22 | } | 23 | } |
| 23 | 24 | ||
| 24 | void RendererBase::UpdateCurrentFramebufferLayout() { | 25 | void RendererBase::UpdateCurrentFramebufferLayout() { |
diff --git a/src/video_core/renderer_base.h b/src/video_core/renderer_base.h index 2a357f9d0..2cd0738ff 100644 --- a/src/video_core/renderer_base.h +++ b/src/video_core/renderer_base.h | |||
| @@ -19,6 +19,7 @@ namespace VideoCore { | |||
| 19 | 19 | ||
| 20 | struct RendererSettings { | 20 | struct RendererSettings { |
| 21 | std::atomic_bool use_framelimiter{false}; | 21 | std::atomic_bool use_framelimiter{false}; |
| 22 | std::atomic_bool set_background_color{false}; | ||
| 22 | }; | 23 | }; |
| 23 | 24 | ||
| 24 | class RendererBase : NonCopyable { | 25 | class RendererBase : NonCopyable { |
diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index ccff3e342..96d916b07 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.cpp +++ b/src/video_core/renderer_opengl/renderer_opengl.cpp | |||
| @@ -369,6 +369,12 @@ void RendererOpenGL::DrawScreenTriangles(const ScreenInfo& screen_info, float x, | |||
| 369 | * Draws the emulated screens to the emulator window. | 369 | * Draws the emulated screens to the emulator window. |
| 370 | */ | 370 | */ |
| 371 | void RendererOpenGL::DrawScreen() { | 371 | void RendererOpenGL::DrawScreen() { |
| 372 | if (renderer_settings.set_background_color) { | ||
| 373 | // Update background color before drawing | ||
| 374 | glClearColor(Settings::values.bg_red, Settings::values.bg_green, Settings::values.bg_blue, | ||
| 375 | 0.0f); | ||
| 376 | } | ||
| 377 | |||
| 372 | const auto& layout = render_window.GetFramebufferLayout(); | 378 | const auto& layout = render_window.GetFramebufferLayout(); |
| 373 | const auto& screen = layout.screen; | 379 | const auto& screen = layout.screen; |
| 374 | 380 | ||
diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp index ee1287028..839d58f59 100644 --- a/src/yuzu/configuration/configure_graphics.cpp +++ b/src/yuzu/configuration/configure_graphics.cpp | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <QColorDialog> | ||
| 5 | #include "core/core.h" | 6 | #include "core/core.h" |
| 6 | #include "core/settings.h" | 7 | #include "core/settings.h" |
| 7 | #include "ui_configure_graphics.h" | 8 | #include "ui_configure_graphics.h" |
| @@ -16,6 +17,14 @@ ConfigureGraphics::ConfigureGraphics(QWidget* parent) | |||
| 16 | ui->frame_limit->setEnabled(Settings::values.use_frame_limit); | 17 | ui->frame_limit->setEnabled(Settings::values.use_frame_limit); |
| 17 | connect(ui->toggle_frame_limit, &QCheckBox::stateChanged, ui->frame_limit, | 18 | connect(ui->toggle_frame_limit, &QCheckBox::stateChanged, ui->frame_limit, |
| 18 | &QSpinBox::setEnabled); | 19 | &QSpinBox::setEnabled); |
| 20 | connect(ui->bg_button, &QPushButton::clicked, this, [this] { | ||
| 21 | const QColor new_bg_color = QColorDialog::getColor(bg_color); | ||
| 22 | if (!new_bg_color.isValid()) | ||
| 23 | return; | ||
| 24 | bg_color = new_bg_color; | ||
| 25 | ui->bg_button->setStyleSheet( | ||
| 26 | QString("QPushButton { background-color: %1 }").arg(bg_color.name())); | ||
| 27 | }); | ||
| 19 | } | 28 | } |
| 20 | 29 | ||
| 21 | ConfigureGraphics::~ConfigureGraphics() = default; | 30 | ConfigureGraphics::~ConfigureGraphics() = default; |
| @@ -65,6 +74,10 @@ void ConfigureGraphics::setConfiguration() { | |||
| 65 | ui->toggle_frame_limit->setChecked(Settings::values.use_frame_limit); | 74 | ui->toggle_frame_limit->setChecked(Settings::values.use_frame_limit); |
| 66 | ui->frame_limit->setValue(Settings::values.frame_limit); | 75 | ui->frame_limit->setValue(Settings::values.frame_limit); |
| 67 | ui->use_accurate_framebuffers->setChecked(Settings::values.use_accurate_framebuffers); | 76 | ui->use_accurate_framebuffers->setChecked(Settings::values.use_accurate_framebuffers); |
| 77 | bg_color = QColor::fromRgbF(Settings::values.bg_red, Settings::values.bg_green, | ||
| 78 | Settings::values.bg_blue); | ||
| 79 | ui->bg_button->setStyleSheet( | ||
| 80 | QString("QPushButton { background-color: %1 }").arg(bg_color.name())); | ||
| 68 | } | 81 | } |
| 69 | 82 | ||
| 70 | void ConfigureGraphics::applyConfiguration() { | 83 | void ConfigureGraphics::applyConfiguration() { |
| @@ -73,4 +86,7 @@ void ConfigureGraphics::applyConfiguration() { | |||
| 73 | Settings::values.use_frame_limit = ui->toggle_frame_limit->isChecked(); | 86 | Settings::values.use_frame_limit = ui->toggle_frame_limit->isChecked(); |
| 74 | Settings::values.frame_limit = ui->frame_limit->value(); | 87 | Settings::values.frame_limit = ui->frame_limit->value(); |
| 75 | Settings::values.use_accurate_framebuffers = ui->use_accurate_framebuffers->isChecked(); | 88 | Settings::values.use_accurate_framebuffers = ui->use_accurate_framebuffers->isChecked(); |
| 89 | Settings::values.bg_red = static_cast<float>(bg_color.redF()); | ||
| 90 | Settings::values.bg_green = static_cast<float>(bg_color.greenF()); | ||
| 91 | Settings::values.bg_blue = static_cast<float>(bg_color.blueF()); | ||
| 76 | } | 92 | } |
diff --git a/src/yuzu/configuration/configure_graphics.h b/src/yuzu/configuration/configure_graphics.h index 5497a55f7..9bda26fd6 100644 --- a/src/yuzu/configuration/configure_graphics.h +++ b/src/yuzu/configuration/configure_graphics.h | |||
| @@ -25,4 +25,5 @@ private: | |||
| 25 | 25 | ||
| 26 | private: | 26 | private: |
| 27 | std::unique_ptr<Ui::ConfigureGraphics> ui; | 27 | std::unique_ptr<Ui::ConfigureGraphics> ui; |
| 28 | QColor bg_color; | ||
| 28 | }; | 29 | }; |
diff --git a/src/yuzu/configuration/configure_graphics.ui b/src/yuzu/configuration/configure_graphics.ui index 3bc18c26e..8fc00af1b 100644 --- a/src/yuzu/configuration/configure_graphics.ui +++ b/src/yuzu/configuration/configure_graphics.ui | |||
| @@ -96,6 +96,27 @@ | |||
| 96 | </item> | 96 | </item> |
| 97 | </layout> | 97 | </layout> |
| 98 | </item> | 98 | </item> |
| 99 | <item> | ||
| 100 | <layout class="QHBoxLayout" name="horizontalLayout_6"> | ||
| 101 | <item> | ||
| 102 | <widget class="QLabel" name="bg_label"> | ||
| 103 | <property name="text"> | ||
| 104 | <string>Background Color:</string> | ||
| 105 | </property> | ||
| 106 | </widget> | ||
| 107 | </item> | ||
| 108 | <item> | ||
| 109 | <widget class="QPushButton" name="bg_button"> | ||
| 110 | <property name="maximumSize"> | ||
| 111 | <size> | ||
| 112 | <width>40</width> | ||
| 113 | <height>16777215</height> | ||
| 114 | </size> | ||
| 115 | </property> | ||
| 116 | </widget> | ||
| 117 | </item> | ||
| 118 | </layout> | ||
| 119 | </item> | ||
| 99 | </layout> | 120 | </layout> |
| 100 | </widget> | 121 | </widget> |
| 101 | </item> | 122 | </item> |