adjust examples for new UpdateCamera function
This commit is contained in:
parent
866d47434f
commit
42a6520f4d
5 changed files with 54 additions and 81 deletions
|
|
@ -51,9 +51,7 @@ int main(void)
|
|||
colors[i] = (Color){ GetRandomValue(20, 255), GetRandomValue(10, 55), 30, 255 };
|
||||
}
|
||||
|
||||
// Catch cursor
|
||||
DisableCursor();
|
||||
|
||||
DisableCursor(); // Catch cursor
|
||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
|
|
|||
|
|
@ -35,8 +35,6 @@ int main(void)
|
|||
|
||||
Vector3 cubePosition = { 0.0f, 0.0f, 0.0f };
|
||||
|
||||
SetCameraMode(&camera, CAMERA_FREE); // Set a free camera mode
|
||||
|
||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
|
@ -45,7 +43,7 @@ int main(void)
|
|||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
UpdateCamera(&camera);
|
||||
UpdateCamera(&camera, CAMERA_FREE);
|
||||
|
||||
if (IsKeyDown('Z')) camera.target = (Vector3){ 0.0f, 0.0f, 0.0f };
|
||||
//----------------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -40,8 +40,7 @@ int main(void)
|
|||
|
||||
RayCollision collision = { 0 };
|
||||
|
||||
SetCameraMode(&camera, CAMERA_FREE); // Set a free camera mode
|
||||
EnableCursor(); // Disable camera controls
|
||||
EnableCursor(); // Disable camera controls
|
||||
|
||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
|
@ -51,7 +50,7 @@ int main(void)
|
|||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
if (IsCursorHidden()) UpdateCamera(&camera); // Update camera
|
||||
if (IsCursorHidden()) UpdateCamera(&camera, CAMERA_FIRST_PERSON); // Update camera
|
||||
|
||||
// Toggle camera controls
|
||||
if (IsMouseButtonPressed(MOUSE_BUTTON_RIGHT))
|
||||
|
|
|
|||
|
|
@ -96,11 +96,11 @@ int main(void)
|
|||
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector
|
||||
camera.fovy = 60.0f; // Camera field-of-view Y
|
||||
camera.projection = CAMERA_PERSPECTIVE; // Camera type
|
||||
camera.swingCounter = 1; // Enable view bobbing
|
||||
|
||||
Vector3 cubePosition = { 0.0f, 0.0f, 0.0f };
|
||||
|
||||
SetCameraMode(&camera, CAMERA_FIRST_PERSON); // Set first person camera mode
|
||||
|
||||
DisableCursor(); // Catch cursor
|
||||
SetTargetFPS(90); // Set our game to run at 90 frames-per-second
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
|
@ -109,7 +109,7 @@ int main(void)
|
|||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
UpdateCamera(&camera);
|
||||
UpdateCamera(&camera, CAMERA_FIRST_PERSON);
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
|
|
|
|||
|
|
@ -36,8 +36,7 @@ int main(void)
|
|||
Vector3 cubePosition = { 0.0f, 0.0f, 0.0f };
|
||||
Vector2 cubeScreenPosition = { 0.0f, 0.0f };
|
||||
|
||||
SetCameraMode(&camera, CAMERA_FREE); // Set a free camera mode
|
||||
|
||||
DisableCursor(); // Catch cursor
|
||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
|
@ -46,7 +45,7 @@ int main(void)
|
|||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
UpdateCamera(&camera);
|
||||
UpdateCamera(&camera, CAMERA_THIRD_PERSON);
|
||||
|
||||
// Calculate cube screen space position (with a little offset to be in top)
|
||||
cubeScreenPosition = GetWorldToScreen((Vector3){cubePosition.x, cubePosition.y + 2.5f, cubePosition.z}, camera);
|
||||
|
|
|
|||
Loading…
Reference in a new issue