aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorraysan5 <raysan5@gmail.com>2016-02-11 14:56:27 +0100
committerraysan5 <raysan5@gmail.com>2016-02-11 14:56:27 +0100
commit15cd4dce4ed19bb80a765eb8eeeca0c6583d7b2a (patch)
tree335321147b8873de2cc7150a8a0a41c18b3403a1
parent9cbfcbb8200252d846f447438a33cf47d32ffaf9 (diff)
downloadraylib-15cd4dce4ed19bb80a765eb8eeeca0c6583d7b2a.tar.gz
raylib-15cd4dce4ed19bb80a765eb8eeeca0c6583d7b2a.zip
Updated examples to make them clearer
-rw-r--r--examples/core_3d_camera_first_person.c2
-rw-r--r--examples/core_3d_camera_free.c8
-rw-r--r--examples/core_3d_mode.c6
-rw-r--r--examples/core_3d_picking.c5
-rw-r--r--examples/textures_srcrec_dstrec.c4
5 files changed, 16 insertions, 9 deletions
diff --git a/examples/core_3d_camera_first_person.c b/examples/core_3d_camera_first_person.c
index 8a092275..2b8dc7fc 100644
--- a/examples/core_3d_camera_first_person.c
+++ b/examples/core_3d_camera_first_person.c
@@ -22,7 +22,7 @@ int main()
InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d camera first person");
- // Define the camera to look into our 3d world
+ // Define the camera to look into our 3d world (position, target, up vector)
Camera camera = {{ 0.0f, 10.0f, 10.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }};
// Generates some random columns
diff --git a/examples/core_3d_camera_free.c b/examples/core_3d_camera_free.c
index df1b480c..4b45373d 100644
--- a/examples/core_3d_camera_free.c
+++ b/examples/core_3d_camera_free.c
@@ -22,10 +22,10 @@ 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 };
SetCameraMode(CAMERA_FREE); // Set a free camera mode
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 };
diff --git a/examples/core_3d_picking.c b/examples/core_3d_picking.c
index 9a6cc138..fdf77030 100644
--- a/examples/core_3d_picking.c
+++ b/examples/core_3d_picking.c
@@ -21,7 +21,10 @@ int main()
InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d picking");
// Define the camera to look into our 3d world
- Camera camera = {{ 0.0f, 10.0f, 10.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }};
+ Camera camera;
+ 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, 1.0f, 0.0f };
Vector3 cubeSize = { 2.0f, 2.0f, 2.0f };
diff --git a/examples/textures_srcrec_dstrec.c b/examples/textures_srcrec_dstrec.c
index 58917421..6d824ce6 100644
--- a/examples/textures_srcrec_dstrec.c
+++ b/examples/textures_srcrec_dstrec.c
@@ -55,6 +55,10 @@ int main()
ClearBackground(RAYWHITE);
// NOTE: Using DrawTexturePro() we can easily rotate and scale the part of the texture we draw
+ // sourceRec defines the part of the texture we use for drawing
+ // destRec defines the rectangle where our texture part will fit (scaling it to fit)
+ // origin defines the point of the texture used as reference for rotation and scaling
+ // rotation defines the texture rotation (using origin as rotation point)
DrawTexturePro(guybrush, sourceRec, destRec, origin, rotation, WHITE);
DrawLine(destRec.x, 0, destRec.x, screenHeight, GRAY);