Open glenpierce opened 5 months ago
Update: I got courageous and tried it. My solution is... not good. It causes the app to crash when I try to exit/close the window.
If anyone has the time to explain why this loop is doing this, I would be quite thankful. This is a bit confusing to me.
g_ApplicationRunning
is set to false when exiting the window.
An educated guess would be that this loop is here to facilitate easy application restarts, when e.g. changing to fullscreen or whatnot.
It's because the while loop is "paused" while the run() function is being called. When the run() function is completed, then the app is deleted.
In EntryPoint.h,
https://github.com/StudioCherno/Walnut/blob/3b8e414fdecfc6c8b58816106fe8d912bd172e31/Walnut/src/Walnut/EntryPoint.h#L10-L20
This code appears to have a logical error, as it creates and deletes a new
Walnut::Application
object in each iteration of the while loop. This means that the application is constantly being restarted and terminated, which is probably not the intended behavior. A more reasonable approach would be to create the application object once before the loop, and delete it once after the loop, like this:Please correct me if I'm mistaken here, Or maybe there's a good reason for it, I'm very new to this project.