aboutsummaryrefslogtreecommitdiff
path: root/src/game.c
diff options
context:
space:
mode:
authornathansmithsmith <thenathansmithsmith@gmail.com>2023-07-09 01:26:05 -0600
committernathansmithsmith <thenathansmithsmith@gmail.com>2023-07-09 01:26:05 -0600
commit708072e716e7ab22a37f528311a433f195f75054 (patch)
treeee778b916531b8da3967ad5324019cbfb4e03e1c /src/game.c
parent3f0be672f9c5a07a98be0dc703b95f1bbe73f33e (diff)
World entries added
Diffstat (limited to 'src/game.c')
-rw-r--r--src/game.c45
1 files changed, 20 insertions, 25 deletions
diff --git a/src/game.c b/src/game.c
index 3fd0c78..a89cf0c 100644
--- a/src/game.c
+++ b/src/game.c
@@ -6,6 +6,7 @@ void initGame(Game * game) {
// Settings.
initSettings(&game->settings);
+ applySettings(&game->settings);
// Assets.
LoadAssets(&game->assets);
@@ -19,7 +20,6 @@ void initGame(Game * game) {
// Camera.
initPlayerCamera(&game->playerCamera);
- SetTargetFPS(60);
DisableCursor();
// World.
@@ -27,32 +27,26 @@ void initGame(Game * game) {
// Debug.
// Add player.
- addEntityToWorld(
+ //addEntityToWorld(
+ // &game->world,
+ // createEntity(ENTITY_ANTIFA, game)
+ //);
+
+ WorldEntry entries[] = {
+ (WorldEntry){ENTITY_ANTIFA, Vector3Zero(), QuaternionIdentity()},
+ (WorldEntry){ENTITY_SOLDATO, (Vector3){10.0, 10.0, 10.0}, QuaternionIdentity()},
+ (WorldEntry){ENTITY_SOLDATO, (Vector3){20.0, 20.0, 20.0}, QuaternionIdentity()},
+ (WorldEntry){ENTITY_SOLDATO, (Vector3){30.0, 30.0, 30.0}, QuaternionIdentity()},
+ (WorldEntry){ENTITY_SOLDATO, (Vector3){40.0, 40.0, 40.0}, QuaternionIdentity()}
+ };
+
+ addEntriesToWorld(
&game->world,
- createEntity(ENTITY_ANTIFA, game)
+ game,
+ entries,
+ sizeof(entries) / sizeof(WorldEntry)
);
- // 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)
@@ -99,7 +93,8 @@ void updateGame(Game * game) {
break;
}
- DrawFPS(5, 5);
+ if (game->settings.drawFps)
+ DrawFPS(5, 5);
EndDrawing();
}