remove ctx.update_multiplicity

This commit is contained in:
veclavtalica 2025-01-15 00:52:42 +03:00
parent 688d71953a
commit 851ab80292
2 changed files with 22 additions and 32 deletions

View File

@ -72,11 +72,6 @@ typedef struct EngineContext {
SDL_Window *window;
uint32_t window_id;
/* this should be a multiple of the current ticks per second */
/* use it to simulate low framerate (e.g. at 60 tps, set to 2 for 30 fps) */
/* it can be changed at runtime; any resulting logic anomalies are bugs */
uint32_t update_multiplicity;
bool is_running;
bool window_size_has_changed;
bool resync_flag;

View File

@ -204,9 +204,8 @@ static void main_loop(void) {
/* finally, let's get to work */
int frames = 0;
while (ctx.frame_accumulator >= ctx.desired_frametime * ctx.update_multiplicity) {
while (ctx.frame_accumulator >= ctx.desired_frametime) {
frames += 1;
for (size_t i = 0; i < ctx.update_multiplicity; ++i) {
/* TODO: disable rendering pushes on not-last ? */
render_queue_clear();
poll_events();
@ -232,7 +231,6 @@ static void main_loop(void) {
ctx.game.frame_number = 0;
ctx.game.initialization_needed = false;
}
}
/* TODO: in some cases machine might want to assume frames will be fed as much as possible */
/* which for now is broken as glBufferData with NULL is used all over right after render */
@ -555,9 +553,6 @@ static bool initialize(void) {
}
/* you could change this at runtime if you wanted */
ctx.update_multiplicity = 1;
/* random seeding */
/* SDL_GetPerformanceCounter returns some platform-dependent number. */
/* it should vary between game instances. i checked! random enough for me. */