improve logging from scripts

This commit is contained in:
asrael 2025-12-03 09:41:33 -06:00
parent 3313c800a9
commit 4587ba7266
7 changed files with 99 additions and 60 deletions

View file

@ -263,12 +263,15 @@ pxl8_result pxl8_update(pxl8* sys) {
pxl8_result result = pxl8_script_eval_repl(game->script, pxl8_repl_command_buffer(cmd));
if (result != PXL8_OK) {
if (pxl8_script_is_incomplete_input(game->script)) {
pxl8_repl_signal_complete(sys->repl);
} else {
pxl8_error("%s", pxl8_script_get_last_error(game->script));
pxl8_repl_clear_accumulator(sys->repl);
pxl8_repl_signal_complete(sys->repl);
}
} else {
pxl8_repl_clear_accumulator(sys->repl);
pxl8_repl_signal_complete(sys->repl);
}
}
}
@ -339,10 +342,6 @@ void pxl8_quit(pxl8* sys) {
pxl8_gfx_destroy(game->gfx);
pxl8_script_destroy(game->script);
if (sys->repl) {
pxl8_repl_destroy(sys->repl);
}
}
bool pxl8_is_running(const pxl8* sys) {
@ -352,6 +351,10 @@ bool pxl8_is_running(const pxl8* sys) {
void pxl8_set_running(pxl8* sys, bool running) {
if (sys && sys->game) {
sys->game->running = running;
if (!running && sys->repl) {
pxl8_repl_destroy(sys->repl);
sys->repl = NULL;
}
}
}