From 639f41cf5412affbe85439e318205cf855716114 Mon Sep 17 00:00:00 2001 From: Ray Date: Sat, 30 Sep 2017 00:45:03 +0200 Subject: [PATCH] Renamed example file --- ...ne_rotations.c => models_yaw_pitch_roll.c} | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) rename examples/models/{models_plane_rotations.c => models_yaw_pitch_roll.c} (98%) diff --git a/examples/models/models_plane_rotations.c b/examples/models/models_yaw_pitch_roll.c similarity index 98% rename from examples/models/models_plane_rotations.c rename to examples/models/models_yaw_pitch_roll.c index 8178a5e8d..2bae2bf82 100644 --- a/examples/models/models_plane_rotations.c +++ b/examples/models/models_yaw_pitch_roll.c @@ -1,6 +1,6 @@ /******************************************************************************************* * -* raylib [models] example - Plane rotations (pitch, roll, yaw) +* raylib [models] example - Plane rotations (yaw, pitch, roll) * * This example has been created using raylib 1.8 (www.raylib.com) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) @@ -28,7 +28,7 @@ int main() const int screenWidth = 800; const int screenHeight = 450; - InitWindow(screenWidth, screenHeight, "raylib [models] example - plane rotations (pitch, roll, yaw)"); + InitWindow(screenWidth, screenHeight, "raylib [models] example - plane rotations (yaw, pitch, roll)"); Texture2D texAngleGauge = LoadTexture("resources/angle_gauge.png"); Texture2D texBackground = LoadTexture("resources/background.png"); @@ -71,6 +71,15 @@ int main() else if (roll < 0.0f) roll += 0.5f; } + // Plane yaw (y-axis) controls + if (IsKeyDown(KEY_S)) yaw += 1.0f; + else if (IsKeyDown(KEY_A)) yaw -= 1.0f; + else + { + if (yaw > 0.0f) yaw -= 0.5f; + else if (yaw < 0.0f) yaw += 0.5f; + } + // Plane pitch (z-axis) controls if (IsKeyDown(KEY_DOWN)) pitch += 0.6f; else if (IsKeyDown(KEY_UP)) pitch -= 0.6f; @@ -85,15 +94,6 @@ int main() while (pitchOffset > 180) pitchOffset -= 360; while (pitchOffset < -180) pitchOffset += 360; pitchOffset *= 10; - - // Plane yaw (y-axis) controls - if (IsKeyDown(KEY_S)) yaw += 1.0f; - else if (IsKeyDown(KEY_A)) yaw -= 1.0f; - else - { - if (yaw > 0.0f) yaw -= 0.5f; - else if (yaw < 0.0f) yaw += 0.5f; - } Matrix transform = MatrixIdentity();