Files
maiden/src/Window.cpp
homeburger 6407cb7fdb
Some checks failed
Build and Test verification / build (push) Failing after 25s
Build and Test verification / test (push) Has been skipped
consolidate some cmake
2026-05-10 17:20:21 -05:00

46 lines
785 B
C++

#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("Maiden", 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;
}
}