1 module bindbc.raylib.types;
2 
3 import bindbc.raylib.config;
4 import core.stdc.config;
5 import core.stdc.stdarg;
6 import core.stdc.stdlib;
7 
8 //extern (C) @nogc nothrow:
9 
10 enum NULL = 0;
11 enum PI = 3.14159265358979323846f;
12 
13 enum DEG2RAD = PI / 180.0f;
14 enum RAD2DEG = 180.0f / PI;
15 
16 enum MAX_TOUCH_POINTS = 10; // Maximum number of touch points supported
17 
18 // Shader and material limits
19 enum MAX_SHADER_LOCATIONS = 32; // Maximum number of predefined locations stored in shader struct
20 enum MAX_MATERIAL_MAPS = 12; // Maximum number of texture maps stored in shader struct
21 
22 // Allow custom memory allocators
23 
24 alias RL_MALLOC = malloc;
25 
26 alias RL_CALLOC = calloc;
27 
28 alias RL_FREE = free;
29 struct Color {
30    ubyte r;
31    ubyte g;
32    ubyte b;
33    ubyte a;
34 }
35 
36 struct Point {
37    int x;
38    int y;
39 }
40 
41 struct Size {
42    uint width;
43    uint height;
44 }
45 
46 struct Vector2 {
47    float x;
48    float y;
49 }
50 
51 struct Vector3 {
52    float x;
53    float y;
54    float z;
55 }
56 
57 struct Vector4 {
58    float x;
59    float y;
60    float z;
61    float w;
62 }
63 
64 // Quaternion type, same as Vector4
65 alias Quaternion = Vector4;
66 
67 // Matrix type (OpenGL style 4x4 - right handed, column major)
68 struct Matrix {
69    float m0;
70    float m4;
71    float m8;
72    float m12;
73    float m1;
74    float m5;
75    float m9;
76    float m13;
77    float m2;
78    float m6;
79    float m10;
80    float m14;
81    float m3;
82    float m7;
83    float m11;
84    float m15;
85 }
86 
87 struct Rectangle {
88    /**
89     * Top right angle x coordinate
90     */
91    float x;
92    /**
93     * Top right angle y coordinate
94     */
95    float y;
96    float width;
97    float height;
98 }
99 
100 // Image type, bpp always RGBA (32bit)
101 // NOTE: Data stored in CPU memory (RAM)
102 struct Image {
103    void* data; // Image raw data
104    int width; // Image base width
105    int height; // Image base height
106    int mipmaps; // Mipmap levels, 1 by default
107    int format; // Data format (PixelFormat type)
108 }
109 
110 // Texture2D type
111 // NOTE: Data stored in GPU memory
112 struct Texture2D {
113    uint id; // OpenGL texture id
114    int width; // Texture base width
115    int height; // Texture base height
116    int mipmaps; // Mipmap levels, 1 by default
117    int format; // Data format (PixelFormat type)
118 }
119 
120 // Texture type, same as Texture2D
121 alias Texture = Texture2D;
122 
123 // TextureCubemap type, actually, same as Texture2D
124 alias TextureCubemap = Texture2D;
125 
126 // RenderTexture2D type, for texture rendering
127 struct RenderTexture2D {
128    uint id; // OpenGL Framebuffer Object (FBO) id
129    Texture2D texture; // Color buffer attachment texture
130    Texture2D depth; // Depth buffer attachment texture
131    bool depthTexture; // Track if depth attachment is a texture or renderbuffer
132 }
133 
134 // RenderTexture type, same as RenderTexture2D
135 alias RenderTexture = RenderTexture2D;
136 
137 // N-Patch layout info
138 struct NPatchInfo {
139    Rectangle sourceRec; // Region in the texture
140    int left; // left border offset
141    int top; // top border offset
142    int right; // right border offset
143    int bottom; // bottom border offset
144    int type; // layout of the n-patch: 3x3, 1x3 or 3x1
145 }
146 
147 
148 static if (raylibSupport >= RaylibSupport.raylib300) {
149    struct CharInfo {
150       int value;              // Character value (Unicode)
151       int offsetX;            // Character offset X when drawing
152       int offsetY;            // Character offset Y when drawing
153       int advanceX;           // Character advance position X
154       Image image;            // Character image data
155    }
156 } else  {
157    // Font character info
158    struct CharInfo {
159       int value; // Character value (Unicode)
160       Rectangle rec; // Character rectangle in sprite font
161       int offsetX; // Character offset X when drawing
162       int offsetY; // Character offset Y when drawing
163       int advanceX; // Character advance position X
164       ubyte* data; // Character pixel data (grayscale)
165    }
166 }
167 
168 // Font type, includes texture and charSet array data
169 static if (raylibSupport >= RaylibSupport.raylib260) {
170    struct Font {
171       int baseSize;           // Base size (default chars height)
172       int charsCount;         // Number of characters
173       Texture2D texture;      // Characters texture atlas
174       Rectangle *recs;        // Characters rectangles in texture
175       CharInfo *chars;        // Characters info data
176    }
177 } else {
178    struct Font {
179       Texture2D texture; // Font texture
180       int baseSize; // Base size (default chars height)
181       int charsCount; // Number of characters
182       CharInfo* chars; // Characters info data
183    }
184 }
185 alias SpriteFont = Font; // SpriteFont type fallback, defaults to Font
186 
187 // Camera type, defines a camera position/orientation in 3d space
188 struct Camera3D {
189    Vector3 position; // Camera position
190    Vector3 target; // Camera target it looks-at
191    Vector3 up; // Camera up vector (rotation over its axis)
192    float fovy; // Camera field-of-view apperture in Y (degrees) in perspective, used as near plane width in orthographic
193    int type; // Camera type, defines projection type: CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC
194 }
195 
196 alias Camera = Camera3D; // Camera type fallback, defaults to Camera3D
197 
198 // Camera2D type, defines a 2d camera
199 struct Camera2D {
200    Vector2 offset; // Camera offset (displacement from target)
201    Vector2 target; // Camera target (rotation and zoom origin)
202    float rotation; // Camera rotation in degrees
203    float zoom; // Camera zoom (scaling), should be 1.0f by default
204 }
205 
206 // Vertex data definning a mesh
207 // NOTE: Data stored in CPU memory (and GPU)
208 
209 struct Mesh {
210    int vertexCount; // Number of vertices stored in arrays
211    int triangleCount; // Number of triangles stored (indexed or not)
212 
213    // Default vertex data
214    float* vertices; // Vertex position (XYZ - 3 components per vertex) (shader-location = 0)
215    float* texcoords; // Vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1)
216    float* texcoords2; // Vertex second texture coordinates (useful for lightmaps) (shader-location = 5)
217    float* normals; // Vertex normals (XYZ - 3 components per vertex) (shader-location = 2)
218    float* tangents; // Vertex tangents (XYZW - 4 components per vertex) (shader-location = 4)
219    ubyte* colors; // Vertex colors (RGBA - 4 components per vertex) (shader-location = 3)
220    ushort* indices; // Vertex indices (in case vertex data comes indexed)
221 
222    // Animation vertex data
223    float* animVertices; // Animated vertex positions (after bones transformations)
224    float* animNormals; // Animated normals (after bones transformations)
225    int* boneIds; // Vertex bone ids, up to 4 bones influence by vertex (skinning)
226    float* boneWeights; // Vertex bone weight, up to 4 bones influence by vertex (skinning)
227 
228    // OpenGL identifiers
229    uint vaoId; // OpenGL Vertex Array Object id
230    uint[7] vboId; // OpenGL Vertex Buffer Objects id (default vertex data)
231 }
232 
233 // Shader type (generic)
234 struct Shader {
235    uint id; // Shader program id
236    int[MAX_SHADER_LOCATIONS] locs; // Shader locations array
237 }
238 
239 // Material texture map
240 struct MaterialMap {
241    Texture2D texture; // Material map texture
242    Color color; // Material map color
243    float value; // Material map value
244 }
245 
246 // Material type (generic)
247 struct Material {
248    Shader shader; // Material shader
249    MaterialMap[MAX_MATERIAL_MAPS] maps; // Material maps
250    float* params; // Material generic parameters (if required)
251 }
252 
253 // Transformation properties
254 struct Transform {
255    Vector3 translation; // Translation
256    Quaternion rotation; // Rotation
257    Vector3 scale; // Scale
258 }
259 
260 // Bone information
261 struct BoneInfo {
262    char[32] name; // Bone name
263    int parent; // Bone parent
264 }
265 
266 // Model type
267 struct Model {
268    Matrix transform; // Local transform matrix
269 
270    int meshCount; // Number of meshes
271    Mesh* meshes; // Meshes array
272 
273    int materialCount; // Number of materials
274    Material* materials; // Materials array
275    int* meshMaterial; // Mesh material number
276 
277    // Animation data
278    int boneCount; // Number of bones
279    BoneInfo* bones; // Bones information (skeleton)
280    Transform* bindPose; // Bones base transformation (pose)
281 }
282 
283 // Model animation
284 struct ModelAnimation {
285    int boneCount; // Number of bones
286    BoneInfo* bones; // Bones information (skeleton)
287 
288    int frameCount; // Number of animation frames
289    Transform** framePoses; // Poses array by frame
290 }
291 
292 // Ray type (useful for raycast)
293 struct Ray {
294    Vector3 position; // Ray position (origin)
295    Vector3 direction; // Ray direction
296 }
297 
298 // Raycast hit information
299 struct RayHitInfo {
300    bool hit; // Did the ray hit something?
301    float distance; // Distance to nearest hit
302    Vector3 position; // Position of nearest hit
303    Vector3 normal; // Surface normal of hit
304 }
305 
306 // Bounding box type
307 struct BoundingBox {
308    Vector3 min; // Minimum vertex box-corner
309    Vector3 max; // Maximum vertex box-corner
310 }
311 
312 // Wave type, defines audio wave data
313 struct Wave {
314    uint sampleCount; // Number of samples
315    uint sampleRate; // Frequency (samples per second)
316    uint sampleSize; // Bit depth (bits per sample): 8, 16, 32 (24 not supported)
317    uint channels; // Number of channels (1-mono, 2-stereo)
318    void* data; // Buffer data pointer
319 }
320 
321 // Sound source type
322 struct Sound {
323    void* audioBuffer; // Pointer to internal data used by the audio system
324 
325    uint source; // Audio source id
326    uint buffer; // Audio buffer id
327    int format; // Audio format specifier
328 }
329 
330 // FIX: changend in reaylib 3..
331 // Music type (file streaming from memory)
332 // NOTE: Anything longer than ~10 seconds should be streamed
333 struct MusicData;
334 alias Music = MusicData*;
335 
336 // FIX: changend in reaylib 3..
337 
338 // Audio stream type
339 // NOTE: Useful to create custom audio streams not bound to a specific file
340 struct AudioStream {
341    uint sampleRate; // Frequency (samples per second)
342    uint sampleSize; // Bit depth (bits per sample): 8, 16, 32 (24 not supported)
343    uint channels; // Number of channels (1-mono, 2-stereo)
344 
345    void* audioBuffer; // Pointer to internal data used by the audio system.
346 
347    int format; // Audio format specifier
348    uint source; // Audio source id
349    uint[2] buffers; // Audio buffers (double buffering)
350 }
351 
352 // Head-Mounted-Display device parameters
353 struct VrDeviceInfo {
354    int hResolution; // HMD horizontal resolution in pixels
355    int vResolution; // HMD vertical resolution in pixels
356    float hScreenSize; // HMD horizontal size in meters
357    float vScreenSize; // HMD vertical size in meters
358    float vScreenCenter; // HMD screen center in meters
359    float eyeToScreenDistance; // HMD distance between eye and display in meters
360    float lensSeparationDistance; // HMD lens separation distance in meters
361    float interpupillaryDistance; // HMD IPD (distance between pupils) in meters
362    float[4] lensDistortionValues; // HMD lens distortion constant parameters
363    float[4] chromaAbCorrection; // HMD chromatic aberration correction parameters
364 }
365 
366 //----------------------------------------------------------------------------------
367 // Enumerators Definition
368 //----------------------------------------------------------------------------------
369 // System config flags
370 // NOTE: Used for bit masks
371 enum ConfigFlag {
372    FLAG_RESERVED = 1, // Reserved
373    FLAG_FULLSCREEN_MODE = 2, // Set to run program in fullscreen
374    FLAG_WINDOW_RESIZABLE = 4, // Set to allow resizable window
375    FLAG_WINDOW_UNDECORATED = 8, // Set to disable window decoration (frame and buttons)
376    FLAG_WINDOW_TRANSPARENT = 16, // Set to allow transparent window
377    FLAG_WINDOW_HIDDEN = 128, // Set to create the window initially hidden
378    FLAG_WINDOW_ALWAYS_RUN = 256, // Set to allow windows running while minimized
379    FLAG_MSAA_4X_HINT = 32, // Set to try enabling MSAA 4X
380    FLAG_VSYNC_HINT = 64 // Set to try enabling V-Sync on GPU
381 }
382 
383 // Trace log type
384 enum TraceLogType {
385    LOG_ALL = 0, // Display all logs
386    LOG_TRACE = 1,
387    LOG_DEBUG = 2,
388    LOG_INFO = 3,
389    LOG_WARNING = 4,
390    LOG_ERROR = 5,
391    LOG_FATAL = 6,
392    LOG_NONE = 7 // Disable logging
393 }
394 
395 // Keyboard keys
396 enum KeyboardKey {
397    // Alphanumeric keys
398    KEY_APOSTROPHE = 39,
399    KEY_COMMA = 44,
400    KEY_MINUS = 45,
401    KEY_PERIOD = 46,
402    KEY_SLASH = 47,
403    KEY_ZERO = 48,
404    KEY_ONE = 49,
405    KEY_TWO = 50,
406    KEY_THREE = 51,
407    KEY_FOUR = 52,
408    KEY_FIVE = 53,
409    KEY_SIX = 54,
410    KEY_SEVEN = 55,
411    KEY_EIGHT = 56,
412    KEY_NINE = 57,
413    KEY_SEMICOLON = 59,
414    KEY_EQUAL = 61,
415    KEY_A = 65,
416    KEY_B = 66,
417    KEY_C = 67,
418    KEY_D = 68,
419    KEY_E = 69,
420    KEY_F = 70,
421    KEY_G = 71,
422    KEY_H = 72,
423    KEY_I = 73,
424    KEY_J = 74,
425    KEY_K = 75,
426    KEY_L = 76,
427    KEY_M = 77,
428    KEY_N = 78,
429    KEY_O = 79,
430    KEY_P = 80,
431    KEY_Q = 81,
432    KEY_R = 82,
433    KEY_S = 83,
434    KEY_T = 84,
435    KEY_U = 85,
436    KEY_V = 86,
437    KEY_W = 87,
438    KEY_X = 88,
439    KEY_Y = 89,
440    KEY_Z = 90,
441 
442    // Function keys
443    KEY_SPACE = 32,
444    KEY_ESCAPE = 256,
445    KEY_ENTER = 257,
446    KEY_TAB = 258,
447    KEY_BACKSPACE = 259,
448    KEY_INSERT = 260,
449    KEY_DELETE = 261,
450    KEY_RIGHT = 262,
451    KEY_LEFT = 263,
452    KEY_DOWN = 264,
453    KEY_UP = 265,
454    KEY_PAGE_UP = 266,
455    KEY_PAGE_DOWN = 267,
456    KEY_HOME = 268,
457    KEY_END = 269,
458    KEY_CAPS_LOCK = 280,
459    KEY_SCROLL_LOCK = 281,
460    KEY_NUM_LOCK = 282,
461    KEY_PRINT_SCREEN = 283,
462    KEY_PAUSE = 284,
463    KEY_F1 = 290,
464    KEY_F2 = 291,
465    KEY_F3 = 292,
466    KEY_F4 = 293,
467    KEY_F5 = 294,
468    KEY_F6 = 295,
469    KEY_F7 = 296,
470    KEY_F8 = 297,
471    KEY_F9 = 298,
472    KEY_F10 = 299,
473    KEY_F11 = 300,
474    KEY_F12 = 301,
475    KEY_LEFT_SHIFT = 340,
476    KEY_LEFT_CONTROL = 341,
477    KEY_LEFT_ALT = 342,
478    KEY_LEFT_SUPER = 343,
479    KEY_RIGHT_SHIFT = 344,
480    KEY_RIGHT_CONTROL = 345,
481    KEY_RIGHT_ALT = 346,
482    KEY_RIGHT_SUPER = 347,
483    KEY_KB_MENU = 348,
484    KEY_LEFT_BRACKET = 91,
485    KEY_BACKSLASH = 92,
486    KEY_RIGHT_BRACKET = 93,
487    KEY_GRAVE = 96,
488 
489    // Keypad keys
490    KEY_KP_0 = 320,
491    KEY_KP_1 = 321,
492    KEY_KP_2 = 322,
493    KEY_KP_3 = 323,
494    KEY_KP_4 = 324,
495    KEY_KP_5 = 325,
496    KEY_KP_6 = 326,
497    KEY_KP_7 = 327,
498    KEY_KP_8 = 328,
499    KEY_KP_9 = 329,
500    KEY_KP_DECIMAL = 330,
501    KEY_KP_DIVIDE = 331,
502    KEY_KP_MULTIPLY = 332,
503    KEY_KP_SUBTRACT = 333,
504    KEY_KP_ADD = 334,
505    KEY_KP_ENTER = 335,
506    KEY_KP_EQUAL = 336
507 }
508 
509 // Android buttons
510 enum AndroidButton {
511    KEY_BACK = 4,
512    KEY_MENU = 82,
513    KEY_VOLUME_UP = 24,
514    KEY_VOLUME_DOWN = 25
515 }
516 
517 // Mouse buttons
518 enum MouseButton {
519    MOUSE_LEFT_BUTTON = 0,
520    MOUSE_RIGHT_BUTTON = 1,
521    MOUSE_MIDDLE_BUTTON = 2
522 }
523 
524 // Gamepad number
525 enum GamepadNumber {
526    GAMEPAD_PLAYER1 = 0,
527    GAMEPAD_PLAYER2 = 1,
528    GAMEPAD_PLAYER3 = 2,
529    GAMEPAD_PLAYER4 = 3
530 }
531 
532 // Gamepad Buttons
533 enum GamepadButton {
534    // This is here just for error checking
535    GAMEPAD_BUTTON_UNKNOWN = 0,
536 
537    // This is normally [A,B,X,Y]/[Circle,Triangle,Square,Cross]
538    // No support for 6 button controllers though..
539    GAMEPAD_BUTTON_LEFT_FACE_UP = 1,
540    GAMEPAD_BUTTON_LEFT_FACE_RIGHT = 2,
541    GAMEPAD_BUTTON_LEFT_FACE_DOWN = 3,
542    GAMEPAD_BUTTON_LEFT_FACE_LEFT = 4,
543 
544    // This is normally a DPAD
545    GAMEPAD_BUTTON_RIGHT_FACE_UP = 5,
546    GAMEPAD_BUTTON_RIGHT_FACE_RIGHT = 6,
547    GAMEPAD_BUTTON_RIGHT_FACE_DOWN = 7,
548    GAMEPAD_BUTTON_RIGHT_FACE_LEFT = 8,
549 
550    // Triggers
551    GAMEPAD_BUTTON_LEFT_TRIGGER_1 = 9,
552    GAMEPAD_BUTTON_LEFT_TRIGGER_2 = 10,
553    GAMEPAD_BUTTON_RIGHT_TRIGGER_1 = 11,
554    GAMEPAD_BUTTON_RIGHT_TRIGGER_2 = 12,
555 
556    // These are buttons in the center of the gamepad
557    GAMEPAD_BUTTON_MIDDLE_LEFT = 13, //PS3 Select
558    GAMEPAD_BUTTON_MIDDLE = 14, //PS Button/XBOX Button
559    GAMEPAD_BUTTON_MIDDLE_RIGHT = 15, //PS3 Start
560 
561    // These are the joystick press in buttons
562    GAMEPAD_BUTTON_LEFT_THUMB = 16,
563    GAMEPAD_BUTTON_RIGHT_THUMB = 17
564 }
565 
566 enum GamepadAxis {
567    // This is here just for error checking
568    GAMEPAD_AXIS_UNKNOWN = 0,
569 
570    // Left stick
571    GAMEPAD_AXIS_LEFT_X = 1,
572    GAMEPAD_AXIS_LEFT_Y = 2,
573 
574    // Right stick
575    GAMEPAD_AXIS_RIGHT_X = 3,
576    GAMEPAD_AXIS_RIGHT_Y = 4,
577 
578    // Pressure levels for the back triggers
579    GAMEPAD_AXIS_LEFT_TRIGGER = 5, // [1..-1] (pressure-level)
580    GAMEPAD_AXIS_RIGHT_TRIGGER = 6 // [1..-1] (pressure-level)
581 }
582 
583 // Shader location point type
584 enum ShaderLocationIndex {
585    LOC_VERTEX_POSITION = 0,
586    LOC_VERTEX_TEXCOORD01 = 1,
587    LOC_VERTEX_TEXCOORD02 = 2,
588    LOC_VERTEX_NORMAL = 3,
589    LOC_VERTEX_TANGENT = 4,
590    LOC_VERTEX_COLOR = 5,
591    LOC_MATRIX_MVP = 6,
592    LOC_MATRIX_MODEL = 7,
593    LOC_MATRIX_VIEW = 8,
594    LOC_MATRIX_PROJECTION = 9,
595    LOC_VECTOR_VIEW = 10,
596    LOC_COLOR_DIFFUSE = 11,
597    LOC_COLOR_SPECULAR = 12,
598    LOC_COLOR_AMBIENT = 13,
599    LOC_MAP_ALBEDO = 14, // LOC_MAP_DIFFUSE
600    LOC_MAP_METALNESS = 15, // LOC_MAP_SPECULAR
601    LOC_MAP_NORMAL = 16,
602    LOC_MAP_ROUGHNESS = 17,
603    LOC_MAP_OCCLUSION = 18,
604    LOC_MAP_EMISSION = 19,
605    LOC_MAP_HEIGHT = 20,
606    LOC_MAP_CUBEMAP = 21,
607    LOC_MAP_IRRADIANCE = 22,
608    LOC_MAP_PREFILTER = 23,
609    LOC_MAP_BRDF = 24
610 }
611 
612 enum LOC_MAP_DIFFUSE = ShaderLocationIndex.LOC_MAP_ALBEDO;
613 enum LOC_MAP_SPECULAR = ShaderLocationIndex.LOC_MAP_METALNESS;
614 
615 // Shader uniform data types
616 enum ShaderUniformDataType {
617    UNIFORM_FLOAT = 0,
618    UNIFORM_VEC2 = 1,
619    UNIFORM_VEC3 = 2,
620    UNIFORM_VEC4 = 3,
621    UNIFORM_INT = 4,
622    UNIFORM_IVEC2 = 5,
623    UNIFORM_IVEC3 = 6,
624    UNIFORM_IVEC4 = 7,
625    UNIFORM_SAMPLER2D = 8
626 }
627 
628 // Material map type
629 enum MaterialMapType {
630    MAP_ALBEDO = 0, // MAP_DIFFUSE
631    MAP_METALNESS = 1, // MAP_SPECULAR
632    MAP_NORMAL = 2,
633    MAP_ROUGHNESS = 3,
634    MAP_OCCLUSION = 4,
635    MAP_EMISSION = 5,
636    MAP_HEIGHT = 6,
637    MAP_CUBEMAP = 7, // NOTE: Uses GL_TEXTURE_CUBE_MAP
638    MAP_IRRADIANCE = 8, // NOTE: Uses GL_TEXTURE_CUBE_MAP
639    MAP_PREFILTER = 9, // NOTE: Uses GL_TEXTURE_CUBE_MAP
640    MAP_BRDF = 10
641 }
642 
643 enum MAP_DIFFUSE = MaterialMapType.MAP_ALBEDO;
644 enum MAP_SPECULAR = MaterialMapType.MAP_METALNESS;
645 
646 // Pixel formats
647 // NOTE: Support depends on OpenGL version and platform
648 enum PixelFormat {
649    UNCOMPRESSED_GRAYSCALE = 1, // 8 bit per pixel (no alpha)
650    UNCOMPRESSED_GRAY_ALPHA = 2, // 8*2 bpp (2 channels)
651    UNCOMPRESSED_R5G6B5 = 3, // 16 bpp
652    UNCOMPRESSED_R8G8B8 = 4, // 24 bpp
653    UNCOMPRESSED_R5G5B5A1 = 5, // 16 bpp (1 bit alpha)
654    UNCOMPRESSED_R4G4B4A4 = 6, // 16 bpp (4 bit alpha)
655    UNCOMPRESSED_R8G8B8A8 = 7, // 32 bpp
656    UNCOMPRESSED_R32 = 8, // 32 bpp (1 channel - float)
657    UNCOMPRESSED_R32G32B32 = 9, // 32*3 bpp (3 channels - float)
658    UNCOMPRESSED_R32G32B32A32 = 10, // 32*4 bpp (4 channels - float)
659    COMPRESSED_DXT1_RGB = 11, // 4 bpp (no alpha)
660    COMPRESSED_DXT1_RGBA = 12, // 4 bpp (1 bit alpha)
661    COMPRESSED_DXT3_RGBA = 13, // 8 bpp
662    COMPRESSED_DXT5_RGBA = 14, // 8 bpp
663    COMPRESSED_ETC1_RGB = 15, // 4 bpp
664    COMPRESSED_ETC2_RGB = 16, // 4 bpp
665    COMPRESSED_ETC2_EAC_RGBA = 17, // 8 bpp
666    COMPRESSED_PVRT_RGB = 18, // 4 bpp
667    COMPRESSED_PVRT_RGBA = 19, // 4 bpp
668    COMPRESSED_ASTC_4x4_RGBA = 20, // 8 bpp
669    COMPRESSED_ASTC_8x8_RGBA = 21 // 2 bpp
670 }
671 
672 // Texture parameters: filter mode
673 // NOTE 1: Filtering considers mipmaps if available in the texture
674 // NOTE 2: Filter is accordingly set for minification and magnification
675 enum TextureFilterMode {
676    FILTER_POINT = 0, // No filter, just pixel aproximation
677    FILTER_BILINEAR = 1, // Linear filtering
678    FILTER_TRILINEAR = 2, // Trilinear filtering (linear with mipmaps)
679    FILTER_ANISOTROPIC_4X = 3, // Anisotropic filtering 4x
680    FILTER_ANISOTROPIC_8X = 4, // Anisotropic filtering 8x
681    FILTER_ANISOTROPIC_16X = 5 // Anisotropic filtering 16x
682 }
683 
684 // Cubemap layout type
685 enum CubemapLayoutType {
686    CUBEMAP_AUTO_DETECT = 0, // Automatically detect layout type
687    CUBEMAP_LINE_VERTICAL = 1, // Layout is defined by a vertical line with faces
688    CUBEMAP_LINE_HORIZONTAL = 2, // Layout is defined by an horizontal line with faces
689    CUBEMAP_CROSS_THREE_BY_FOUR = 3, // Layout is defined by a 3x4 cross with cubemap faces
690    CUBEMAP_CROSS_FOUR_BY_THREE = 4, // Layout is defined by a 4x3 cross with cubemap faces
691    CUBEMAP_PANORAMA = 5 // Layout is defined by a panorama image (equirectangular map)
692 }
693 
694 // Texture parameters: wrap mode
695 enum TextureWrapMode {
696    WRAP_REPEAT = 0, // Repeats texture in tiled mode
697    WRAP_CLAMP = 1, // Clamps texture to edge pixel in tiled mode
698    WRAP_MIRROR_REPEAT = 2, // Mirrors and repeats the texture in tiled mode
699    WRAP_MIRROR_CLAMP = 3 // Mirrors and clamps to border the texture in tiled mode
700 }
701 
702 // Font type, defines generation method
703 enum FontType {
704    FONT_DEFAULT = 0, // Default font generation, anti-aliased
705    FONT_BITMAP = 1, // Bitmap font generation, no anti-aliasing
706    FONT_SDF = 2 // SDF font generation, requires external shader
707 }
708 
709 // Color blending modes (pre-defined)
710 enum BlendMode {
711    BLEND_ALPHA = 0, // Blend textures considering alpha (default)
712    BLEND_ADDITIVE = 1, // Blend textures adding colors
713    BLEND_MULTIPLIED = 2 // Blend textures multiplying colors
714 }
715 
716 // Gestures type
717 // NOTE: It could be used as flags to enable only some gestures
718 enum GestureType {
719    GESTURE_NONE = 0,
720    GESTURE_TAP = 1,
721    GESTURE_DOUBLETAP = 2,
722    GESTURE_HOLD = 4,
723    GESTURE_DRAG = 8,
724    GESTURE_SWIPE_RIGHT = 16,
725    GESTURE_SWIPE_LEFT = 32,
726    GESTURE_SWIPE_UP = 64,
727    GESTURE_SWIPE_DOWN = 128,
728    GESTURE_PINCH_IN = 256,
729    GESTURE_PINCH_OUT = 512
730 }
731 
732 // Camera system modes
733 enum CameraMode {
734    CAMERA_CUSTOM = 0,
735    CAMERA_FREE = 1,
736    CAMERA_ORBITAL = 2,
737    CAMERA_FIRST_PERSON = 3,
738    CAMERA_THIRD_PERSON = 4
739 }
740 
741 // Camera projection modes
742 enum CameraType {
743    CAMERA_PERSPECTIVE = 0,
744    CAMERA_ORTHOGRAPHIC = 1
745 }
746 
747 // Type of n-patch
748 enum NPatchType {
749    NPT_9PATCH = 0, // Npatch defined by 3x3 tiles
750    NPT_3PATCH_VERTICAL = 1, // Npatch defined by 1x3 tiles
751    NPT_3PATCH_HORIZONTAL = 2 // Npatch defined by 3x1 tiles
752 }
753 
754 // raygui
755 //
756 /// Place enums into the global space.  Example: Allows usage of both KeyboardKey.KEY_RIGHT and KEY_RIGHT.
757 private string _enum(E...)() {
758    import std.format : formattedWrite;
759    import std.traits : EnumMembers;
760    import std.array : appender;
761 
762    auto writer = appender!string;
763    static foreach (T; E) {
764       static foreach (member; EnumMembers!T) {
765          writer.formattedWrite("alias %s = " ~ T.stringof ~ ".%s;\n", member, member);
766       }
767    }
768    return writer.data;
769 }
770 
771 mixin(_enum!(GuiControlState, GuiTextAlignment, GuiControl, GuiControlProperty, GuiDefaultProperty, GuiToggleProperty, GuiSliderProperty, GuiCheckBoxProperty,
772          GuiComboBoxProperty, GuiDropdownBoxProperty, GuiTextBoxProperty, GuiSpinnerProperty, GuiScrollBarProperty,
773          GuiScrollBarSide, GuiListViewProperty, GuiColorPickerProperty));
774 
775 /**
776  *Number of standard controls
777  */
778 enum NUM_CONTROLS = 16;
779 /**
780  *Number of standard properties
781  */
782 enum NUM_PROPS_DEFAULT = 16;
783 /**
784  *Number of extended properties
785  */
786 enum NUM_PROPS_EXTENDED = 8;
787 /**
788  *Text edit controls cursor blink timming
789  */
790 enum TEXTEDIT_CURSOR_BLINK_FRAMES = 20;
791 
792 // Style property
793 struct GuiStyleProp {
794    ushort controlId;
795    ushort propertyId;
796    int propertyValue;
797 }
798 
799 /// Gui control state
800 enum GuiControlState {
801    GUI_STATE_NORMAL = 0,
802    GUI_STATE_FOCUSED = 1,
803    GUI_STATE_PRESSED = 2,
804    GUI_STATE_DISABLED = 3
805 }
806 
807 /// Gui control text alignment
808 enum GuiTextAlignment {
809    GUI_TEXT_ALIGN_LEFT = 0,
810    GUI_TEXT_ALIGN_CENTER = 1,
811    GUI_TEXT_ALIGN_RIGHT = 2
812 }
813 
814 /// Gui controls
815 enum GuiControl {
816    DEFAULT = 0,
817    LABEL = 1, // LABELBUTTON
818    BUTTON = 2, // IMAGEBUTTON
819    TOGGLE = 3, // TOGGLEGROUP
820    SLIDER = 4, // SLIDERBAR
821    PROGRESSBAR = 5,
822    CHECKBOX = 6,
823    COMBOBOX = 7,
824    DROPDOWNBOX = 8,
825    TEXTBOX = 9, // TEXTBOXMULTI
826    VALUEBOX = 10,
827    SPINNER = 11,
828    LISTVIEW = 12,
829    COLORPICKER = 13,
830    SCROLLBAR = 14,
831    RESERVED = 15
832 }
833 
834 /// Gui base properties for every control
835 enum GuiControlProperty {
836    BORDER_COLOR_NORMAL = 0,
837    BASE_COLOR_NORMAL = 1,
838    TEXT_COLOR_NORMAL = 2,
839    BORDER_COLOR_FOCUSED = 3,
840    BASE_COLOR_FOCUSED = 4,
841    TEXT_COLOR_FOCUSED = 5,
842    BORDER_COLOR_PRESSED = 6,
843    BASE_COLOR_PRESSED = 7,
844    TEXT_COLOR_PRESSED = 8,
845    BORDER_COLOR_DISABLED = 9,
846    BASE_COLOR_DISABLED = 10,
847    TEXT_COLOR_DISABLED = 11,
848    BORDER_WIDTH = 12,
849    INNER_PADDING = 13,
850    TEXT_ALIGNMENT = 14,
851    RESERVED02 = 15
852 }
853 
854 // Gui extended properties depend on control
855 // NOTE: We reserve a fixed size of additional properties per control
856 /// DEFAULT properties
857 enum GuiDefaultProperty {
858    TEXT_SIZE = 16,
859    TEXT_SPACING = 17,
860    LINE_COLOR = 18,
861    BACKGROUND_COLOR = 19
862 }
863 
864 /// Toggle / ToggleGroup
865 enum GuiToggleProperty {
866    GROUP_PADDING = 16
867 }
868 
869 /// Slider / SliderBar
870 enum GuiSliderProperty {
871    SLIDER_WIDTH = 16,
872    TEXT_PADDING = 17
873 }
874 
875 /// CheckBox
876 enum GuiCheckBoxProperty {
877    CHECK_TEXT_PADDING = 16
878 }
879 
880 /// ComboBox
881 enum GuiComboBoxProperty {
882    SELECTOR_WIDTH = 16,
883    SELECTOR_PADDING = 17
884 }
885 
886 /// DropdownBox
887 enum GuiDropdownBoxProperty {
888    ARROW_RIGHT_PADDING = 16
889 }
890 
891 /// TextBox / TextBoxMulti / ValueBox / Spinner
892 enum GuiTextBoxProperty {
893    MULTILINE_PADDING = 16,
894    COLOR_SELECTED_FG = 17,
895    COLOR_SELECTED_BG = 18
896 }
897 
898 enum GuiSpinnerProperty {
899    SELECT_BUTTON_WIDTH = 16,
900    SELECT_BUTTON_PADDING = 17,
901    SELECT_BUTTON_BORDER_WIDTH = 18
902 }
903 
904 /// ScrollBar
905 enum GuiScrollBarProperty {
906    ARROWS_SIZE = 16,
907    SLIDER_PADDING = 17,
908    SLIDER_SIZE = 18,
909    SCROLL_SPEED = 19,
910    SHOW_SPINNER_BUTTONS = 20
911 }
912 
913 /// ScrollBar side
914 enum GuiScrollBarSide {
915    SCROLLBAR_LEFT_SIDE = 0,
916    SCROLLBAR_RIGHT_SIDE = 1
917 }
918 
919 /// ListView
920 enum GuiListViewProperty {
921    ELEMENTS_HEIGHT = 16,
922    ELEMENTS_PADDING = 17,
923    SCROLLBAR_WIDTH = 18,
924    SCROLLBAR_SIDE = 19 // This property defines vertical scrollbar side (SCROLLBAR_LEFT_SIDE or SCROLLBAR_RIGHT_SIDE)
925 }
926 
927 /// ColorPicker
928 enum GuiColorPickerProperty {
929    COLOR_SELECTOR_SIZE = 16,
930    BAR_WIDTH = 17, // Lateral bar width
931    BAR_PADDING = 18, // Lateral bar separation from panel
932    BAR_SELECTOR_HEIGHT = 19, // Lateral bar selector height
933    BAR_SELECTOR_PADDING = 20 // Lateral bar selector outer padding
934 }