/** * Copyright (c) 2025 Dominic Masters * * This software is released under the MIT License. * https://opensource.org/licenses/MIT */ #include "rpg.h" #include "rpg/world/map.h" #include "util/memory.h" #include "asset/assetmanager.h" rpg_t RPG; asset_t *asset; ref_t assetRef; void rpgInit() { memoryZero(&RPG, sizeof(RPG)); errorret_t ret = assetManagerLoadAsset("map/untitled.drm", &asset, &assetRef); if(ret.code != ERROR_OK) { errorPrint(ret); errorCatch(ret); return; } RPG.map = &asset->rpgMap.map; // mapInit(&testMap); // testMap.width = 2; // testMap.height = 2; // for(uint32_t i = 0; i < testMap.width * testMap.height; i++) { // testMap.base.tiles[i].id = 1; // } // entity_t *ent = mapEntityAdd(&testMap); // entityInit(ent, ENTITY_TYPE_PLAYER, &testMap); // entity_t *npc = mapEntityAdd(&testMap); // entityInit(npc, ENTITY_TYPE_NPC, &testMap); // npc->position[0] = 32.0f; // npc->position[1] = 32.0f; } void rpgUpdate() { if(RPG.map != NULL) { mapUpdate(RPG.map); } }