diff options
author | nathansmithsmith <thenathansmithsmith@gmail.com> | 2023-07-07 23:10:23 -0600 |
---|---|---|
committer | nathansmithsmith <thenathansmithsmith@gmail.com> | 2023-07-07 23:10:23 -0600 |
commit | e5268813dcbdc0d90a081b2223ebc21749038635 (patch) | |
tree | 7c917996749e4123fb1fe49ddd1ed3b8f7e92334 /src/game.c | |
parent | a90e1987de75cfecc2693952625af8cce507ae95 (diff) |
Better world
Diffstat (limited to 'src/game.c')
-rw-r--r-- | src/game.c | 68 |
1 files changed, 63 insertions, 5 deletions
@@ -4,23 +4,81 @@ void initGame(Game * game) { // Window. InitWindow(WINDOW_WIDTH, WINDOW_HEIGHT, "Killa Facsista"); + // Assets. + LoadAssets(&game->assets); + // Screen id. game->screenId = SCREEN_GAME; + // Main menu. + initMainMenu(game); + // Camera. initPlayerCamera(&game->playerCamera); - // Ship test. - game->ship = createEntity(ENTITY_ANTIFA); - SetTargetFPS(60); //DisableCursor(); + + // World. + initWorld(&game->world); + + // Debug. + // Add player. + addEntityToWorld( + &game->world, + createEntity(ENTITY_ANTIFA, game) + ); + + // Test entity. + Entity soldato = createEntity(ENTITY_SOLDATO, game); + soldato.position = (Vector3){10.0, 10.0, 10.0}; + addEntityToWorld(&game->world, soldato); + + soldato = createEntity(ENTITY_SOLDATO, game); + soldato.position = (Vector3){20.0, 20.0, 20.0}; + addEntityToWorld(&game->world, soldato); + + soldato = createEntity(ENTITY_SOLDATO, game); + soldato.position = (Vector3){30.0, 30.0, 30.0}; + addEntityToWorld(&game->world, soldato); + + printf("%d\n", removeEntityFromWorld(&game->world, 2)); + printf("%d\n", removeEntityFromWorld(&game->world, 3)); + + soldato = createEntity(ENTITY_SOLDATO, game); + soldato.position = (Vector3){-30.0, -30.0, -30.0}; + addEntityToWorld(&game->world, soldato); + + + puts("v"); + + for (int i = 0; i < game->world.vacantIdsCount; ++i) + printf("%d\n", game->world.vacantIds[i]); + + puts("l"); + + for (int i = 0; i < game->world.lookUpSize; ++i) { + printf("%d\n", game->world.lookUp[i]); + + Entity * e = getEntityFromWorld(game->world, i); + + if (e == NULL) { + puts("null"); + continue; + } + + if (e->id == i) + printf("good %x\n", e->fingerprint); + else + printf("bad %d\n", e->id); + } } void closeGame(Game * game) { - // Close ship test. - closeEntity(&game->ship); + unloadAssets(&game->assets); + freeWorld(&game->world); + // Close window last. CloseWindow(); } |