tot mes ben estructuraet i ara amb gestió d'events, context i subsystems. arreglos en el main loop
This commit is contained in:
1 parent
1837844b03
commit
4e0b819b96
12 files changed
+94
-49
No files matched your search
@@ -0,0 +1,27 @@
|
||||
// eventmanager.hpp
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
class EventManager {
|
||||
public:
|
||||
void update() {
|
||||
SDL_Event event;
|
||||
|
||||
while (SDL_PollEvent(&event)) {
|
||||
if (event.type == SDL_EVENT_QUIT ||
|
||||
event.type == SDL_EVENT_WINDOW_CLOSE_REQUESTED) {
|
||||
if (!quit) {
|
||||
quit = true;
|
||||
SDL_LogInfo(
|
||||
SDL_LOG_CATEGORY_APPLICATION,
|
||||
"Someone wants to quit!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
auto wantToQuit() -> bool { return quit; }
|
||||
|
||||
private:
|
||||
bool quit{false};
|
||||
};
|
||||
Reference in new issue
Block a user