hot reloading and friends

This commit is contained in:
2024-08-21 16:55:34 +03:00
parent 08fd5970a1
commit d4d4544bb4
27 changed files with 1221 additions and 106 deletions

View File

@ -4,11 +4,13 @@
#include <malloc.h>
void game_tick(void) {
/* do your initialization on first tick */
if (ctx.tick_count == 0) {
void game_tick(t_ctx *ctx) {
/* do state initialization when engine asks for it */
/* it could happen multiple times per application run, as game code is reloadable */
if (ctx.initialization_needed) {
/* application data could be stored in ctx.udata and retrieved anywhere */
ctx.udata = ccalloc(1, sizeof (struct state));
if (!ctx.udata)
ctx.udata = ccalloc(1, sizeof (struct state));
}
/* a lot of data is accessible from `ctx`, look into `townengine/context.h` for more */