mirror of
https://github.com/yuzu-emu/yuzu-mainline.git
synced 2024-12-24 19:15:45 +00:00
parent
af074ee422
commit
3dcedb36b4
|
@ -19,6 +19,7 @@ void RendererBase::RefreshBaseSettings() {
|
||||||
UpdateCurrentFramebufferLayout();
|
UpdateCurrentFramebufferLayout();
|
||||||
|
|
||||||
renderer_settings.use_framelimiter = Settings::values.use_frame_limit;
|
renderer_settings.use_framelimiter = Settings::values.use_frame_limit;
|
||||||
|
renderer_settings.set_background_color = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RendererBase::UpdateCurrentFramebufferLayout() {
|
void RendererBase::UpdateCurrentFramebufferLayout() {
|
||||||
|
|
|
@ -19,6 +19,7 @@ namespace VideoCore {
|
||||||
|
|
||||||
struct RendererSettings {
|
struct RendererSettings {
|
||||||
std::atomic_bool use_framelimiter{false};
|
std::atomic_bool use_framelimiter{false};
|
||||||
|
std::atomic_bool set_background_color{false};
|
||||||
};
|
};
|
||||||
|
|
||||||
class RendererBase : NonCopyable {
|
class RendererBase : NonCopyable {
|
||||||
|
|
|
@ -369,6 +369,12 @@ void RendererOpenGL::DrawScreenTriangles(const ScreenInfo& screen_info, float x,
|
||||||
* Draws the emulated screens to the emulator window.
|
* Draws the emulated screens to the emulator window.
|
||||||
*/
|
*/
|
||||||
void RendererOpenGL::DrawScreen() {
|
void RendererOpenGL::DrawScreen() {
|
||||||
|
if (renderer_settings.set_background_color) {
|
||||||
|
// Update background color before drawing
|
||||||
|
glClearColor(Settings::values.bg_red, Settings::values.bg_green, Settings::values.bg_blue,
|
||||||
|
0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
const auto& layout = render_window.GetFramebufferLayout();
|
const auto& layout = render_window.GetFramebufferLayout();
|
||||||
const auto& screen = layout.screen;
|
const auto& screen = layout.screen;
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include <QColorDialog>
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "core/settings.h"
|
#include "core/settings.h"
|
||||||
#include "ui_configure_graphics.h"
|
#include "ui_configure_graphics.h"
|
||||||
|
@ -16,6 +17,14 @@ ConfigureGraphics::ConfigureGraphics(QWidget* parent)
|
||||||
ui->frame_limit->setEnabled(Settings::values.use_frame_limit);
|
ui->frame_limit->setEnabled(Settings::values.use_frame_limit);
|
||||||
connect(ui->toggle_frame_limit, &QCheckBox::stateChanged, ui->frame_limit,
|
connect(ui->toggle_frame_limit, &QCheckBox::stateChanged, ui->frame_limit,
|
||||||
&QSpinBox::setEnabled);
|
&QSpinBox::setEnabled);
|
||||||
|
connect(ui->bg_button, &QPushButton::clicked, this, [this] {
|
||||||
|
const QColor new_bg_color = QColorDialog::getColor(bg_color);
|
||||||
|
if (!new_bg_color.isValid())
|
||||||
|
return;
|
||||||
|
bg_color = new_bg_color;
|
||||||
|
ui->bg_button->setStyleSheet(
|
||||||
|
QString("QPushButton { background-color: %1 }").arg(bg_color.name()));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigureGraphics::~ConfigureGraphics() = default;
|
ConfigureGraphics::~ConfigureGraphics() = default;
|
||||||
|
@ -65,6 +74,10 @@ void ConfigureGraphics::setConfiguration() {
|
||||||
ui->toggle_frame_limit->setChecked(Settings::values.use_frame_limit);
|
ui->toggle_frame_limit->setChecked(Settings::values.use_frame_limit);
|
||||||
ui->frame_limit->setValue(Settings::values.frame_limit);
|
ui->frame_limit->setValue(Settings::values.frame_limit);
|
||||||
ui->use_accurate_framebuffers->setChecked(Settings::values.use_accurate_framebuffers);
|
ui->use_accurate_framebuffers->setChecked(Settings::values.use_accurate_framebuffers);
|
||||||
|
bg_color = QColor::fromRgbF(Settings::values.bg_red, Settings::values.bg_green,
|
||||||
|
Settings::values.bg_blue);
|
||||||
|
ui->bg_button->setStyleSheet(
|
||||||
|
QString("QPushButton { background-color: %1 }").arg(bg_color.name()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureGraphics::applyConfiguration() {
|
void ConfigureGraphics::applyConfiguration() {
|
||||||
|
@ -73,4 +86,7 @@ void ConfigureGraphics::applyConfiguration() {
|
||||||
Settings::values.use_frame_limit = ui->toggle_frame_limit->isChecked();
|
Settings::values.use_frame_limit = ui->toggle_frame_limit->isChecked();
|
||||||
Settings::values.frame_limit = ui->frame_limit->value();
|
Settings::values.frame_limit = ui->frame_limit->value();
|
||||||
Settings::values.use_accurate_framebuffers = ui->use_accurate_framebuffers->isChecked();
|
Settings::values.use_accurate_framebuffers = ui->use_accurate_framebuffers->isChecked();
|
||||||
|
Settings::values.bg_red = static_cast<float>(bg_color.redF());
|
||||||
|
Settings::values.bg_green = static_cast<float>(bg_color.greenF());
|
||||||
|
Settings::values.bg_blue = static_cast<float>(bg_color.blueF());
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,4 +25,5 @@ private:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<Ui::ConfigureGraphics> ui;
|
std::unique_ptr<Ui::ConfigureGraphics> ui;
|
||||||
|
QColor bg_color;
|
||||||
};
|
};
|
||||||
|
|
|
@ -96,6 +96,27 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="bg_label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Background Color:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="bg_button">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
Loading…
Reference in a new issue