Review variables initialization

This commit is contained in:
Ray 2019-05-27 00:18:15 +02:00
parent 241c4c8d14
commit 87774a0a21
33 changed files with 52 additions and 56 deletions

View file

@ -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;

View file

@ -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++)
{

View file

@ -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)

View file

@ -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);

View file

@ -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)

View file

@ -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