From b196c97cf09ed50cf853f9e0b8f574b11c6245f4 Mon Sep 17 00:00:00 2001 From: Bliblank Date: Sat, 11 Apr 2026 23:57:57 -0500 Subject: [PATCH] checkpoint --- CMakeLists.txt | 1 + README.md | 1 + src/app/App.cpp | 6 ++++++ src/app/App.hpp | 2 ++ src/app/Window.cpp | 6 +++--- src/app/Window.hpp | 2 +- src/utils/utils.hpp | 1 + 7 files changed, 15 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4ae0d5c..f96ff36 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,6 +23,7 @@ add_executable(ouros src/main.cpp src/app/App.cpp src/app/Window.cpp + src/engine/Engine.cpp ) target_include_directories(ouros PRIVATE diff --git a/README.md b/README.md index adc0aec..c29ee07 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,7 @@ Below is beyond Sascha's guide, but available elsewhere on his github. These are - CMake (im using 4.0.0) - C++20 compatible compiler (I use g++12 or MSVC++17) (probably works with mingw but I haven't tested it myself) - Vulkan compatible gpu drivers (tested with an RTX3070 and an R9700) + - Vulkan SDK (https://vulkan.lunarg.com/sdk/home) <- the installer provides the option to install SDL and VOC as well as verifies GPU drivers - SDL3 (im using version 3.4.4) - Will add more as the project grows diff --git a/src/app/App.cpp b/src/app/App.cpp index 175e46b..2021857 100644 --- a/src/app/App.cpp +++ b/src/app/App.cpp @@ -16,6 +16,7 @@ void App::init() { utils::debugPrint(__FUNCTION__, __LINE__, "Init app.", utils::DebugLevel::Trace); window_ = new Window(); + engine_ = new Engine(window_); } @@ -34,6 +35,11 @@ int App::run() { quit = true; } } + + // pass vulkan handling to engine + // call engine.render() or something + // engine has a pointer to window so can handle pushing to the screen + } // SDL teardown handled in window destructor diff --git a/src/app/App.hpp b/src/app/App.hpp index e636213..0b4f39d 100644 --- a/src/app/App.hpp +++ b/src/app/App.hpp @@ -2,6 +2,7 @@ #pragma once #include "Window.hpp" +#include "engine/Engine.hpp" class App { @@ -19,5 +20,6 @@ private: void init(); Window* window_; + Engine* engine_; }; \ No newline at end of file diff --git a/src/app/Window.cpp b/src/app/Window.cpp index 86e8269..7a0fdcc 100644 --- a/src/app/Window.cpp +++ b/src/app/Window.cpp @@ -9,15 +9,15 @@ Window::Window() { Window::~Window() { - SDL_DestroyWindow(window_); + SDL_DestroyWindow(sdlWindow_); SDL_Quit(); } int Window::init() { - window_ = SDL_CreateWindow("How to Vulkan", 1280u, 720u, SDL_WINDOW_VULKAN | SDL_WINDOW_RESIZABLE); + sdlWindow_ = SDL_CreateWindow("How to Vulkan", 1280u, 720u, SDL_WINDOW_VULKAN | SDL_WINDOW_RESIZABLE); - return (window_ == nullptr); + return (sdlWindow_ == nullptr); } diff --git a/src/app/Window.hpp b/src/app/Window.hpp index 97b18de..b2e4e74 100644 --- a/src/app/Window.hpp +++ b/src/app/Window.hpp @@ -17,6 +17,6 @@ private: int init(); - SDL_Window* window_; + SDL_Window* sdlWindow_; }; \ No newline at end of file diff --git a/src/utils/utils.hpp b/src/utils/utils.hpp index 4260b6c..2d8ad4d 100644 --- a/src/utils/utils.hpp +++ b/src/utils/utils.hpp @@ -40,6 +40,7 @@ namespace utils { if(!(debugMask >> debugLevel)) return; // then ignore this debug level std::cout << "[ " << std::left << std::setw(16) << function << ": " << std::right << std::setw(4) << line << ", " << std::left << std::setw(8) << debugTypeStrings[debugLevel] << " ] " << message << std::endl; + // TODO: add timestamps return; }