/** * Copyright (c) 2025 Dominic Masters * * This software is released under the MIT License. * https://opensource.org/licenses/MIT */ #include "engine.h" #include "util/memory.h" #include "time/time.h" #include "console/console.h" #include "display/display.h" #include "ecs/ecssystem.h" #include "scene/node.h" #include "asset/asset.h" #include "scene/test/scenetest.h" engine_t ENGINE; void assetLoadCallback(void *data) { consolePrint("Asset load callback called!"); test = ASSET.loaded.palette; consolePrint("Loaded palette with %d colors", ASSET.data.palette.colorCount); } errorret_t engineInit(void) { memoryZero(&ENGINE, sizeof(engine_t)); ENGINE.running = true; // Init systems. Order is important. timeInit(); consoleInit(); ecsSystemInit(); errorChain(assetInit()); errorChain(displayInit()); assetLoad("first.palette.dpf", assetLoadCallback, NULL); if(ASSET.state == ASSET_STATE_ERROR) errorChain(ASSET.error); sceneTestAdd(); errorOk(); } errorret_t engineUpdate(void) { timeUpdate(); consoleUpdate(); errorChain(displayUpdate()); errorOk(); } errorret_t engineDispose(void) { ecsSystemDispose(); errorChain(displayDispose()); assetDispose(); consoleDispose(); errorOk(); }