MCPcopy Create free account
hub / github.com/RobLoach/raylib-cpp / main

Function main

examples/textures/textures_image_loading.cpp:16–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14#include "raylib-cpp.hpp"
15
16int 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}

Callers

nothing calls this directly

Calls 7

LightGrayFunction · 0.85
RayWhiteFunction · 0.85
ShouldCloseMethod · 0.80
GetWidthMethod · 0.80
GetHeightMethod · 0.80
DrawTextMethod · 0.80
DrawMethod · 0.45

Tested by

no test coverage detected