aboutsummaryrefslogtreecommitdiff
path: root/examples/models_billboard.c
diff options
context:
space:
mode:
authorRay <raysan5@gmail.com>2015-08-31 01:16:34 +0200
committerRay <raysan5@gmail.com>2015-08-31 01:16:34 +0200
commit60194753d7b8abcdec3df2a502ccd29a1076bb7c (patch)
tree47df863966fee50bd3a10d195c3f8274b4ed5ee6 /examples/models_billboard.c
parent3a9ed0e8462570e30d92e2aa8c0ff3cf655ef863 (diff)
parent808aeabf4c2ab0828e4f7806b75d95dc1b5ab212 (diff)
downloadraylib-60194753d7b8abcdec3df2a502ccd29a1076bb7c.tar.gz
raylib-60194753d7b8abcdec3df2a502ccd29a1076bb7c.zip
Merge pull request #26 from raysan5/develop
Develop branch integration
Diffstat (limited to 'examples/models_billboard.c')
-rw-r--r--examples/models_billboard.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/examples/models_billboard.c b/examples/models_billboard.c
index a58ec7d7..05d836ca 100644
--- a/examples/models_billboard.c
+++ b/examples/models_billboard.c
@@ -2,10 +2,10 @@
*
* raylib [models] example - Drawing billboards
*
-* This example has been created using raylib 1.2 (www.raylib.com)
+* This example has been created using raylib 1.3 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
-* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
+* Copyright (c) 2015 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
@@ -21,24 +21,24 @@ int main()
InitWindow(screenWidth, screenHeight, "raylib [models] example - drawing billboards");
// Define the camera to look into our 3d world
- Camera camera = {{ 10.0, 8.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }};
+ Camera camera = {{ 5.0, 4.0, 5.0 }, { 0.0, 2.0, 0.0 }, { 0.0, 1.0, 0.0 }};
- Texture2D lena = LoadTexture("resources/lena.png"); // Our texture for billboard
- Rectangle eyesRec = { 225, 240, 155, 50 }; // Part of the texture to draw
- Vector3 billPosition = { 0.0, 0.0, 0.0 }; // Position where draw billboard
+ Texture2D bill = LoadTexture("resources/billboard.png"); // Our texture billboard
+ Vector3 billPosition = { 0.0, 2.0, 0.0 }; // Position where draw billboard
+
+ SetCameraMode(CAMERA_ORBITAL); // Set an orbital camera mode
+ SetCameraPosition(camera.position); // Set internal camera position to match our camera position
+ SetCameraTarget(camera.target); // Set internal camera target to match our camera target
- SetTargetFPS(60); // Set our game to run at 60 frames-per-second
+ SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
- while (!WindowShouldClose()) // Detect window close button or ESC key
+ while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
- if (IsKeyDown(KEY_LEFT)) camera.position.x -= 0.2;
- if (IsKeyDown(KEY_RIGHT)) camera.position.x += 0.2;
- if (IsKeyDown(KEY_UP)) camera.position.y -= 0.2;
- if (IsKeyDown(KEY_DOWN)) camera.position.y += 0.2;
+ UpdateCamera(&camera); // Update internal camera and our camera
//----------------------------------------------------------------------------------
// Draw
@@ -49,8 +49,7 @@ int main()
Begin3dMode(camera);
- //DrawBillboard(camera, lena, billPosition, 1.0, WHITE);
- DrawBillboardRec(camera, lena, eyesRec, billPosition, 4.0, WHITE);
+ DrawBillboard(camera, bill, billPosition, 2.0f, WHITE);
DrawGrid(10.0, 1.0); // Draw a grid
@@ -64,7 +63,7 @@ int main()
// De-Initialization
//--------------------------------------------------------------------------------------
- UnloadTexture(lena); // Unload texture
+ UnloadTexture(bill); // Unload texture
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------