start infrastructure for SDL window

This commit is contained in:
SimoZ64
2025-05-07 16:11:46 +02:00
parent 4d10495c88
commit c175d58f03
4 changed files with 23 additions and 2 deletions

View File

@@ -129,6 +129,7 @@ add_executable(kaizen
JSONUtils.hpp JSONUtils.hpp
AudioSettings.hpp AudioSettings.hpp
AudioSettings.cpp AudioSettings.cpp
NativeWindow.hpp
InputSettings.hpp InputSettings.hpp
InputSettings.cpp InputSettings.cpp
Debugger.hpp Debugger.hpp

View File

@@ -3,7 +3,7 @@
#include <backend/Core.hpp> #include <backend/Core.hpp>
#include <ImGuiImpl/StatusBar.hpp> #include <ImGuiImpl/StatusBar.hpp>
KaizenGui::KaizenGui() noexcept : window(SDL_CreateWindow("Kaizen", 1280, 720, SDL_WINDOW_HIGH_PIXEL_DENSITY | SDL_WINDOW_RESIZABLE | SDL_WINDOW_VULKAN)), core(std::make_shared<n64::Core>()), vulkanWidget(core, window), emuThread(core, fpsCounter, vulkanWidget, settingsWindow) { KaizenGui::KaizenGui() noexcept : window("Kaizen", 1280, 720), core(std::make_shared<n64::Core>()), vulkanWidget(core, window.getHandle()), emuThread(core, fpsCounter, vulkanWidget, settingsWindow) {
emuExitFunc = [&]() { emuExitFunc = [&]() {
quit = true; quit = true;
if (emuThread.isRunning) { if (emuThread.isRunning) {

View File

@@ -2,11 +2,13 @@
#include <RenderWidget.hpp> #include <RenderWidget.hpp>
#include <Debugger.hpp> #include <Debugger.hpp>
#include <ImGuiImpl/Menu.hpp> #include <ImGuiImpl/Menu.hpp>
#include <ImGuiImpl/StatusBar.hpp>
#include <NativeWindow.hpp>
#include <EmuThread.hpp> #include <EmuThread.hpp>
#include <Discord.hpp> #include <Discord.hpp>
class KaizenGui final { class KaizenGui final {
std::shared_ptr<SDL_Window> window; gui::NativeWindow window;
public: public:
explicit KaizenGui() noexcept; explicit KaizenGui() noexcept;
double fpsCounter; double fpsCounter;

View File

@@ -0,0 +1,18 @@
#pragma once
#include <SDL3/SDL_video.h>
#include <SDL3/SDL_init.h>
#include <string>
namespace gui {
struct NativeWindow {
NativeWindow(const std::string& title, int w, int h, int posX = SDL_WINDOWPOS_CENTERED, int posY = SDL_WINDOWPOS_CENTERED) {
SDL_Init(SDL_INIT_VIDEO);
window = std::make_shared<SDL_Window>(SDL_CreateWindow(title.c_str(), w, h, SDL_WINDOW_VULKAN | SDL_WINDOW_RESIZABLE | SDL_WINDOW_HIGH_PIXEL_DENSITY));
}
void setTitle(const std::string& v) { title = v; }
const std::shared_ptr<SDL_Window>& getHandle() { return window; }
private:
std::shared_ptr<SDL_Window> window;
std::string title;
};
}