rework to context: now there's engine and user code copies, renaming of fields, most things that shouldn't be there are hidden

This commit is contained in:
2024-10-12 20:24:47 +03:00
parent 7886650339
commit e70366f82f
14 changed files with 106 additions and 97 deletions

View File

@ -57,7 +57,7 @@ static void load_game_object(void) {
handle = new_handle;
if (ctx.game.tick_count != 0)
if (ctx.game.frame_number != 0)
log_info("Game object was reloaded\n");
return;
@ -84,7 +84,7 @@ static void watcher_callback(XWATCHER_FILE_EVENT event,
switch(event) {
case XWATCHER_FILE_MODIFIED:
SDL_LockMutex(lock);
last_tick_modified = ctx.game.tick_count;
last_tick_modified = ctx.game.frame_number;
loaded_after_modification = false;
SDL_UnlockMutex(lock);
break;
@ -129,7 +129,7 @@ bool game_object_try_reloading(void) {
/* only load the modified library after some time, as compilers make a lot of modifications */
SDL_LockMutex(lock);
if (ctx.game.tick_count - last_tick_modified > MODIFIED_TICKS_MERGED &&
if (ctx.game.frame_number - last_tick_modified > MODIFIED_TICKS_MERGED &&
!loaded_after_modification) {
load_game_object();
loaded_after_modification = true;

View File

@ -48,7 +48,7 @@ static void load_game_object(void) {
handle = new_handle;
if (ctx.game.tick_count != 0)
if (ctx.game.frame_number != 0)
log_info("Game object was reloaded\n");
return;