fix: window teardown
This commit is contained in:
@@ -29,13 +29,16 @@ int App::run() {
|
|||||||
// poll events here
|
// poll events here
|
||||||
// other threads might be able to change quit to true to auto close
|
// other threads might be able to change quit to true to auto close
|
||||||
|
|
||||||
while( SDL_PollEvent( &e ) != 0 ) {
|
SDL_Event event;
|
||||||
if( e.type == SDL_QUIT ) {
|
while(SDL_PollEvent(&event)) { // TODO: pass event handling to window
|
||||||
// Ctrl + C in console !
|
if(event.type == SDL_EVENT_QUIT ) {
|
||||||
|
quit = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SDL teardown handled in window destructor
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,10 +7,17 @@ Window::Window() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Window::~Window() {
|
||||||
|
|
||||||
|
SDL_DestroyWindow(window_);
|
||||||
|
SDL_Quit();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
int Window::init() {
|
int Window::init() {
|
||||||
|
|
||||||
window_ = SDL_CreateWindow("How to Vulkan", 1280u, 720u, SDL_WINDOW_VULKAN | SDL_WINDOW_RESIZABLE);
|
window_ = SDL_CreateWindow("How to Vulkan", 1280u, 720u, SDL_WINDOW_VULKAN | SDL_WINDOW_RESIZABLE);
|
||||||
|
|
||||||
return 0;
|
return (window_ == nullptr);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class Window {
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
Window();
|
Window();
|
||||||
~Window() = default;
|
~Window();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user