mirror of
https://github.com/citra-emu/citra.git
synced 2025-04-21 05:10:06 +00:00
BackGround_Colour_Selector
This commit is contained in:
parent
9dd09cb60d
commit
219bf6d2c2
@ -7,6 +7,8 @@
|
|||||||
#include "core/settings.h"
|
#include "core/settings.h"
|
||||||
#include "ui_configure_graphics.h"
|
#include "ui_configure_graphics.h"
|
||||||
|
|
||||||
|
#include <QColorDialog>
|
||||||
|
|
||||||
ConfigureGraphics::ConfigureGraphics(QWidget* parent)
|
ConfigureGraphics::ConfigureGraphics(QWidget* parent)
|
||||||
: QWidget(parent), ui(new Ui::ConfigureGraphics) {
|
: QWidget(parent), ui(new Ui::ConfigureGraphics) {
|
||||||
|
|
||||||
@ -16,10 +18,20 @@ ConfigureGraphics::ConfigureGraphics(QWidget* parent)
|
|||||||
ui->toggle_vsync->setEnabled(!Core::System::GetInstance().IsPoweredOn());
|
ui->toggle_vsync->setEnabled(!Core::System::GetInstance().IsPoweredOn());
|
||||||
|
|
||||||
ui->layoutBox->setEnabled(!Settings::values.custom_layout);
|
ui->layoutBox->setEnabled(!Settings::values.custom_layout);
|
||||||
|
|
||||||
|
connect(ui->layout_bg, SIGNAL (released()), this, SLOT (showLayoutBackgroundDialog()));
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigureGraphics::~ConfigureGraphics() {}
|
ConfigureGraphics::~ConfigureGraphics() {}
|
||||||
|
|
||||||
|
void ConfigureGraphics::showLayoutBackgroundDialog() {
|
||||||
|
QColor new_color = QColorDialog::getColor(bg_color, this);
|
||||||
|
if (new_color.isValid()) {
|
||||||
|
bg_color = new_color;
|
||||||
|
ui->layout_bg->setStyleSheet("QPushButton { background-color: " + bg_color.name() + ";}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
enum class Resolution : int {
|
enum class Resolution : int {
|
||||||
Auto,
|
Auto,
|
||||||
Scale1x,
|
Scale1x,
|
||||||
@ -96,6 +108,10 @@ void ConfigureGraphics::setConfiguration() {
|
|||||||
ui->resolution_factor_combobox->setCurrentIndex(
|
ui->resolution_factor_combobox->setCurrentIndex(
|
||||||
static_cast<int>(FromResolutionFactor(Settings::values.resolution_factor)));
|
static_cast<int>(FromResolutionFactor(Settings::values.resolution_factor)));
|
||||||
ui->toggle_vsync->setChecked(Settings::values.use_vsync);
|
ui->toggle_vsync->setChecked(Settings::values.use_vsync);
|
||||||
|
{
|
||||||
|
bg_color.setRgbF(Settings::values.bg_red, Settings::values.bg_green, Settings::values.bg_blue);
|
||||||
|
ui->layout_bg->setStyleSheet("QPushButton { background-color: " + bg_color.name() + ";}");
|
||||||
|
}
|
||||||
ui->toggle_framelimit->setChecked(Settings::values.toggle_framelimit);
|
ui->toggle_framelimit->setChecked(Settings::values.toggle_framelimit);
|
||||||
ui->layout_combobox->setCurrentIndex(static_cast<int>(Settings::values.layout_option));
|
ui->layout_combobox->setCurrentIndex(static_cast<int>(Settings::values.layout_option));
|
||||||
ui->swap_screen->setChecked(Settings::values.swap_screen);
|
ui->swap_screen->setChecked(Settings::values.swap_screen);
|
||||||
@ -107,6 +123,9 @@ void ConfigureGraphics::applyConfiguration() {
|
|||||||
Settings::values.resolution_factor =
|
Settings::values.resolution_factor =
|
||||||
ToResolutionFactor(static_cast<Resolution>(ui->resolution_factor_combobox->currentIndex()));
|
ToResolutionFactor(static_cast<Resolution>(ui->resolution_factor_combobox->currentIndex()));
|
||||||
Settings::values.use_vsync = ui->toggle_vsync->isChecked();
|
Settings::values.use_vsync = ui->toggle_vsync->isChecked();
|
||||||
|
Settings::values.bg_red = bg_color.redF();
|
||||||
|
Settings::values.bg_green = bg_color.greenF();
|
||||||
|
Settings::values.bg_blue = bg_color.blueF();
|
||||||
Settings::values.toggle_framelimit = ui->toggle_framelimit->isChecked();
|
Settings::values.toggle_framelimit = ui->toggle_framelimit->isChecked();
|
||||||
Settings::values.layout_option =
|
Settings::values.layout_option =
|
||||||
static_cast<Settings::LayoutOption>(ui->layout_combobox->currentIndex());
|
static_cast<Settings::LayoutOption>(ui->layout_combobox->currentIndex());
|
||||||
|
@ -23,6 +23,10 @@ public:
|
|||||||
private:
|
private:
|
||||||
void setConfiguration();
|
void setConfiguration();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void showLayoutBackgroundDialog();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
QColor bg_color;
|
||||||
std::unique_ptr<Ui::ConfigureGraphics> ui;
|
std::unique_ptr<Ui::ConfigureGraphics> ui;
|
||||||
};
|
};
|
||||||
|
@ -133,6 +133,21 @@
|
|||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Background color:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="layout_bg">
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
<item>
|
<item>
|
||||||
|
@ -234,8 +234,6 @@ void RendererOpenGL::LoadColorToActiveGLTexture(u8 color_r, u8 color_g, u8 color
|
|||||||
* Initializes the OpenGL state and creates persistent objects.
|
* Initializes the OpenGL state and creates persistent objects.
|
||||||
*/
|
*/
|
||||||
void RendererOpenGL::InitOpenGLObjects() {
|
void RendererOpenGL::InitOpenGLObjects() {
|
||||||
glClearColor(Settings::values.bg_red, Settings::values.bg_green, Settings::values.bg_blue,
|
|
||||||
0.0f);
|
|
||||||
|
|
||||||
// Link shaders and get variable locations
|
// Link shaders and get variable locations
|
||||||
shader.Create(vertex_shader, fragment_shader);
|
shader.Create(vertex_shader, fragment_shader);
|
||||||
@ -383,6 +381,8 @@ void RendererOpenGL::DrawScreens() {
|
|||||||
const auto& bottom_screen = layout.bottom_screen;
|
const auto& bottom_screen = layout.bottom_screen;
|
||||||
|
|
||||||
glViewport(0, 0, layout.width, layout.height);
|
glViewport(0, 0, layout.width, layout.height);
|
||||||
|
glClearColor(Settings::values.bg_red, Settings::values.bg_green, Settings::values.bg_blue,
|
||||||
|
0.0f);
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
// Set projection matrix
|
// Set projection matrix
|
||||||
|
Loading…
x
Reference in New Issue
Block a user