@@ -68,8 +68,8 @@ typedef struct Star {
68
68
//--------------------------------------------------------------------------------------
69
69
// Module Functions Declaration
70
70
//--------------------------------------------------------------------------------------
71
- static void UpdateStar (Star * s );
72
- static void ResetStar (Star * s );
71
+ static void UpdateStar (Star * star );
72
+ static void ResetStar (Star * star );
73
73
74
74
//------------------------------------------------------------------------------------
75
75
// Program main entry point
@@ -117,7 +117,6 @@ int main(void)
117
117
spots [i ].positionLoc = GetShaderLocation (shdrSpot , posName );
118
118
spots [i ].innerLoc = GetShaderLocation (shdrSpot , innerName );
119
119
spots [i ].radiusLoc = GetShaderLocation (shdrSpot , radiusName );
120
-
121
120
}
122
121
123
122
// Tell the shader how wide the screen is so we can have
@@ -136,8 +135,8 @@ int main(void)
136
135
137
136
while ((fabs (spots [i ].speed .x ) + fabs (spots [i ].speed .y )) < 2 )
138
137
{
139
- spots [i ].speed .x = GetRandomValue (-400 , 40 )/10 .0f ;
140
- spots [i ].speed .y = GetRandomValue (-400 , 40 )/10 .0f ;
138
+ spots [i ].speed .x = GetRandomValue (-400 , 40 )/20 .0f ;
139
+ spots [i ].speed .y = GetRandomValue (-400 , 40 )/20 .0f ;
141
140
}
142
141
143
142
spots [i ].inner = 28.0f * (i + 1 );
@@ -234,30 +233,29 @@ int main(void)
234
233
return 0 ;
235
234
}
236
235
237
-
238
- static void ResetStar (Star * s )
236
+ //--------------------------------------------------------------------------------------
237
+ // Module Functions Definition
238
+ //--------------------------------------------------------------------------------------
239
+ static void ResetStar (Star * star )
239
240
{
240
- s -> position = (Vector2 ){ GetScreenWidth ()/2.0f , GetScreenHeight ()/2.0f };
241
+ star -> position = (Vector2 ){ GetScreenWidth ()/2.0f , GetScreenHeight ()/2.0f };
242
+
243
+ star -> speed .x = (float )GetRandomValue (-1000 , 1000 )/100.0f ;
244
+ star -> speed .y = (float )GetRandomValue (-1000 , 1000 )/100.0f ;
241
245
242
- do
246
+ while (!( fabs ( star -> speed . x ) + ( fabs ( star -> speed . y ) > 1 )));
243
247
{
244
- s -> speed .x = (float )GetRandomValue (-1000 , 1000 )/100.0f ;
245
- s -> speed .y = (float )GetRandomValue (-1000 , 1000 )/100.0f ;
246
-
247
- } while (!(fabs (s -> speed .x ) + (fabs (s -> speed .y ) > 1 )));
248
+ star -> speed .x = (float )GetRandomValue (-1000 , 1000 )/100.0f ;
249
+ star -> speed .y = (float )GetRandomValue (-1000 , 1000 )/100.0f ;
250
+ }
248
251
249
- s -> position = Vector2Add (s -> position , Vector2Multiply (s -> speed , (Vector2 ){ 8.0f , 8.0f }));
252
+ star -> position = Vector2Add (star -> position , Vector2Multiply (star -> speed , (Vector2 ){ 8.0f , 8.0f }));
250
253
}
251
254
252
- static void UpdateStar (Star * s )
255
+ static void UpdateStar (Star * star )
253
256
{
254
- s -> position = Vector2Add (s -> position , s -> speed );
257
+ star -> position = Vector2Add (star -> position , star -> speed );
255
258
256
- if ((s -> position .x < 0 ) || (s -> position .x > GetScreenWidth ()) ||
257
- (s -> position .y < 0 ) || (s -> position .y > GetScreenHeight ()))
258
- {
259
- ResetStar (s );
260
- }
259
+ if ((star -> position .x < 0 ) || (star -> position .x > GetScreenWidth ()) ||
260
+ (star -> position .y < 0 ) || (star -> position .y > GetScreenHeight ())) ResetStar (star );
261
261
}
262
-
263
-
0 commit comments