| 12 | #include "raylib-cpp.hpp" |
| 13 | |
| 14 | int main() { |
| 15 | // Initialization |
| 16 | //-------------------------------------------------------------------------------------- |
| 17 | const int screenWidth = 800; |
| 18 | const int screenHeight = 450; |
| 19 | |
| 20 | raylib::Window window(screenWidth, screenHeight, "raylib [models] example - drawing billboards"); |
| 21 | |
| 22 | // Define the camera to look into our 3d world |
| 23 | raylib::Camera camera( |
| 24 | raylib::Vector3(5.0f, 4.0f, 5.0f), |
| 25 | raylib::Vector3(0.0f, 2.0f, 0.0f), |
| 26 | raylib::Vector3(0.0f, 1.0f, 0.0f), |
| 27 | 45.0f, |
| 28 | CAMERA_PERSPECTIVE); |
| 29 | |
| 30 | raylib::Texture2D bill("resources/billboard.png"); // Our texture billboard |
| 31 | raylib::Vector3 billPosition(0.0f, 2.0f, 0.0f); // Position where draw billboard |
| 32 | |
| 33 | SetTargetFPS(60); // Set our game to run at 60 frames-per-second |
| 34 | //-------------------------------------------------------------------------------------- |
| 35 | |
| 36 | // Main game loop |
| 37 | while (!window.ShouldClose()) { // Detect window close button or ESC key |
| 38 | // Update |
| 39 | //---------------------------------------------------------------------------------- |
| 40 | camera.Update(CAMERA_ORBITAL); // Update camera |
| 41 | //---------------------------------------------------------------------------------- |
| 42 | |
| 43 | // Draw |
| 44 | //---------------------------------------------------------------------------------- |
| 45 | BeginDrawing(); |
| 46 | { |
| 47 | window.ClearBackground(RAYWHITE); |
| 48 | |
| 49 | camera.BeginMode(); |
| 50 | { |
| 51 | DrawGrid(10, 1.0f); // Draw a grid |
| 52 | bill.DrawBillboard(camera, billPosition, 2.0f); |
| 53 | } |
| 54 | camera.EndMode(); |
| 55 | |
| 56 | DrawFPS(10, 10); |
| 57 | } |
| 58 | EndDrawing(); |
| 59 | //---------------------------------------------------------------------------------- |
| 60 | } |
| 61 | |
| 62 | return 0; |
| 63 | } |
nothing calls this directly
no test coverage detected