From 957c64c7b8b5e98d8a03dd84c7e27e7991fb9dbc Mon Sep 17 00:00:00 2001 From: iamcheeseman Date: Mon, 6 Apr 2026 17:04:05 -0400 Subject: Initial commit --- micro/context.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 micro/context.h (limited to 'micro/context.h') diff --git a/micro/context.h b/micro/context.h new file mode 100644 index 0000000..248c475 --- /dev/null +++ b/micro/context.h @@ -0,0 +1,36 @@ +#ifndef __MICRO_CONTEXT_H__ +#define __MICRO_CONTEXT_H__ + +#include + +#include "common.h" +#include "renderer.h" + +struct ctx_hints { + int win_width; + int win_height; + const char *win_title; + int ticrate; +}; + +struct ctx { + struct ctx_hints creation_hints; + GLFWwindow *win; + double ticrate; + double prev_tic_ts; + + struct renderer renderer; +}; + +void init_ctx(struct ctx *ctx, struct ctx_hints creation_hints); +void deinit_ctx(struct ctx *ctx); + +// Whether or not the main loop should continue executing. +bool is_game_running(struct ctx *ctx); +// Handle events, tick game logic, etc. Returns the amount of times you should +// tic. +int game_tick(struct ctx *ctx); +// Draw stuff at an interpolated state. +void game_draw(struct ctx *ctx); + +#endif // __MICRO_CONTEXT_H__ -- cgit v1.3-2-g0d8e