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