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

Function main

tests/raylib_cpp_test.cpp:6–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4#include <vector>
5
6int main(int argc, char* argv[]) {
7 TraceLog(LOG_INFO, "---------------------");
8 TraceLog(LOG_INFO, "TEST: raylib-cpp test");
9
10 // Get a path to where the executable is so file loading is relative.
11 std::string path = "";
12 if (argc > 0) {
13 path = GetDirectoryPath(argv[0]);
14 }
15
16 // Vector
17 {
18 raylib::Vector2 position(50, 100);
19 AssertEqual(position.GetX(), position.x);
20 position.x = 150;
21 AssertEqual(position.GetX(), 150);
22 position.SetX(300);
23 AssertEqual(position.GetX(), 300);
24
25 raylib::Vector2 speed(10, 10);
26 position += speed;
27 AssertEqual(position.x, 310);
28 AssertEqual(raylib::Window::IsReady(), false);
29
30 raylib::Vector2 size{50, 100};
31 raylib::Vector2 halfsize = size / 2.0f;
32
33 AssertEqual(size.x, 50);
34 AssertEqual(size.y, 100);
35 AssertEqual(halfsize.x, 25);
36 AssertEqual(halfsize.y, 50);
37
38 raylib::Vector2 doublesize = size * 2.0f;
39 AssertEqual(size.x, 50);
40 AssertEqual(doublesize.x, 100);
41
42 const raylib::Vector2 zero2d;
43 AssertEqual(zero2d.x, 0);
44 AssertEqual(zero2d.y, 0);
45
46 const raylib::Vector3 zero3d;
47 AssertEqual(zero3d.x, 0);
48 AssertEqual(zero3d.y, 0);
49 AssertEqual(zero3d.z, 0);
50
51 const raylib::Vector4 zero4d;
52 AssertEqual(zero4d.x, 0);
53 AssertEqual(zero4d.y, 0);
54 AssertEqual(zero4d.z, 0);
55 AssertEqual(zero4d.w, 0);
56 }
57
58 // Color
59 {
60 raylib::Color color = RED;
61 AssertEqual(color.ToInt(), ::ColorToInt(RED));
62 color = RAYWHITE;
63 ::Color raylibColor = RAYWHITE;

Callers

nothing calls this directly

Calls 8

IsKeyPressedFunction · 0.85
ToIntMethod · 0.80
RotateMethod · 0.80
GetWidthMethod · 0.80
GetHeightMethod · 0.80
TraceLogMethod · 0.80
IsValidMethod · 0.45
ToStringMethod · 0.45

Tested by

no test coverage detected