mirror of
https://github.com/raysan5/raylib.git
synced 2026-01-24 16:19:18 -05:00
[examples] Fix examples to work in MSVC (#5267)
* Fix warnings in many examples Add examples to MSVC solution correctly * fix CI error --------- Co-authored-by: Ray <raysan5@gmail.com>
This commit is contained in:
@ -15,6 +15,8 @@
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
#define _CRT_SECURE_NO_WARNINGS // Disable some Visual Studio warnings
|
||||
|
||||
#include "raylib.h"
|
||||
|
||||
#include <math.h> // Required for: cosf(), sinf()
|
||||
@ -158,7 +160,7 @@ static void UpdateClock(Clock *clock)
|
||||
clock->minute.value = timeinfo->tm_min;
|
||||
clock->hour.value = timeinfo->tm_hour;
|
||||
|
||||
clock->hour.angle = (timeinfo->tm_hour%12)*180.0/6.0f;
|
||||
clock->hour.angle = (timeinfo->tm_hour%12)*180.0f/6.0f;
|
||||
clock->hour.angle += (timeinfo->tm_min%60)*30/60.0f;
|
||||
clock->hour.angle -= 90;
|
||||
|
||||
@ -175,8 +177,8 @@ static void UpdateClock(Clock *clock)
|
||||
static void DrawClockAnalog(Clock clock, Vector2 position)
|
||||
{
|
||||
// Draw clock base
|
||||
DrawCircleV(position, clock.second.length + 40, LIGHTGRAY);
|
||||
DrawCircleV(position, 12, GRAY);
|
||||
DrawCircleV(position, clock.second.length + 40.0f, LIGHTGRAY);
|
||||
DrawCircleV(position, 12.0f, GRAY);
|
||||
|
||||
// Draw clock minutes/seconds lines
|
||||
for (int i = 0; i < 60; i++)
|
||||
@ -192,15 +194,15 @@ static void DrawClockAnalog(Clock clock, Vector2 position)
|
||||
}
|
||||
|
||||
// Draw hand seconds
|
||||
DrawRectanglePro((Rectangle){ position.x, position.y, clock.second.length, clock.second.thickness },
|
||||
DrawRectanglePro((Rectangle){ position.x, position.y, (float)clock.second.length, (float)clock.second.thickness },
|
||||
(Vector2){ 0.0f, clock.second.thickness/2.0f }, clock.second.angle, clock.second.color);
|
||||
|
||||
// Draw hand minutes
|
||||
DrawRectanglePro((Rectangle){ position.x, position.y, clock.minute.length, clock.minute.thickness },
|
||||
DrawRectanglePro((Rectangle){ position.x, position.y, (float)clock.minute.length, (float)clock.minute.thickness },
|
||||
(Vector2){ 0.0f, clock.minute.thickness/2.0f }, clock.minute.angle, clock.minute.color);
|
||||
|
||||
// Draw hand hours
|
||||
DrawRectanglePro((Rectangle){ position.x, position.y, clock.hour.length, clock.hour.thickness },
|
||||
DrawRectanglePro((Rectangle){ position.x, position.y, (float)clock.hour.length, (float)clock.hour.thickness },
|
||||
(Vector2){ 0.0f, clock.hour.thickness/2.0f }, clock.hour.angle, clock.hour.color);
|
||||
}
|
||||
|
||||
@ -212,14 +214,14 @@ static void DrawClockDigital(Clock clock, Vector2 position)
|
||||
DrawDisplayValue((Vector2){ position.x, position.y }, clock.hour.value/10, RED, Fade(LIGHTGRAY, 0.3f));
|
||||
DrawDisplayValue((Vector2){ position.x + 120, position.y }, clock.hour.value%10, RED, Fade(LIGHTGRAY, 0.3f));
|
||||
|
||||
DrawCircle(position.x + 240, position.y + 70, 12, (clock.second.value%2)? RED : Fade(LIGHTGRAY, 0.3f));
|
||||
DrawCircle(position.x + 240, position.y + 150, 12, (clock.second.value%2)? RED : Fade(LIGHTGRAY, 0.3f));
|
||||
DrawCircle((int)position.x + 240, (int)position.y + 70, 12, (clock.second.value%2)? RED : Fade(LIGHTGRAY, 0.3f));
|
||||
DrawCircle((int)position.x + 240, (int)position.y + 150, 12, (clock.second.value%2)? RED : Fade(LIGHTGRAY, 0.3f));
|
||||
|
||||
DrawDisplayValue((Vector2){ position.x + 260, position.y }, clock.minute.value/10, RED, Fade(LIGHTGRAY, 0.3f));
|
||||
DrawDisplayValue((Vector2){ position.x + 380, position.y }, clock.minute.value%10, RED, Fade(LIGHTGRAY, 0.3f));
|
||||
|
||||
DrawCircle(position.x + 500, position.y + 70, 12, (clock.second.value%2)? RED : Fade(LIGHTGRAY, 0.3f));
|
||||
DrawCircle(position.x + 500, position.y + 150, 12, (clock.second.value%2)? RED : Fade(LIGHTGRAY, 0.3f));
|
||||
DrawCircle((int)position.x + 500, (int)position.y + 70, 12, (clock.second.value%2)? RED : Fade(LIGHTGRAY, 0.3f));
|
||||
DrawCircle((int)position.x + 500, (int)position.y + 150, 12, (clock.second.value%2)? RED : Fade(LIGHTGRAY, 0.3f));
|
||||
|
||||
DrawDisplayValue((Vector2){ position.x + 520, position.y }, clock.second.value/10, RED, Fade(LIGHTGRAY, 0.3f));
|
||||
DrawDisplayValue((Vector2){ position.x + 640, position.y }, clock.second.value%10, RED, Fade(LIGHTGRAY, 0.3f));
|
||||
|
||||
Reference in New Issue
Block a user