From 4f0165f32dc3f04cd58c013743e51384b7b932ab Mon Sep 17 00:00:00 2001 From: raysan5 Date: Wed, 13 Jan 2016 18:11:11 +0100 Subject: Example reviewed (more clear now) --- examples/core_3d_mode.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'examples/core_3d_mode.c') diff --git a/examples/core_3d_mode.c b/examples/core_3d_mode.c index c38da256..3a5fae13 100644 --- a/examples/core_3d_mode.c +++ b/examples/core_3d_mode.c @@ -21,11 +21,14 @@ int main() InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d mode"); // Define the camera to look into our 3d world - Camera camera = {{ 0.0, 10.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }}; + Camera camera; + camera.position = (Vector3){ 0.0, 10.0, 10.0 }; + camera.target = (Vector3){ 0.0, 0.0, 0.0 }; + camera.up = (Vector3){ 0.0, 1.0, 0.0 }; Vector3 cubePosition = { 0.0, 0.0, 0.0 }; - //SetTargetFPS(60); // Set our game to run at 60 frames-per-second, but not now... + SetTargetFPS(60); // Set our game to run at 60 frames-per-second //-------------------------------------------------------------------------------------- // Main game loop @@ -40,12 +43,12 @@ int main() //---------------------------------------------------------------------------------- BeginDrawing(); - ClearBackground(WHITE); + ClearBackground(RAYWHITE); Begin3dMode(camera); - DrawCube(cubePosition, 2, 2, 2, RED); - DrawCubeWires(cubePosition, 2, 2, 2, MAROON); + DrawCube(cubePosition, 2.0, 2.0, 2.0, RED); + DrawCubeWires(cubePosition, 2.0, 2.0, 2.0, MAROON); DrawGrid(10.0, 1.0); -- cgit v1.2.3 From 183795b8aa78fdf0b8064d72d77eaea8e7b6397b Mon Sep 17 00:00:00 2001 From: raysan5 Date: Sat, 16 Jan 2016 12:52:55 +0100 Subject: Review literals type --- examples/core_3d_mode.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'examples/core_3d_mode.c') diff --git a/examples/core_3d_mode.c b/examples/core_3d_mode.c index 3a5fae13..40415fea 100644 --- a/examples/core_3d_mode.c +++ b/examples/core_3d_mode.c @@ -22,11 +22,11 @@ int main() // Define the camera to look into our 3d world Camera camera; - camera.position = (Vector3){ 0.0, 10.0, 10.0 }; - camera.target = (Vector3){ 0.0, 0.0, 0.0 }; - camera.up = (Vector3){ 0.0, 1.0, 0.0 }; + camera.position = (Vector3){ 0.0f, 10.0f, 10.0f }; + camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; + camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; - Vector3 cubePosition = { 0.0, 0.0, 0.0 }; + Vector3 cubePosition = { 0.0f, 0.0f, 0.0f }; SetTargetFPS(60); // Set our game to run at 60 frames-per-second //-------------------------------------------------------------------------------------- @@ -47,10 +47,10 @@ int main() Begin3dMode(camera); - DrawCube(cubePosition, 2.0, 2.0, 2.0, RED); - DrawCubeWires(cubePosition, 2.0, 2.0, 2.0, MAROON); + DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RED); + DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, MAROON); - DrawGrid(10.0, 1.0); + DrawGrid(10, 1.0f); End3dMode(); -- cgit v1.2.3 From 15cd4dce4ed19bb80a765eb8eeeca0c6583d7b2a Mon Sep 17 00:00:00 2001 From: raysan5 Date: Thu, 11 Feb 2016 14:56:27 +0100 Subject: Updated examples to make them clearer --- examples/core_3d_mode.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'examples/core_3d_mode.c') diff --git a/examples/core_3d_mode.c b/examples/core_3d_mode.c index 40415fea..7be5dd45 100644 --- a/examples/core_3d_mode.c +++ b/examples/core_3d_mode.c @@ -22,9 +22,9 @@ int main() // Define the camera to look into our 3d world Camera camera; - camera.position = (Vector3){ 0.0f, 10.0f, 10.0f }; - camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; - camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; + camera.position = (Vector3){ 0.0f, 10.0f, 10.0f }; // Camera position + camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point + camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target) Vector3 cubePosition = { 0.0f, 0.0f, 0.0f }; -- cgit v1.2.3