fix: window teardown

This commit is contained in:
2026-04-11 10:28:14 -05:00
parent f03f521141
commit 2c9463c336
3 changed files with 15 additions and 5 deletions

View File

@@ -29,13 +29,16 @@ int App::run() {
// poll events here
// other threads might be able to change quit to true to auto close
while( SDL_PollEvent( &e ) != 0 ) {
if( e.type == SDL_QUIT ) {
// Ctrl + C in console !
SDL_Event event;
while(SDL_PollEvent(&event)) { // TODO: pass event handling to window
if(event.type == SDL_EVENT_QUIT ) {
quit = true;
}
}
}
// SDL teardown handled in window destructor
return 0;
}

View File

@@ -7,10 +7,17 @@ Window::Window() {
}
Window::~Window() {
SDL_DestroyWindow(window_);
SDL_Quit();
}
int Window::init() {
window_ = SDL_CreateWindow("How to Vulkan", 1280u, 720u, SDL_WINDOW_VULKAN | SDL_WINDOW_RESIZABLE);
return 0;
return (window_ == nullptr);
}

View File

@@ -11,7 +11,7 @@ class Window {
public:
Window();
~Window() = default;
~Window();
private: