mirror of
https://github.com/pound-emu/pound.git
synced 2025-12-12 01:36:57 +00:00
Configurable Window Size
This commit is contained in:
parent
b6e91d47ff
commit
ac2da6ed49
3 changed files with 24 additions and 2 deletions
|
|
@ -7,10 +7,22 @@
|
||||||
|
|
||||||
namespace Config {
|
namespace Config {
|
||||||
|
|
||||||
|
static int widthWindow = 640;
|
||||||
|
|
||||||
|
static int heightWindow = 480;
|
||||||
|
|
||||||
static bool logAdvanced = false;
|
static bool logAdvanced = false;
|
||||||
|
|
||||||
static std::string typeLog = "async";
|
static std::string typeLog = "async";
|
||||||
|
|
||||||
|
int windowWidth() {
|
||||||
|
return widthWindow;
|
||||||
|
}
|
||||||
|
|
||||||
|
int windowHeight() {
|
||||||
|
return heightWindow;
|
||||||
|
}
|
||||||
|
|
||||||
bool isLogAdvanced() {
|
bool isLogAdvanced() {
|
||||||
return logAdvanced;
|
return logAdvanced;
|
||||||
}
|
}
|
||||||
|
|
@ -38,6 +50,9 @@ void Load(const std::filesystem::path& path) {
|
||||||
if (data.contains("General")) {
|
if (data.contains("General")) {
|
||||||
const toml::value& general = data.at("General");
|
const toml::value& general = data.at("General");
|
||||||
|
|
||||||
|
widthWindow = toml::find_or<int>(general, "Window Width", 640);
|
||||||
|
heightWindow = toml::find_or<int>(general, "Window Height", 480);
|
||||||
|
|
||||||
logAdvanced = toml::find_or<bool>(general, "Advanced Log", false);
|
logAdvanced = toml::find_or<bool>(general, "Advanced Log", false);
|
||||||
typeLog = toml::find_or<std::string>(general, "Log Type", "async");
|
typeLog = toml::find_or<std::string>(general, "Log Type", "async");
|
||||||
}
|
}
|
||||||
|
|
@ -61,6 +76,8 @@ void Save(const std::filesystem::path& path) {
|
||||||
fmt::print("Saving new configuration file {}\n", path.string());
|
fmt::print("Saving new configuration file {}\n", path.string());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data["General"]["Window Width"] = widthWindow;
|
||||||
|
data["General"]["Window Height"] = heightWindow;
|
||||||
data["General"]["Advanced Log"] = logAdvanced;
|
data["General"]["Advanced Log"] = logAdvanced;
|
||||||
data["General"]["Log Type"] = typeLog;
|
data["General"]["Log Type"] = typeLog;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,10 @@ namespace Config {
|
||||||
void Load(const std::filesystem::path& path);
|
void Load(const std::filesystem::path& path);
|
||||||
void Save(const std::filesystem::path& path);
|
void Save(const std::filesystem::path& path);
|
||||||
|
|
||||||
|
int windowWidth();
|
||||||
|
|
||||||
|
int windowHeight();
|
||||||
|
|
||||||
bool isLogAdvanced();
|
bool isLogAdvanced();
|
||||||
|
|
||||||
std::string logType();
|
std::string logType();
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
#include <SDL3/SDL.h>
|
#include <SDL3/SDL.h>
|
||||||
|
|
||||||
#include "ARM/cpu.h"
|
#include "ARM/cpu.h"
|
||||||
|
#include "Base/Config.h"
|
||||||
#include "JIT/jit.h"
|
#include "JIT/jit.h"
|
||||||
|
|
||||||
SDL_Window *Window{};
|
SDL_Window *Window{};
|
||||||
|
|
@ -22,8 +23,8 @@ void initSDL3() {
|
||||||
SDL_SetStringProperty(props, SDL_PROP_WINDOW_CREATE_TITLE_STRING, "Pound Emulator");
|
SDL_SetStringProperty(props, SDL_PROP_WINDOW_CREATE_TITLE_STRING, "Pound Emulator");
|
||||||
SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_X_NUMBER, SDL_WINDOWPOS_CENTERED);
|
SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_X_NUMBER, SDL_WINDOWPOS_CENTERED);
|
||||||
SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_Y_NUMBER, SDL_WINDOWPOS_CENTERED);
|
SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_Y_NUMBER, SDL_WINDOWPOS_CENTERED);
|
||||||
SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_WIDTH_NUMBER, /*Config::windowWidth()*/ 800);
|
SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_WIDTH_NUMBER, Config::windowWidth());
|
||||||
SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_HEIGHT_NUMBER, /*Config::windowHeight()*/ 600);
|
SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_HEIGHT_NUMBER, Config::windowHeight());
|
||||||
// For a new Vulkan support, don't forget to change 'SDL_WINDOW_OPENGL' by 'SDL_WINDOW_VULKAN'.
|
// For a new Vulkan support, don't forget to change 'SDL_WINDOW_OPENGL' by 'SDL_WINDOW_VULKAN'.
|
||||||
SDL_SetNumberProperty(props, "flags", SDL_WINDOW_OPENGL);
|
SDL_SetNumberProperty(props, "flags", SDL_WINDOW_OPENGL);
|
||||||
SDL_SetBooleanProperty(props, SDL_PROP_WINDOW_CREATE_RESIZABLE_BOOLEAN, true);
|
SDL_SetBooleanProperty(props, SDL_PROP_WINDOW_CREATE_RESIZABLE_BOOLEAN, true);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue