diff --git a/LICENSE b/LICENSE index aa87417..09b33d9 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2025 macmacmac +Copyright (c) 2025 Alexander Raptis Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/src/main.cc b/src/main.cc index 4445c0e..c7285de 100644 --- a/src/main.cc +++ b/src/main.cc @@ -13,6 +13,12 @@ constexpr uint32_t winInitHeight = 1024; struct AppContext { VulkanApp vkapp; SDL_AppResult appQuit = SDL_APP_CONTINUE; + AppContext(const uint32_t& _w, const uint32_t& _h) : vkapp(_w, _h) { + this->vkapp.init(); + } + ~AppContext() { + this->vkapp.cleanup(); + } }; SDL_AppResult SDL_Fail() { @@ -28,9 +34,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char **argv) { return SDL_Fail(); try { - *appstate = new AppContext { .vkapp = VulkanApp(winInitWidth, winInitHeight)}; - AppContext* app = static_cast(*appstate); - app->vkapp.init(); + *appstate = new AppContext(winInitWidth, winInitHeight); } catch(const std::exception& except) { fprintf(stderr, "Error! %s\n", except.what()); @@ -84,11 +88,8 @@ void SDL_AppQuit(void *appstate, SDL_AppResult result) { else puts("Program shutting down, no errors."); - if(app) { - app->vkapp.cleanup(); - + if(app) delete app; - } SDL_Quit(); }