@@ -43,7 +43,7 @@ int main(void)
43
43
44
44
raylib::Color colors[10 ] = { 0 };
45
45
for (int i = 0 ; i < 10 ; i++) {
46
- colors[i] = raylib::Color ((unsigned int )GetRandomValue (100 , 250 ), (unsigned int )GetRandomValue (50 , 150 ), (unsigned int )GetRandomValue (10 , 100 ), 255 );
46
+ colors[i] = raylib::Color ((unsigned char )GetRandomValue (100 , 250 ), (unsigned char )GetRandomValue (50 , 150 ), (unsigned char )GetRandomValue (10 , 100 ), 255 );
47
47
}
48
48
49
49
window.SetTargetFPS (60 ); // Set our game to run at 60 frames-per-second
@@ -60,7 +60,7 @@ int main(void)
60
60
if (IsKeyPressed (KEY_SPACE))
61
61
{
62
62
// Recalculate random colors for the bars
63
- for (int i = 0 ; i < 10 ; i++) colors[i] = (Color){ (unsigned int )GetRandomValue (100 , 250 ), (unsigned int )GetRandomValue (50 , 150 ), (unsigned int )GetRandomValue (10 , 100 ), 255 };
63
+ for (int i = 0 ; i < 10 ; i++) colors[i] = (Color){ (unsigned char )GetRandomValue (100 , 250 ), (unsigned char )GetRandomValue (50 , 150 ), (unsigned char )GetRandomValue (10 , 100 ), 255 };
64
64
}
65
65
66
66
// Update virtual mouse (clamped mouse value behind game screen)
@@ -69,7 +69,7 @@ int main(void)
69
69
(mouse.x - (GetScreenWidth () - (gameScreenWidth*scale))*0 .5f )/scale,
70
70
(mouse.y - (GetScreenHeight () - (gameScreenHeight*scale))*0 .5f )/scale
71
71
);
72
- virtualMouse = virtualMouse.Clamp (( Vector2){ 0 , 0 }, ( Vector2){ ( float ) gameScreenWidth, ( float ) gameScreenHeight } );
72
+ virtualMouse = virtualMouse.Clamp (raylib:: Vector2::Zero (), raylib:: Vector2( gameScreenWidth, gameScreenHeight) );
73
73
74
74
// Apply the same transformation as the virtual mouse to the real mouse (i.e. to work with raygui)
75
75
// SetMouseOffset(-(GetScreenWidth() - (gameScreenWidth*scale))*0.5f, -(GetScreenHeight() - (gameScreenHeight*scale))*0.5f);
@@ -93,9 +93,13 @@ int main(void)
93
93
ClearBackground (BLACK); // Clear screen background
94
94
95
95
// Draw render texture to screen, properly scaled
96
- target.GetTexture ().Draw ((Rectangle){ 0 .0f , 0 .0f , (float )target.texture .width , (float )-target.texture .height },
97
- (Rectangle){ (GetScreenWidth () - ((float )gameScreenWidth*scale))*0 .5f , (GetScreenHeight () - ((float )gameScreenHeight*scale))*0 .5f ,
98
- (float )gameScreenWidth*scale, (float )gameScreenHeight*scale }, (Vector2){ 0 , 0 }, 0 .0f , WHITE);
96
+ target.GetTexture ().Draw (raylib::Rectangle (0 .0f , 0 .0f , target.texture .width , -target.texture .height ),
97
+ raylib::Rectangle (
98
+ (GetScreenWidth () - (gameScreenWidth*scale))*0 .5f ,
99
+ (GetScreenHeight () - (gameScreenHeight*scale))*0 .5f ,
100
+ gameScreenWidth*scale, gameScreenHeight*scale
101
+ ),
102
+ raylib::Vector2::Zero (), 0 .0f , WHITE);
99
103
EndDrawing ();
100
104
// --------------------------------------------------------------------------------------
101
105
}
0 commit comments