Properly terminate when the window is closed by the user

This commit is contained in:
Edgaru089 2024-04-23 15:42:03 +08:00
parent 60887e54df
commit 294314112d

View File

@ -32,6 +32,11 @@ int main() {
App *app = app_NewApp(); App *app = app_NewApp();
app->window = win; app->window = win;
while (!app->wantQuit) { while (!app->wantQuit) {
// Check if the window is still open
// On Windows/MinGW, the loop stucks open when the window is closed
if (!IsWindow(win))
break;
if (time_Since(frameCounter).microseconds >= 1000000) { // 1 sec if (time_Since(frameCounter).microseconds >= 1000000) { // 1 sec
/* Duration d = */ time_Reset(&frameCounter); /* Duration d = */ time_Reset(&frameCounter);
char buf[128]; char buf[128];