tomato/src/screen.hpp

23 lines
615 B
C++
Raw Normal View History

2023-07-26 12:24:18 +02:00
#pragma once
2023-07-30 15:10:26 +02:00
#include <SDL3/SDL.h>
2024-01-05 14:47:08 +01:00
// all time values are in seconds
2023-07-26 12:24:18 +02:00
struct Screen {
virtual ~Screen(void) = default;
2023-07-30 15:10:26 +02:00
// return true if handled
2024-01-05 14:47:08 +01:00
virtual bool handleEvent(SDL_Event&) { return false; }
2023-07-30 15:10:26 +02:00
2023-07-26 12:24:18 +02:00
// return nullptr if not next
// sets bool quit to true if exit
2024-01-05 14:47:08 +01:00
// 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; }
2023-07-26 12:24:18 +02:00
};