Skip to content

Commit

Permalink
add window close
Browse files Browse the repository at this point in the history
  • Loading branch information
UNSTOP4BLE committed Apr 4, 2024
1 parent 80b19c9 commit 247ccb8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/psp/input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,5 +154,16 @@ bool ControllerDevice::getEvent(Event &output) {
return valid;
#endif
}
#ifndef PSP
bool windowClosed(void) {
SDL_Event event;

while (SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_WINDOWEVENT, SDL_WINDOWEVENT) > 0) {
if (event.window.event == SDL_WINDOWEVENT_CLOSE)
return true;
}

return false;
}
#endif
}
3 changes: 3 additions & 0 deletions src/psp/input.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,7 @@ class ControllerDevice : public Device {
bool getEvent(Event &output);
};

#ifndef PSP
bool windowClosed(void);
#endif
}

0 comments on commit 247ccb8

Please sign in to comment.