create SDL window
Some checks failed
Build and Test verification / build (push) Failing after 26s
Build and Test verification / test (push) Has been skipped

This commit is contained in:
2026-05-09 15:36:53 -05:00
parent c3afcadc0f
commit f72bd8c44f
7 changed files with 151 additions and 28 deletions

45
src/Window.cpp Normal file
View File

@@ -0,0 +1,45 @@
#include "Window.hpp"
#include <SDL3/SDL_events.h>
Window::Window() {
(void)init();
}
Window::~Window() {
SDL_DestroyWindow(sdlWindow_);
SDL_Quit();
}
int Window::init() {
// TODO: config service for controlling window parameters
sdlWindow_ = SDL_CreateWindow("Ouros: Vulkan", 1280u, 720u, SDL_WINDOW_VULKAN | SDL_WINDOW_RESIZABLE);
if(sdlWindow_ != nullptr) {
rendering_ = true;
open_ = true;
return 0;
} else {
return -1;
}
}
void Window::handleEvent(SDL_Event& event) {
if(event.type == SDL_EVENT_QUIT ) {
open_ = false;
}
if(event.type == SDL_EVENT_WINDOW_MINIMIZED) {
rendering_ = false;
} else if(event.type == SDL_EVENT_WINDOW_RESTORED) {
rendering_ = true;
}
}