@@ -85,7 +85,7 @@ int main(void)
85
85
for (int n = 0 ; n < MAX_STARS ; n ++ ) ResetStar (& stars [n ]);
86
86
87
87
// Progress all the stars on, so they don't all start in the centre
88
- for (int m = 0 ; m < screenWidth /2.0 ; m ++ )
88
+ for (int m = 0 ; m < GetScreenWidth () /2.0 ; m ++ )
89
89
{
90
90
for (int n = 0 ; n < MAX_STARS ; n ++ ) UpdateStar (& stars [n ]);
91
91
}
@@ -124,8 +124,8 @@ int main(void)
124
124
// and initialize the shader locations
125
125
for (int i = 0 ; i < MAX_SPOTS ; i ++ )
126
126
{
127
- spots [i ].position .x = (float )GetRandomValue (64 , screenWidth - 64 );
128
- spots [i ].position .y = (float )GetRandomValue (64 , screenHeight - 64 );
127
+ spots [i ].position .x = (float )GetRandomValue (64 , GetScreenWidth () - 64 );
128
+ spots [i ].position .y = (float )GetRandomValue (64 , GetScreenHeight () - 64 );
129
129
spots [i ].speed = (Vector2 ){ 0 , 0 };
130
130
131
131
while ((fabs (spots [i ].speed .x ) + fabs (spots [i ].speed .y )) < 2 )
@@ -152,6 +152,9 @@ int main(void)
152
152
//----------------------------------------------------------------------------------
153
153
frameCounter ++ ;
154
154
155
+ sw = (float )GetScreenWidth ();
156
+ SetShaderValue (shdrSpot , wLoc , & sw , SHADER_UNIFORM_FLOAT );
157
+
155
158
// Move the stars, resetting them if the go offscreen
156
159
for (int n = 0 ; n < MAX_STARS ; n ++ ) UpdateStar (& stars [n ]);
157
160
@@ -162,17 +165,17 @@ int main(void)
162
165
{
163
166
Vector2 mp = GetMousePosition ();
164
167
spots [i ].position .x = mp .x ;
165
- spots [i ].position .y = screenHeight - mp .y ;
168
+ spots [i ].position .y = GetScreenHeight () - mp .y ;
166
169
}
167
170
else
168
171
{
169
172
spots [i ].position .x += spots [i ].speed .x ;
170
173
spots [i ].position .y += spots [i ].speed .y ;
171
174
172
175
if (spots [i ].position .x < 64 ) spots [i ].speed .x = - spots [i ].speed .x ;
173
- if (spots [i ].position .x > (screenWidth - 64 )) spots [i ].speed .x = - spots [i ].speed .x ;
176
+ if (spots [i ].position .x > (GetScreenWidth () - 64 )) spots [i ].speed .x = - spots [i ].speed .x ;
174
177
if (spots [i ].position .y < 64 ) spots [i ].speed .y = - spots [i ].speed .y ;
175
- if (spots [i ].position .y > (screenHeight - 64 )) spots [i ].speed .y = - spots [i ].speed .y ;
178
+ if (spots [i ].position .y > (GetScreenHeight () - 64 )) spots [i ].speed .y = - spots [i ].speed .y ;
176
179
}
177
180
178
181
SetShaderValue (shdrSpot , spots [i ].positionLoc , & spots [i ].position .x , SHADER_UNIFORM_VEC2 );
@@ -194,8 +197,8 @@ int main(void)
194
197
for (int i = 0 ; i < 16 ; i ++ )
195
198
{
196
199
DrawTexture (texRay ,
197
- (int )((screenWidth /2.0f ) + cos ((frameCounter + i * 8 )/51.45f )* (screenWidth /2.2f ) - 32 ),
198
- (int )((screenHeight /2.0f ) + sin ((frameCounter + i * 8 )/17.87f )* (screenHeight /4.2f )), WHITE );
200
+ (int )((GetScreenWidth () /2.0f ) + cos ((frameCounter + i * 8 )/51.45f )* (GetScreenWidth () /2.2f ) - 32 ),
201
+ (int )((GetScreenHeight () /2.0f ) + sin ((frameCounter + i * 8 )/17.87f )* (GetScreenHeight () /4.2f )), WHITE );
199
202
}
200
203
201
204
// Draw spot lights
@@ -204,14 +207,14 @@ int main(void)
204
207
// a render texture of the full screen used to do screen
205
208
// scaling (slight adjustment to shader would be required
206
209
// to actually pay attention to the colour!)
207
- DrawRectangle (0 , 0 , screenWidth , screenHeight , WHITE );
210
+ DrawRectangle (0 , 0 , GetScreenWidth (), GetScreenHeight () , WHITE );
208
211
EndShaderMode ();
209
212
210
213
DrawFPS (10 , 10 );
211
214
212
215
DrawText ("Move the mouse!" , 10 , 30 , 20 , GREEN );
213
- DrawText ("Pitch Black" , (int )(screenWidth * 0.2f ), screenHeight /2 , 20 , GREEN );
214
- DrawText ("Dark" , (int )(screenWidth * .66f ), screenHeight /2 , 20 , GREEN );
216
+ DrawText ("Pitch Black" , (int )(GetScreenWidth () * 0.2f ), GetScreenHeight () /2 , 20 , GREEN );
217
+ DrawText ("Dark" , (int )(GetScreenWidth () * .66f ), GetScreenHeight () /2 , 20 , GREEN );
215
218
216
219
EndDrawing ();
217
220
//----------------------------------------------------------------------------------
0 commit comments