ilimination of system code, removal of x-watcher and replacement of it by dmon, fixes in audio code, dynamic asset reload
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
#include "twn_loop.h"
|
||||
#include "twn_loop_c.h"
|
||||
#include "twn_engine_context_c.h"
|
||||
#include "twn_filewatch_c.h"
|
||||
#include "twn_input_c.h"
|
||||
@ -6,7 +6,7 @@
|
||||
#include "twn_util_c.h"
|
||||
#include "twn_game_object_c.h"
|
||||
#include "twn_textures_c.h"
|
||||
#include "system/twn_timer.h"
|
||||
#include "twn_timer_c.h"
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
#include <physfs.h>
|
||||
@ -747,15 +747,20 @@ static void clean_up(void) {
|
||||
}
|
||||
|
||||
|
||||
static void reset_state(void) {
|
||||
void reset_state(void) {
|
||||
ctx.game.initialization_needed = true;
|
||||
input_reset_state(&ctx.input);
|
||||
textures_reset_state();
|
||||
}
|
||||
|
||||
|
||||
static void pack_contents_modified(char const *path, enum FilewatchAction action) {
|
||||
log_info("Pack contents invalidated: %s, action: %i", path, action);
|
||||
reset_state();
|
||||
static uint32_t last_reset_tick;
|
||||
if (last_reset_tick != (uint32_t)ctx.game.frame_number) {
|
||||
log_info("Pack contents invalidated: %s, action: %i", path, action);
|
||||
reset_state();
|
||||
last_reset_tick = (uint32_t)ctx.game.frame_number;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -868,11 +873,7 @@ int enter_loop(int argc, char **argv) {
|
||||
profile_end("startup");
|
||||
|
||||
while (ctx.is_running) {
|
||||
if (game_object_try_reloading()) {
|
||||
ctx.game.initialization_needed = true;
|
||||
reset_state();
|
||||
}
|
||||
|
||||
/* dispatch all filewatch driven events, such as game object and asset pack reload */
|
||||
filewatch_poll();
|
||||
main_loop();
|
||||
}
|
||||
|
Reference in New Issue
Block a user