Example resize fixes using IsWindowResized()

This commit is contained in:
Jon Daniel 2025-08-02 00:07:46 +02:00
commit b16313a2d3

View file

@ -27,8 +27,8 @@ int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
const int screenWidth = 800;
const int screenHeight = 450;
int screenWidth = 800;
int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [models] example - mesh picking");
@ -73,6 +73,11 @@ int main(void)
{
// Update
//----------------------------------------------------------------------------------
if (IsWindowResized())
{
screenWidth = GetScreenWidth();
screenHeight = GetScreenHeight();
}
if (IsCursorHidden()) UpdateCamera(&camera, CAMERA_FIRST_PERSON); // Update camera
// Toggle camera controls
@ -226,7 +231,7 @@ int main(void)
DrawText(TextFormat("Barycenter: %3.2f %3.2f %3.2f", bary.x, bary.y, bary.z), 10, ypos + 45, 10, BLACK);
}
DrawText("Right click mouse to toggle camera controls", 10, 430, 10, GRAY);
DrawText("Right click mouse to toggle camera controls", 10, screenHeight - 20, 10, GRAY);
DrawText("(c) Turret 3D model by Alberto Cano", screenWidth - 200, screenHeight - 20, 10, GRAY);
@ -245,4 +250,4 @@ int main(void)
//--------------------------------------------------------------------------------------
return 0;
}
}