1 /// This module defines basic types from Raylib with local modifications to make them easier to use. 2 module raylib_types; 3 4 import raylib; 5 6 // Vector2 type 7 struct Vector2 8 { 9 float x = 0.0f; 10 float y = 0.0f; 11 mixin Linear; 12 } 13 14 // Vector3 type 15 struct Vector3 16 { 17 float x = 0.0f; 18 float y = 0.0f; 19 float z = 0.0f; 20 mixin Linear; 21 } 22 23 // Vector4 type 24 struct Vector4 25 { 26 float x = 0.0f; 27 float y = 0.0f; 28 float z = 0.0f; 29 float w = 0.0f; 30 mixin Linear; 31 } 32 33 // Quaternion type, same as Vector4 34 alias Quaternion = Vector4; 35 36 // Matrix type (OpenGL style 4x4 - right handed, column major) 37 struct Matrix 38 { 39 float m0 = 0.0f; 40 float m4 = 0.0f; 41 float m8 = 0.0f; 42 float m12 = 0.0f; 43 float m1 = 0.0f; 44 float m5 = 0.0f; 45 float m9 = 0.0f; 46 float m13 = 0.0f; 47 float m2 = 0.0f; 48 float m6 = 0.0f; 49 float m10 = 0.0f; 50 float m14 = 0.0f; 51 float m3 = 0.0f; 52 float m7 = 0.0f; 53 float m11 = 0.0f; 54 float m15 = 0.0f; 55 } 56 57 // Rectangle type 58 struct Rectangle 59 { 60 float x; 61 float y; 62 float width; 63 float height; 64 alias w = width; 65 alias h = height; 66 } 67 68 enum Colors 69 { 70 // Some Basic Colors 71 // NOTE: Custom raylib color palette for amazing visuals on WHITE background 72 LIGHTGRAY = Color(200, 200, 200, 255), // Light Gray 73 GRAY = Color(130, 130, 130, 255), // Gray 74 DARKGRAY = Color(80, 80, 80, 255), // Dark Gray 75 YELLOW = Color(253, 249, 0, 255), // Yellow 76 GOLD = Color(255, 203, 0, 255), // Gold 77 ORANGE = Color(255, 161, 0, 255), // Orange 78 PINK = Color(255, 109, 194, 255), // Pink 79 RED = Color(230, 41, 55, 255), // Red 80 MAROON = Color(190, 33, 55, 255), // Maroon 81 GREEN = Color(0, 228, 48, 255), // Green 82 LIME = Color(0, 158, 47, 255), // Lime 83 DARKGREEN = Color(0, 117, 44, 255), // Dark Green 84 SKYBLUE = Color(102, 191, 255, 255), // Sky Blue 85 BLUE = Color(0, 121, 241, 255), // Blue 86 DARKBLUE = Color(0, 82, 172, 255), // Dark Blue 87 PURPLE = Color(200, 122, 255, 255), // Purple 88 VIOLET = Color(135, 60, 190, 255), // Violet 89 DARKPURPLE = Color(112, 31, 126, 255), // Dark Purple 90 BEIGE = Color(211, 176, 131, 255), // Beige 91 BROWN = Color(127, 106, 79, 255), // Brown 92 DARKBROWN = Color(76, 63, 47, 255), // Dark Brown 93 94 WHITE = Color(255, 255, 255, 255), // White 95 BLACK = Color(0, 0, 0, 255), // Black 96 BLANK = Color(0, 0, 0, 0), // Blank (Transparent) 97 MAGENTA = Color(255, 0, 255, 255), // Magenta 98 RAYWHITE = Color(245, 245, 245, 255), // My own White (raylib logo) 99 }