hot reloading and friends
This commit is contained in:
@ -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 */
|
||||
|
Reference in New Issue
Block a user