Small tweaks while I think

This commit is contained in:
2026-05-03 11:23:04 +10:00
parent e646f3ff90
commit f4e41fdd24
4 changed files with 11 additions and 4 deletions
+2 -2
View File
@@ -89,7 +89,7 @@ void unloadPlayerData(PlayerData player) {
int main() {
//example Toy controlling the window stuff
int size = 0;
const char* source = (char*)readFile("assets/config.toy", &size);
const char* source = (char*)readFile("assets/main.toy", &size);
if (!source) {
fprintf(stderr, "File read error: %d\n", size);
@@ -152,7 +152,7 @@ int main() {
//draw the player
DrawTextureRec(player.texture, player.rect, player.position, WHITE);
drawMonsterPool(&vm);
drawMonsters(&vm);
DrawFPS(0,0);
EndDrawing();
+8 -1
View File
@@ -205,8 +205,15 @@ void freeMonsterObjectPool(Toy_VM* vm) {
monsterArray = Toy_resizeArray(monsterArray, 0);
}
void drawMonsterPool(Toy_VM* vm) {
void drawMonsters(Toy_VM* vm) {
(void)vm;
//check for initialization
if (spriteTable == NULL || monsterArray == NULL) {
fprintf(stderr, TOY_CC_ERROR "ERROR: Object pool for monster system hasn't been initialized" TOY_CC_RESET "\n");
return;
}
for (unsigned int i = 0; i < monsterArray->count; i++) {
MonsterData* monster = (MonsterData*)TOY_VALUE_AS_OPAQUE(monsterArray->data[i]);
+1 -1
View File
@@ -6,4 +6,4 @@
void initMonsterObjectPool(Toy_VM* vm);
void freeMonsterObjectPool(Toy_VM* vm);
void drawMonsterPool(Toy_VM* vm);
void drawMonsters(Toy_VM* vm);