start screen refactor

This commit is contained in:
2024-01-05 14:47:08 +01:00
parent 9c0ffd38ce
commit 5a0252d8d0
6 changed files with 114 additions and 74 deletions

View File

@ -2,14 +2,21 @@
#include <SDL3/SDL.h>
// all time values are in seconds
struct Screen {
virtual ~Screen(void) = default;
// return true if handled
virtual bool handleEvent(SDL_Event& e) { return false; }
virtual bool handleEvent(SDL_Event&) { return false; }
// return nullptr if not next
// sets bool quit to true if exit
virtual Screen* poll(bool& quit) = 0;
// both render and tick get called in the selfreported intervals
virtual Screen* render(float time_delta, bool& quit) = 0; // pure since this is a graphical app
virtual Screen* tick(float time_delta, bool& quit) = 0;
// TODO: const?
virtual float nextRender(void) { return 1.f/60.f; }
virtual float nextTick(void) { return 0.03f; }
};