From dae5f47c8230f75b9154a6e5ee9d91e98d8a602b Mon Sep 17 00:00:00 2001 From: ownedbywuigi Date: Sat, 21 Jun 2025 15:02:45 -0400 Subject: [PATCH 1/2] Start work on a generic settings window --- core/miscgui/settings.cpp | 66 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 core/miscgui/settings.cpp diff --git a/core/miscgui/settings.cpp b/core/miscgui/settings.cpp new file mode 100644 index 0000000..b4b4328 --- /dev/null +++ b/core/miscgui/settings.cpp @@ -0,0 +1,66 @@ +// Copyright 2025 Pound Emulator Project. All rights reserved. +//todo: get the ui working (ownedbywuigi) + +#include + +#include "Base/Logging/Backend.h" + +#include + +#include "Base/Config.h" + +SDL_Window *Window{}; +SDL_Event windowEvent; + +void initSDL3() { + + if (!SDL_Init(SDL_INIT_VIDEO)) { + LOG_ERROR(Render, "Error while creating SDL3 Context!"); + } + + SDL_PropertiesID props = SDL_CreateProperties(); + SDL_SetStringProperty(props, SDL_PROP_WINDOW_CREATE_TITLE_STRING, "Options - Pound"); + 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_WIDTH_NUMBER, Config::windowWidth()); + 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'. + SDL_SetNumberProperty(props, "flags", SDL_WINDOW_OPENGL); + SDL_SetBooleanProperty(props, SDL_PROP_WINDOW_CREATE_RESIZABLE_BOOLEAN, true); + SDL_SetBooleanProperty(props, SDL_PROP_WINDOW_CREATE_OPENGL_BOOLEAN, true); + Window = SDL_CreateWindowWithProperties(props); + SDL_DestroyProperties(props); + + SDL_SetWindowMinimumSize(Window, 720, 480); +} + +int main() { + + Base::Log::Initialize(); + Base::Log::Start(); + + const auto config_dir = Base::FS::GetUserPath(Base::FS::PathType::BinaryDir); + Config::Load(config_dir / "config.toml"); + + initSDL3(); + + bool rendering = true; + + while (rendering) { + std::this_thread::sleep_for(std::chrono::milliseconds(50)); + // Process events. + while (SDL_PollEvent(&windowEvent)) { + switch (windowEvent.type) { + case SDL_EVENT_QUIT: + SDL_DestroyWindow(Window); + SDL_Quit(); + rendering = false; + break; + default: + break; + } + } + } + + return 0; +} From 351b629767e86a4a5ba3cd945215c3a4e468cb2f Mon Sep 17 00:00:00 2001 From: ownedbywuigi Date: Sat, 21 Jun 2025 15:06:37 -0400 Subject: [PATCH 2/2] rename settings to avoid build faliures --- core/miscgui/{settings.cpp => settings.cppwip} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename core/miscgui/{settings.cpp => settings.cppwip} (100%) diff --git a/core/miscgui/settings.cpp b/core/miscgui/settings.cppwip similarity index 100% rename from core/miscgui/settings.cpp rename to core/miscgui/settings.cppwip