@@ -61,15 +61,15 @@ int main(void)
61
61
//--------------------------------------------------------------------------------------
62
62
const int screenWidth = 800 ;
63
63
const int screenHeight = 450 ;
64
-
64
+
65
65
InitWindow (screenWidth , screenHeight , "raylib [shapes] example - digital clock" );
66
66
67
67
// Initialize clock
68
68
Clock myClock = {
69
69
.mode = MODE_NORMAL ,
70
70
71
71
.second .angle = 45 ,
72
- .second .length = 140 ,
72
+ .second .length = 140 ,
73
73
.second .thickness = 3 ,
74
74
.second .color = BEIGE ,
75
75
@@ -104,11 +104,11 @@ int main(void)
104
104
// Draw
105
105
//----------------------------------------------------------------------------------
106
106
BeginDrawing ();
107
-
107
+
108
108
ClearBackground (RAYWHITE );
109
109
110
110
DrawCircle (400 , 225 , 5 , BLACK ); // Clock center dot
111
-
111
+
112
112
DrawClock (myClock , (Vector2 ){ 400 , 225 }); // Clock in selected mode
113
113
114
114
DrawText ("Press [SPACE] to switch clock mode" , 10 , 10 , 20 , DARKGRAY );
@@ -138,7 +138,7 @@ static void UpdateClock(Clock *clock)
138
138
time (& rawtime );
139
139
timeinfo = localtime (& rawtime );
140
140
141
- // Updating time data
141
+ // Updating time data
142
142
clock -> second .value = timeinfo -> tm_sec ;
143
143
clock -> minute .value = timeinfo -> tm_min ;
144
144
clock -> hour .value = timeinfo -> tm_hour ;
@@ -150,7 +150,7 @@ static void UpdateClock(Clock *clock)
150
150
clock -> minute .angle = (timeinfo -> tm_min %60 )* 6.0f ;
151
151
clock -> minute .angle += (timeinfo -> tm_sec %60 )* 6 /60.0f ;
152
152
clock -> minute .angle -= 90 ;
153
-
153
+
154
154
clock -> second .angle = (timeinfo -> tm_sec %60 )* 6.0f ;
155
155
clock -> second .angle -= 90 ;
156
156
}
@@ -161,7 +161,7 @@ static void DrawClock(Clock clock, Vector2 centerPosition)
161
161
if (clock .mode == MODE_HANDS_FREE )
162
162
{
163
163
DrawCircleLinesV (centerPosition , clock .minute .length , LIGHTGRAY );
164
-
164
+
165
165
DrawText (TextFormat ("%i" , clock .second .value ), centerPosition .x + (clock .second .length - 10 )* cosf (clock .second .angle * (float )(PI /180 )) - DIGIT_SIZE /2 , centerPosition .y + clock .second .length * sinf (clock .second .angle * (float )(PI /180 )) - DIGIT_SIZE /2 , DIGIT_SIZE , GRAY );
166
166
167
167
DrawText (TextFormat ("%i" , clock .minute .value ), clock .minute .origin .x + clock .minute .length * cosf (clock .minute .angle * (float )(PI /180 )) - DIGIT_SIZE /2 , centerPosition .y + clock .minute .length * sinf (clock .minute .angle * (float )(PI /180 )) - DIGIT_SIZE /2 , DIGIT_SIZE , RED );
@@ -171,11 +171,11 @@ static void DrawClock(Clock clock, Vector2 centerPosition)
171
171
else if (clock .mode == MODE_NORMAL )
172
172
{
173
173
// Draw hand seconds
174
- DrawRectanglePro ((Rectangle ){ centerPosition .x , centerPosition .y , clock .second .length , clock .second .thickness },
174
+ DrawRectanglePro ((Rectangle ){ centerPosition .x , centerPosition .y , clock .second .length , clock .second .thickness },
175
175
(Vector2 ){ 0.0f , clock .second .thickness /2.0f }, clock .second .angle , clock .second .color );
176
176
177
177
// Draw hand minutes
178
- DrawRectanglePro ((Rectangle ){ centerPosition .x , centerPosition .y , clock .minute .length , clock .minute .thickness },
178
+ DrawRectanglePro ((Rectangle ){ centerPosition .x , centerPosition .y , clock .minute .length , clock .minute .thickness },
179
179
(Vector2 ){ 0.0f , clock .minute .thickness /2.0f }, clock .minute .angle , clock .minute .color );
180
180
181
181
// Draw hand hours
0 commit comments