summaryrefslogtreecommitdiffhomepage
path: root/examples/models/models_first_person_maze.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/models/models_first_person_maze.c')
-rw-r--r--examples/models/models_first_person_maze.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/examples/models/models_first_person_maze.c b/examples/models/models_first_person_maze.c
index 3f6a935c..6a4345a8 100644
--- a/examples/models/models_first_person_maze.c
+++ b/examples/models/models_first_person_maze.c
@@ -28,7 +28,13 @@ int main(void)
InitWindow(screenWidth, screenHeight, "raylib [models] example - first person maze");
// Define the camera to look into our 3d world
- Camera camera = { { 0.2f, 0.4f, 0.2f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, 45.0f, 0 };
+ Camera camera = { 0 };
+ camera.position = (Vector3){ 0.2f, 0.4f, 0.2f }; // Camera position
+ camera.target = (Vector3){ 0.185f, 0.4f, 0.0f }; // Camera looking at point
+ camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
+ camera.fovy = 45.0f; // Camera field-of-view Y
+ camera.projection = CAMERA_PERSPECTIVE; // Camera projection type
+ Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
Image imMap = LoadImage("resources/cubicmap.png"); // Load cubicmap image (RAM)
Texture2D cubicmap = LoadTextureFromImage(imMap); // Convert image to texture to display (VRAM)
@@ -37,7 +43,7 @@ int main(void)
// NOTE: By default each cube is mapped to one part of texture atlas
Texture2D texture = LoadTexture("resources/cubicmap_atlas.png"); // Load map texture
- model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set map diffuse texture
+ model.materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture; // Set map diffuse texture
// Get map image data to be used for collision detection
Color *mapPixels = LoadImageColors(imMap);
@@ -45,7 +51,8 @@ int main(void)
Vector3 mapPosition = { -16.0f, 0.0f, -8.0f }; // Set model position
- DisableCursor(); // Catch cursor
+ DisableCursor(); // Limit cursor to relative movement inside the window
+
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------