Made adjustments so program can compile on windows

This commit is contained in:
macmacmac 2025-07-03 20:17:11 -04:00
parent 0ed40a0b64
commit 65cd03961d
2 changed files with 9 additions and 8 deletions

View File

@ -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:

View File

@ -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<AppContext*>(*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();
}