Merge remote-tracking branch 'origin/master' into update-examples-fix

This commit is contained in:
Johnny Cena 2025-08-23 21:56:27 +02:00
commit d6a5223984
5 changed files with 340 additions and 209 deletions

View file

@ -106,9 +106,9 @@ int main(void)
{
// Update
//----------------------------------------------------------------------------------
Vector2 mouse_delta = GetMouseDelta();
lookRotation.x -= mouse_delta.x*sensitivity.x;
lookRotation.y += mouse_delta.y*sensitivity.y;
Vector2 mouseDelta = GetMouseDelta();
lookRotation.x -= mouseDelta.x*sensitivity.x;
lookRotation.y += mouseDelta.y*sensitivity.y;
char sideway = (IsKeyDown(KEY_D) - IsKeyDown(KEY_A));
char forward = (IsKeyDown(KEY_W) - IsKeyDown(KEY_S));
@ -261,7 +261,10 @@ static void UpdateCameraAngle(Camera *camera)
Vector3 right = Vector3Normalize(Vector3CrossProduct(yaw, up));
// Rotate view vector around right axis
Vector3 pitch = Vector3RotateByAxisAngle(yaw, right, -lookRotation.y - lean.y);
float pitchAngle = -lookRotation.y -
lean.y;
pitchAngle = Clamp(pitchAngle, -PI / 2 + 0.0001f, PI / 2 - 0.0001f); // Clamp angle so it doesn't go past straight up or straight down
Vector3 pitch = Vector3RotateByAxisAngle(yaw, right, pitchAngle);
// Head animation
// Rotate up direction around forward axis

View file

@ -29,7 +29,6 @@ int main(void)
Vector2 ballPosition = { -100.0f, -100.0f };
Color ballColor = DARKBLUE;
int isCursorHidden = 0;
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//---------------------------------------------------------------------------------------
@ -41,15 +40,13 @@ int main(void)
//----------------------------------------------------------------------------------
if (IsKeyPressed(KEY_H))
{
if (isCursorHidden == 0)
if (IsCursorHidden())
{
HideCursor();
isCursorHidden = 1;
ShowCursor();
}
else
{
ShowCursor();
isCursorHidden = 0;
HideCursor();
}
}
@ -75,7 +72,7 @@ int main(void)
DrawText("move ball with mouse and click mouse button to change color", 10, 10, 20, DARKGRAY);
DrawText("Press 'H' to toggle cursor visibility", 10, 30, 20, DARKGRAY);
if (isCursorHidden == 1) DrawText("CURSOR HIDDEN", 20, 60, 20, RED);
if (!IsCursorHidden()) DrawText("CURSOR HIDDEN", 20, 60, 20, RED);
else DrawText("CURSOR VISIBLE", 20, 60, 20, LIME);
EndDrawing();

View file

@ -1,4 +1,6 @@
#version 120
#version 100
precision mediump float;
// Input vertex attributes (from vertex shader)
varying vec2 fragTexCoord;

View file

@ -1,4 +1,6 @@
#version 120
#version 100
precision mediump float;
// Input vertex attributes (from vertex shader)
varying vec2 fragTexCoord;

View file

@ -1,4 +1,4 @@
#version 100
#version 120
#extension GL_EXT_frag_depth : enable