retro-rpg/engine/include/engine_hooks.h
Camden Dixie O'Brien 65a4b08f34 Use vsync instead of delay-based synchronization
Also changed the game_update() interface to take dt in seconds as a
double (rather than milliseconds as an unsigned integer) as we're now
computing the refresh interval as a double anyway (by querying the
display mode).  To my eye (and on my machine), all chunkiness is now
gone; the game feels very smooth.
2025-01-02 16:54:01 +00:00

35 lines
671 B
C

/*
* Copyright (c) Camden Dixie O'Brien
* SPDX-License-Identifier: AGPL-3.0-only
*/
#ifndef ENGINE_HOOKS_H
#define ENGINE_HOOKS_H
#include <SDL2/SDL.h>
typedef struct {
struct {
const char *title;
unsigned w, h;
} win;
size_t memsize;
} engineconf_t;
typedef enum {
GAMESTATUS_OK,
GAMESTATUS_QUIT,
} gamestatus_t;
extern const engineconf_t game_conf;
void game_init(int argc, char *argv[], void *mem, SDL_Renderer *renderer);
void game_teardown(void *mem);
gamestatus_t game_evthandle(void *mem, const SDL_Event *evt);
gamestatus_t game_update(void *mem, double dt);
void game_render(const void *mem, SDL_Renderer *renderer, long unsigned t);
#endif