example resize fixes

This commit is contained in:
Jon Daniel 2025-02-26 19:12:32 +01:00
parent e4993c5557
commit 48f9c9c8ff
32 changed files with 323 additions and 234 deletions

View file

@ -67,7 +67,7 @@ int main(void)
DrawText("PRESS SPACE to PAUSE BALL MOVEMENT", 10, GetScreenHeight() - 25, 20, LIGHTGRAY);
// On pause, we draw a blinking message
if (pause && ((framesCounter/30)%2)) DrawText("PAUSED", 350, 200, 30, GRAY);
if (pause && ((framesCounter/30)%2)) DrawText("PAUSED", (GetScreenWidth() - 100)/2, (GetScreenHeight()- 50)/2, 30, GRAY);
DrawFPS(10, 10);
@ -81,4 +81,4 @@ int main(void)
//----------------------------------------------------------
return 0;
}
}

View file

@ -48,7 +48,7 @@ int main(void)
if (state == 0) // Move ball position X with easing
{
framesCounter++;
ballPositionX = (int)EaseElasticOut((float)framesCounter, -100, screenWidth/2.0f + 100, 120);
ballPositionX = (int)EaseElasticOut((float)framesCounter, -100, GetScreenWidth()/2.0f + 100, 120);
if (framesCounter >= 120)
{
@ -99,10 +99,10 @@ int main(void)
ClearBackground(RAYWHITE);
if (state >= 2) DrawRectangle(0, 0, screenWidth, screenHeight, GREEN);
if (state >= 2) DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), GREEN);
DrawCircle(ballPositionX, 200, (float)ballRadius, Fade(RED, 1.0f - ballAlpha));
if (state == 3) DrawText("PRESS [ENTER] TO PLAY AGAIN!", 240, 200, 20, BLACK);
if (state == 3) DrawText("PRESS [ENTER] TO PLAY AGAIN!", GetScreenWidth()/2 - 140, (GetScreenHeight()/2 - 10), 20, BLACK);
EndDrawing();
//----------------------------------------------------------------------------------
@ -114,4 +114,4 @@ int main(void)
//--------------------------------------------------------------------------------------
return 0;
}
}

View file

@ -46,6 +46,11 @@ int main(void)
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
scleraLeftPosition.x = GetScreenWidth()/2.0f - 100.0f;
scleraLeftPosition.y = GetScreenHeight()/2.0f;
scleraRightPosition.x = GetScreenWidth()/2.0f + 100.0f;
scleraRightPosition.y = GetScreenHeight()/2.0f;
// Update
//----------------------------------------------------------------------------------
irisLeftPosition = GetMousePosition();
@ -108,4 +113,4 @@ int main(void)
//--------------------------------------------------------------------------------------
return 0;
}
}

View file

@ -44,11 +44,11 @@ int main(void)
ClearBackground(RAYWHITE);
DrawRectangle(screenWidth/2 - 128, screenHeight/2 - 128, 256, 256, BLACK);
DrawRectangle(screenWidth/2 - 112, screenHeight/2 - 112, 224, 224, RAYWHITE);
DrawText("raylib", screenWidth/2 - 44, screenHeight/2 + 48, 50, BLACK);
DrawRectangle(GetScreenWidth()/2 - 128, GetScreenHeight()/2 - 128, 256, 256, BLACK);
DrawRectangle(GetScreenWidth()/2 - 112, GetScreenHeight()/2 - 112, 224, 224, RAYWHITE);
DrawText("raylib", GetScreenWidth()/2 - 44, GetScreenHeight()/2 + 48, 50, BLACK);
DrawText("this is NOT a texture!", 350, 370, 10, GRAY);
DrawText("this is NOT a texture!", GetScreenWidth()/2 - 50, GetScreenHeight()/2 + 145, 10, GRAY);
EndDrawing();
//----------------------------------------------------------------------------------
@ -60,4 +60,4 @@ int main(void)
//--------------------------------------------------------------------------------------
return 0;
}
}

View file

@ -48,6 +48,9 @@ int main(void)
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
logoPositionX = GetScreenWidth()/2 - 128;
logoPositionY = GetScreenHeight()/2 - 128;
// Update
//----------------------------------------------------------------------------------
if (state == 0) // State 0: Small box blinking
@ -151,7 +154,7 @@ int main(void)
}
else if (state == 4)
{
DrawText("[R] REPLAY", 340, 200, 20, GRAY);
DrawText("[R] REPLAY", GetScreenWidth()/2 - 60, GetScreenHeight()/2 - 25, 20, GRAY);
}
EndDrawing();