1
0
Fork 0

Allow the user to set the background clear color during emulation

The background color can be seen at the sides of the bottom screen or when the window is wider than normal.
This commit is contained in:
archshift 2015-04-03 15:35:51 -07:00
parent e25ffaba86
commit cae89fb315
5 changed files with 32 additions and 1 deletions

View File

@ -66,6 +66,11 @@ void Config::ReadValues() {
Settings::values.gpu_refresh_rate = glfw_config->GetInteger("Core", "gpu_refresh_rate", 30); Settings::values.gpu_refresh_rate = glfw_config->GetInteger("Core", "gpu_refresh_rate", 30);
Settings::values.frame_skip = glfw_config->GetInteger("Core", "frame_skip", 0); Settings::values.frame_skip = glfw_config->GetInteger("Core", "frame_skip", 0);
// Renderer
Settings::values.bg_red = (float)glfw_config->GetReal("Renderer", "bg_red", 1.0);
Settings::values.bg_green = (float)glfw_config->GetReal("Renderer", "bg_green", 1.0);
Settings::values.bg_blue = (float)glfw_config->GetReal("Renderer", "bg_blue", 1.0);
// Data Storage // Data Storage
Settings::values.use_virtual_sd = glfw_config->GetBoolean("Data Storage", "use_virtual_sd", true); Settings::values.use_virtual_sd = glfw_config->GetBoolean("Data Storage", "use_virtual_sd", true);

View File

@ -41,6 +41,13 @@ gpu_refresh_rate =
# 0 (default): No frameskip, 1: x2 frameskip, 2: x4 frameskip, 3: x8 frameskip, etc. # 0 (default): No frameskip, 1: x2 frameskip, 2: x4 frameskip, 3: x8 frameskip, etc.
frame_skip = frame_skip =
[Renderer]
# The clear color for the renderer. What shows up on the sides of the bottom screen.
# Must be in range of 0.0-1.0. Defaults to 1.0 for all.
bg_red =
bg_blue =
bg_green =
[Data Storage] [Data Storage]
# Whether to create a virtual SD card. # Whether to create a virtual SD card.
# 1 (default): Yes, 0: No # 1 (default): Yes, 0: No

View File

@ -53,6 +53,12 @@ void Config::ReadValues() {
Settings::values.frame_skip = qt_config->value("frame_skip", 0).toInt(); Settings::values.frame_skip = qt_config->value("frame_skip", 0).toInt();
qt_config->endGroup(); qt_config->endGroup();
qt_config->beginGroup("Renderer");
Settings::values.bg_red = qt_config->value("bg_red", 1.0).toFloat();
Settings::values.bg_green = qt_config->value("bg_green", 1.0).toFloat();
Settings::values.bg_blue = qt_config->value("bg_blue", 1.0).toFloat();
qt_config->endGroup();
qt_config->beginGroup("Data Storage"); qt_config->beginGroup("Data Storage");
Settings::values.use_virtual_sd = qt_config->value("use_virtual_sd", true).toBool(); Settings::values.use_virtual_sd = qt_config->value("use_virtual_sd", true).toBool();
qt_config->endGroup(); qt_config->endGroup();
@ -98,6 +104,13 @@ void Config::SaveValues() {
qt_config->setValue("frame_skip", Settings::values.frame_skip); qt_config->setValue("frame_skip", Settings::values.frame_skip);
qt_config->endGroup(); qt_config->endGroup();
qt_config->beginGroup("Renderer");
// Cast to double because Qt's written float values are not human-readable
qt_config->setValue("bg_red", (double)Settings::values.bg_red);
qt_config->setValue("bg_green", (double)Settings::values.bg_green);
qt_config->setValue("bg_blue", (double)Settings::values.bg_blue);
qt_config->endGroup();
qt_config->beginGroup("Data Storage"); qt_config->beginGroup("Data Storage");
qt_config->setValue("use_virtual_sd", Settings::values.use_virtual_sd); qt_config->setValue("use_virtual_sd", Settings::values.use_virtual_sd);
qt_config->endGroup(); qt_config->endGroup();

View File

@ -44,6 +44,11 @@ struct Values {
// System Region // System Region
int region_value; int region_value;
// Renderer
float bg_red;
float bg_green;
float bg_blue;
std::string log_filter; std::string log_filter;
} extern values; } extern values;

View File

@ -6,6 +6,7 @@
#include "core/hw/hw.h" #include "core/hw/hw.h"
#include "core/hw/lcd.h" #include "core/hw/lcd.h"
#include "core/mem_map.h" #include "core/mem_map.h"
#include "core/settings.h"
#include "common/emu_window.h" #include "common/emu_window.h"
#include "common/profiler_reporting.h" #include "common/profiler_reporting.h"
@ -172,7 +173,7 @@ 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(1.0f, 1.0f, 1.0f, 0.0f); glClearColor(Settings::values.bg_red, Settings::values.bg_green, Settings::values.bg_blue, 0.0f);
glDisable(GL_DEPTH_TEST); glDisable(GL_DEPTH_TEST);
// Link shaders and get variable locations // Link shaders and get variable locations