@@ -68,8 +68,8 @@ typedef struct Star {
6868//-------------------------------------------------------------------------------------- 
6969// Module Functions Declaration 
7070//-------------------------------------------------------------------------------------- 
71- static  void  UpdateStar (Star  * s );
72- static  void  ResetStar (Star  * s );
71+ static  void  UpdateStar (Star  * star );
72+ static  void  ResetStar (Star  * star );
7373
7474//------------------------------------------------------------------------------------ 
7575// Program main entry point 
@@ -117,7 +117,6 @@ int main(void)
117117        spots [i ].positionLoc  =  GetShaderLocation (shdrSpot , posName );
118118        spots [i ].innerLoc  =  GetShaderLocation (shdrSpot , innerName );
119119        spots [i ].radiusLoc  =  GetShaderLocation (shdrSpot , radiusName );
120- 
121120    }
122121
123122    // Tell the shader how wide the screen is so we can have 
@@ -136,8 +135,8 @@ int main(void)
136135
137136        while  ((fabs (spots [i ].speed .x ) +  fabs (spots [i ].speed .y )) <  2 )
138137        {
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 ;
141140        }
142141
143142        spots [i ].inner  =  28.0f * (i  +  1 );
@@ -234,30 +233,29 @@ int main(void)
234233    return  0 ;
235234}
236235
237- 
238- static  void  ResetStar (Star  * s )
236+ //-------------------------------------------------------------------------------------- 
237+ // Module Functions Definition 
238+ //-------------------------------------------------------------------------------------- 
239+ static  void  ResetStar (Star  * star )
239240{
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 ;
241245
242-     do 
246+     while  (!( fabs ( star -> speed . x )  +  ( fabs ( star -> speed . y )  >   1 ))); 
243247    {
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+     } 
248251
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  }));
250253}
251254
252- static  void  UpdateStar (Star  * s )
255+ static  void  UpdateStar (Star  * star )
253256{
254-     s -> position  =  Vector2Add (s -> position , s -> speed );
257+     star -> position  =  Vector2Add (star -> position , star -> speed );
255258
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 );
261261}
262- 
263- 
0 commit comments