summaryrefslogtreecommitdiffhomepage
path: root/examples/core
diff options
context:
space:
mode:
authorRay <[email protected]>2019-05-27 00:18:15 +0200
committerRay <[email protected]>2019-05-27 00:18:15 +0200
commit87774a0a21f8d2998b4dc13e989005270476ae92 (patch)
tree4228376c752b1760be44cc8582725ecac522939b /examples/core
parent241c4c8d14225bdf30c168802d4b16b59d5043e0 (diff)
downloadraylib-87774a0a21f8d2998b4dc13e989005270476ae92.tar.gz
raylib-87774a0a21f8d2998b4dc13e989005270476ae92.zip
Review variables initialization
Diffstat (limited to 'examples/core')
-rw-r--r--examples/core/core_2d_camera.c5
-rw-r--r--examples/core/core_3d_camera_first_person.c6
-rw-r--r--examples/core/core_3d_camera_free.c2
-rw-r--r--examples/core/core_custom_logging.c2
-rw-r--r--examples/core/core_vr_simulator.c2
-rw-r--r--examples/core/core_world_screen.c3
6 files changed, 9 insertions, 11 deletions
diff --git a/examples/core/core_2d_camera.c b/examples/core/core_2d_camera.c
index fe8e584b..81f580ad 100644
--- a/examples/core/core_2d_camera.c
+++ b/examples/core/core_2d_camera.c
@@ -23,8 +23,8 @@ int main(void)
InitWindow(screenWidth, screenHeight, "raylib [core] example - 2d camera");
Rectangle player = { 400, 280, 40, 40 };
- Rectangle buildings[MAX_BUILDINGS];
- Color buildColors[MAX_BUILDINGS];
+ Rectangle buildings[MAX_BUILDINGS] = { 0 };
+ Color buildColors[MAX_BUILDINGS] = { 0 };
int spacing = 0;
@@ -41,7 +41,6 @@ int main(void)
}
Camera2D camera = { 0 };
-
camera.target = (Vector2){ player.x + 20, player.y + 20 };
camera.offset = (Vector2){ 0, 0 };
camera.rotation = 0.0f;
diff --git a/examples/core/core_3d_camera_first_person.c b/examples/core/core_3d_camera_first_person.c
index 825a9ca8..39fbfb2e 100644
--- a/examples/core/core_3d_camera_first_person.c
+++ b/examples/core/core_3d_camera_first_person.c
@@ -31,9 +31,9 @@ int main(void)
camera.type = CAMERA_PERSPECTIVE;
// Generates some random columns
- float heights[MAX_COLUMNS];
- Vector3 positions[MAX_COLUMNS];
- Color colors[MAX_COLUMNS];
+ float heights[MAX_COLUMNS] = { 0.0f };
+ Vector3 positions[MAX_COLUMNS] = { 0 };
+ Color colors[MAX_COLUMNS] = { 0 };
for (int i = 0; i < MAX_COLUMNS; i++)
{
diff --git a/examples/core/core_3d_camera_free.c b/examples/core/core_3d_camera_free.c
index c1445f60..5053fd63 100644
--- a/examples/core/core_3d_camera_free.c
+++ b/examples/core/core_3d_camera_free.c
@@ -21,7 +21,7 @@ int main(void)
InitWindow(screenWidth, screenHeight, "raylib [core] example - 3d camera free");
// Define the camera to look into our 3d world
- Camera3D camera;
+ Camera3D camera = { 0 };
camera.position = (Vector3){ 10.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)
diff --git a/examples/core/core_custom_logging.c b/examples/core/core_custom_logging.c
index 0ab3fa45..56e168ee 100644
--- a/examples/core/core_custom_logging.c
+++ b/examples/core/core_custom_logging.c
@@ -19,7 +19,7 @@
// Custom logging funtion
void LogCustom(int msgType, const char *text, va_list args)
{
- char timeStr[64];
+ char timeStr[64] = { 0 };
time_t now = time(NULL);
struct tm *tm_info = localtime(&now);
diff --git a/examples/core/core_vr_simulator.c b/examples/core/core_vr_simulator.c
index 134a36f0..628d7cf4 100644
--- a/examples/core/core_vr_simulator.c
+++ b/examples/core/core_vr_simulator.c
@@ -60,7 +60,7 @@ int main(void)
SetVrConfiguration(hmd, distortion); // Set Vr device parameters for stereo rendering
// Define the camera to look into our 3d world
- Camera camera;
+ Camera camera = { 0 };
camera.position = (Vector3){ 5.0f, 2.0f, 5.0f }; // Camera position
camera.target = (Vector3){ 0.0f, 2.0f, 0.0f }; // Camera looking at point
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
diff --git a/examples/core/core_world_screen.c b/examples/core/core_world_screen.c
index 434952bc..31d3653d 100644
--- a/examples/core/core_world_screen.c
+++ b/examples/core/core_world_screen.c
@@ -29,8 +29,7 @@ int main(void)
camera.type = CAMERA_PERSPECTIVE;
Vector3 cubePosition = { 0.0f, 0.0f, 0.0f };
-
- Vector2 cubeScreenPosition;
+ Vector2 cubeScreenPosition = { 0.0f, 0.0f };
SetCameraMode(camera, CAMERA_FREE); // Set a free camera mode