diff options
| author | Ray San <[email protected]> | 2018-04-11 10:13:00 +0200 |
|---|---|---|
| committer | Ray San <[email protected]> | 2018-04-11 10:13:00 +0200 |
| commit | 4cc12ef2b32f66f160e4e401e5cd76d1740eaf61 (patch) | |
| tree | f9a43a0d3e69aa430e3a8152bb6b5b9268c3b1be /examples/models/models_orthographic_projection.c | |
| parent | cc3b8645df23ed9aeb9d6efc806ab91170a29a89 (diff) | |
| download | raylib-4cc12ef2b32f66f160e4e401e5cd76d1740eaf61.tar.gz raylib-4cc12ef2b32f66f160e4e401e5cd76d1740eaf61.zip | |
Review camera definition on examples
Diffstat (limited to 'examples/models/models_orthographic_projection.c')
| -rw-r--r-- | examples/models/models_orthographic_projection.c | 37 |
1 files changed, 11 insertions, 26 deletions
diff --git a/examples/models/models_orthographic_projection.c b/examples/models/models_orthographic_projection.c index 2c2a89d1..cb5ea053 100644 --- a/examples/models/models_orthographic_projection.c +++ b/examples/models/models_orthographic_projection.c @@ -4,17 +4,17 @@ * * This program is heavily based on the geometric objects example * -* This example has been created using raylib 1.0 (www.raylib.com) +* This example has been created using raylib 1.9.7 (www.raylib.com) * raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) * -* Copyright (c) 2014 Ramon Santamaria (@raysan5) +* Copyright (c) 2018 Max Danielsson & Ramon Santamaria (@raysan5) * ********************************************************************************************/ #include "raylib.h" -#define FOVY_PERSPECTIVE 45.0f -#define WIDTH_ORTHOGRAPHIC 10.0f +#define FOVY_PERSPECTIVE 45.0f +#define WIDTH_ORTHOGRAPHIC 10.0f int main() { @@ -36,15 +36,9 @@ int main() { // Update //---------------------------------------------------------------------------------- - // TODO: Update your variables here - //---------------------------------------------------------------------------------- - // - - // Input - //---------------------------------------------------------------------------------- - if(IsKeyPressed(KEY_SPACE)) + if (IsKeyPressed(KEY_SPACE)) { - if(camera.type == CAMERA_PERSPECTIVE) + if (camera.type == CAMERA_PERSPECTIVE) { camera.fovy = WIDTH_ORTHOGRAPHIC; camera.type = CAMERA_ORTHOGRAPHIC; @@ -55,12 +49,10 @@ int main() camera.type = CAMERA_PERSPECTIVE; } } - + //---------------------------------------------------------------------------------- // Draw //---------------------------------------------------------------------------------- - - BeginDrawing(); ClearBackground(RAYWHITE); @@ -85,19 +77,12 @@ int main() End3dMode(); - DrawFPS(10, 10); + DrawText("Press Spacebar to switch camera type", 10, GetScreenHeight() - 30, 20, DARKGRAY); - DrawText("Press Spacebar to switch camera type", 10, 40, 24, BLACK); - - if(camera.type == CAMERA_ORTHOGRAPHIC) - { - DrawText("Orthographic", 10, 65, 24, BLACK); - } - else if(camera.type == CAMERA_PERSPECTIVE) - { - DrawText("Perspective", 10, 65, 24, BLACK); - } + if (camera.type == CAMERA_ORTHOGRAPHIC) DrawText("ORTHOGRAPHIC", 10, 40, 20, BLACK); + else if (camera.type == CAMERA_PERSPECTIVE) DrawText("PERSPECTIVE", 10, 40, 20, BLACK); + DrawFPS(10, 10); EndDrawing(); //---------------------------------------------------------------------------------- |
