| 14 | #include "raylib-cpp.hpp" |
| 15 | |
| 16 | int main() { |
| 17 | // Initialization |
| 18 | //-------------------------------------------------------------------------------------- |
| 19 | int screenWidth = 800; |
| 20 | int screenHeight = 450; |
| 21 | |
| 22 | raylib::Window window(screenWidth, screenHeight, "raylib [textures] example - image loading"); |
| 23 | raylib::Texture texture("resources/raylib_logo.png"); |
| 24 | raylib::Color textColor = raylib::Color::LightGray(); |
| 25 | |
| 26 | // Main game loop |
| 27 | while (!window.ShouldClose()) { // Detect window close button or ESC key |
| 28 | // Update |
| 29 | //---------------------------------------------------------------------------------- |
| 30 | // Update your variables here |
| 31 | //---------------------------------------------------------------------------------- |
| 32 | |
| 33 | // Draw |
| 34 | //---------------------------------------------------------------------------------- |
| 35 | BeginDrawing(); |
| 36 | { |
| 37 | window.ClearBackground(raylib::Color::RayWhite()); |
| 38 | |
| 39 | texture.Draw(screenWidth / 2 - texture.GetWidth() / 2, screenHeight / 2 - texture.GetHeight() / 2); |
| 40 | |
| 41 | textColor.DrawText("this IS a texture loaded from an image!", 300, 370, 10); |
| 42 | } |
| 43 | EndDrawing(); |
| 44 | //---------------------------------------------------------------------------------- |
| 45 | } |
| 46 | |
| 47 | return 0; |
| 48 | } |