hot reloading and friends
This commit is contained in:
1 parent
08fd5970a1
commit
d4d4544bb4
27 files changed
+1221
-106
No files matched your search
@@ -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