#include "game.h" void initGame(Game * game) { // Window. InitWindow(WINDOW_WIDTH, WINDOW_HEIGHT, "Killa Facsista"); // Settings. initSettings(&game->settings); // Assets. LoadAssets(&game->assets); // Screen id. game->screenId = SCREEN_GAME; // Main menu. initMainMenu(game); // Camera. initPlayerCamera(&game->playerCamera); 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) { unloadAssets(&game->assets); freeWorld(&game->world); // Close window last. CloseWindow(); } void updateGame(Game * game) { BeginDrawing(); switch (game->screenId) { case SCREEN_MAIN_MENU: updateMainMenu(game); break; case SCREEN_GAME: updateGameScreen(game); break; default: break; } DrawFPS(5, 5); EndDrawing(); }