1 module raygui; 2 3 /******************************************************************************************* 4 * 5 * raygui v2.8 - A simple and easy-to-use immediate-mode gui library 6 * 7 * DESCRIPTION: 8 * 9 * raygui is a tools-dev-focused immediate-mode-gui library based on raylib but also 10 * available as a standalone library, as long as input and drawing functions are provided. 11 * 12 * Controls provided: 13 * 14 * # Container/separators Controls 15 * - WindowBox 16 * - GroupBox 17 * - Line 18 * - Panel 19 * 20 * # Basic Controls 21 * - Label 22 * - Button 23 * - LabelButton --> Label 24 * - ImageButton --> Button 25 * - ImageButtonEx --> Button 26 * - Toggle 27 * - ToggleGroup --> Toggle 28 * - CheckBox 29 * - ComboBox 30 * - DropdownBox 31 * - TextBox 32 * - TextBoxMulti 33 * - ValueBox --> TextBox 34 * - Spinner --> Button, ValueBox 35 * - Slider 36 * - SliderBar --> Slider 37 * - ProgressBar 38 * - StatusBar 39 * - ScrollBar 40 * - ScrollPanel 41 * - DummyRec 42 * - Grid 43 * 44 * # Advance Controls 45 * - ListView 46 * - ColorPicker --> ColorPanel, ColorBarHue 47 * - MessageBox --> Window, Label, Button 48 * - TextInputBox --> Window, Label, TextBox, Button 49 * 50 * It also provides a set of functions for styling the controls based on its properties (size, color). 51 * 52 * CONFIGURATION: 53 * 54 * #define RAYGUI_IMPLEMENTATION 55 * Generates the implementation of the library into the included file. 56 * If not defined, the library is in header only mode and can be included in other headers 57 * or source files without problems. But only ONE file should hold the implementation. 58 * 59 * #define RAYGUI_STATIC (defined by default) 60 * The generated implementation will stay private inside implementation file and all 61 * internal symbols and functions will only be visible inside that file. 62 * 63 * #define RAYGUI_STANDALONE 64 * Avoid raylib.h header inclusion in this file. Data types defined on raylib are defined 65 * internally in the library and input management and drawing functions must be provided by 66 * the user (check library implementation for further details). 67 * 68 * #define RAYGUI_SUPPORT_ICONS 69 * Includes riconsdata.h header defining a set of 128 icons (binary format) to be used on 70 * multiple controls and following raygui styles 71 * 72 * 73 * VERSIONS HISTORY: 74 * 2.8 (03-May-2020) Centralized rectangles drawing to GuiDrawRectangle() 75 * 2.7 (20-Feb-2020) Added possible tooltips API 76 * 2.6 (09-Sep-2019) ADDED: GuiTextInputBox() 77 * REDESIGNED: GuiListView*(), GuiDropdownBox(), GuiSlider*(), GuiProgressBar(), GuiMessageBox() 78 * REVIEWED: GuiTextBox(), GuiSpinner(), GuiValueBox(), GuiLoadStyle() 79 * Replaced property INNER_PADDING by TEXT_PADDING, renamed some properties 80 * Added 8 new custom styles ready to use 81 * Multiple minor tweaks and bugs corrected 82 * 2.5 (28-May-2019) Implemented extended GuiTextBox(), GuiValueBox(), GuiSpinner() 83 * 2.3 (29-Apr-2019) Added rIcons auxiliar library and support for it, multiple controls reviewed 84 * Refactor all controls drawing mechanism to use control state 85 * 2.2 (05-Feb-2019) Added GuiScrollBar(), GuiScrollPanel(), reviewed GuiListView(), removed Gui*Ex() controls 86 * 2.1 (26-Dec-2018) Redesign of GuiCheckBox(), GuiComboBox(), GuiDropdownBox(), GuiToggleGroup() > Use combined text string 87 * Complete redesign of style system (breaking change) 88 * 2.0 (08-Nov-2018) Support controls guiLock and custom fonts, reviewed GuiComboBox(), GuiListView()... 89 * 1.9 (09-Oct-2018) Controls review: GuiGrid(), GuiTextBox(), GuiTextBoxMulti(), GuiValueBox()... 90 * 1.8 (01-May-2018) Lot of rework and redesign to align with rGuiStyler and rGuiLayout 91 * 1.5 (21-Jun-2017) Working in an improved styles system 92 * 1.4 (15-Jun-2017) Rewritten all GUI functions (removed useless ones) 93 * 1.3 (12-Jun-2017) Redesigned styles system 94 * 1.1 (01-Jun-2017) Complete review of the library 95 * 1.0 (07-Jun-2016) Converted to header-only by Ramon Santamaria. 96 * 0.9 (07-Mar-2016) Reviewed and tested by Albert Martos, Ian Eito, Sergio Martinez and Ramon Santamaria. 97 * 0.8 (27-Aug-2015) Initial release. Implemented by Kevin Gato, Daniel Nicolás and Ramon Santamaria. 98 * 99 * CONTRIBUTORS: 100 * Ramon Santamaria: Supervision, review, redesign, update and maintenance... 101 * Vlad Adrian: Complete rewrite of GuiTextBox() to support extended features (2019) 102 * Sergio Martinez: Review, testing (2015) and redesign of multiple controls (2018) 103 * Adria Arranz: Testing and Implementation of additional controls (2018) 104 * Jordi Jorba: Testing and Implementation of additional controls (2018) 105 * Albert Martos: Review and testing of the library (2015) 106 * Ian Eito: Review and testing of the library (2015) 107 * Kevin Gato: Initial implementation of basic components (2014) 108 * Daniel Nicolas: Initial implementation of basic components (2014) 109 * 110 * 111 * LICENSE: zlib/libpng 112 * 113 * Copyright (c) 2014-2020 Ramon Santamaria (@raysan5) 114 * 115 * This software is provided "as-is", without any express or implied warranty. In no event 116 * will the authors be held liable for any damages arising from the use of this software. 117 * 118 * Permission is granted to anyone to use this software for any purpose, including commercial 119 * applications, and to alter it and redistribute it freely, subject to the following restrictions: 120 * 121 * 1. The origin of this software must not be misrepresented; you must not claim that you 122 * wrote the original software. If you use this software in a product, an acknowledgment 123 * in the product documentation would be appreciated but is not required. 124 * 125 * 2. Altered source versions must be plainly marked as such, and must not be misrepresented 126 * as being the original software. 127 * 128 * 3. This notice may not be removed or altered from any source distribution. 129 * 130 **********************************************************************************************/ 131 132 import raylib; 133 134 extern (C) @nogc nothrow: 135 136 enum RAYGUI_VERSION = "3.0"; 137 138 // Function specifiers in case library is build/used as a shared library (Windows) 139 // NOTE: Microsoft specifiers to tell compiler that symbols are imported/exported from a .dll 140 141 // We are building the library as a Win32 shared library (.dll) 142 143 // We are using the library as a Win32 shared library (.dll) 144 145 // Function specifiers definition // Functions defined as 'extern' by default (implicit specifiers) 146 147 //---------------------------------------------------------------------------------- 148 // Defines and Macros 149 //---------------------------------------------------------------------------------- 150 151 // TODO: Implement custom TraceLog() 152 153 //---------------------------------------------------------------------------------- 154 // Types and Structures Definition 155 // NOTE: Some types are required for RAYGUI_STANDALONE usage 156 //---------------------------------------------------------------------------------- 157 158 // Boolean type 159 160 // Vector2 type 161 162 // Vector3 type // -- ConvertHSVtoRGB(), ConvertRGBtoHSV() 163 164 // Color type, RGBA (32bit) 165 166 // Rectangle type 167 168 // TODO: Texture2D type is very coupled to raylib, required by Font type 169 // It should be redesigned to be provided by user 170 171 // OpenGL texture id 172 // Texture base width 173 // Texture base height 174 // Mipmap levels, 1 by default 175 // Data format (PixelFormat type) 176 177 // GlyphInfo, font characters glyphs info 178 179 // Character value (Unicode) 180 // Character offset X when drawing 181 // Character offset Y when drawing 182 // Character advance position X 183 // Character image data 184 185 // TODO: Font type is very coupled to raylib, mostly required by GuiLoadStyle() 186 // It should be redesigned to be provided by user 187 188 // Base size (default chars height) 189 // Number of characters 190 // Characters texture atlas 191 // Characters rectangles in texture 192 // Characters info data 193 194 // Style property 195 struct GuiStyleProp 196 { 197 ushort controlId; 198 ushort propertyId; 199 int propertyValue; 200 } 201 202 // Gui control state 203 enum GuiControlState 204 { 205 GUI_STATE_NORMAL = 0, 206 GUI_STATE_FOCUSED = 1, 207 GUI_STATE_PRESSED = 2, 208 GUI_STATE_DISABLED = 3 209 } 210 211 // Gui control text alignment 212 enum GuiTextAlignment 213 { 214 GUI_TEXT_ALIGN_LEFT = 0, 215 GUI_TEXT_ALIGN_CENTER = 1, 216 GUI_TEXT_ALIGN_RIGHT = 2 217 } 218 219 // Gui controls 220 enum GuiControl 221 { 222 DEFAULT = 0, // Generic control -> populates to all controls when set 223 LABEL = 1, // Used also for: LABELBUTTON 224 BUTTON = 2, 225 TOGGLE = 3, // Used also for: TOGGLEGROUP 226 SLIDER = 4, // Used also for: SLIDERBAR 227 PROGRESSBAR = 5, 228 CHECKBOX = 6, 229 COMBOBOX = 7, 230 DROPDOWNBOX = 8, 231 TEXTBOX = 9, // Used also for: TEXTBOXMULTI 232 VALUEBOX = 10, 233 SPINNER = 11, 234 LISTVIEW = 12, 235 COLORPICKER = 13, 236 SCROLLBAR = 14, 237 STATUSBAR = 15 238 } 239 240 // Gui base properties for every control 241 // NOTE: RAYGUI_MAX_PROPS_BASE properties (by default 16 properties) 242 enum GuiControlProperty 243 { 244 BORDER_COLOR_NORMAL = 0, 245 BASE_COLOR_NORMAL = 1, 246 TEXT_COLOR_NORMAL = 2, 247 BORDER_COLOR_FOCUSED = 3, 248 BASE_COLOR_FOCUSED = 4, 249 TEXT_COLOR_FOCUSED = 5, 250 BORDER_COLOR_PRESSED = 6, 251 BASE_COLOR_PRESSED = 7, 252 TEXT_COLOR_PRESSED = 8, 253 BORDER_COLOR_DISABLED = 9, 254 BASE_COLOR_DISABLED = 10, 255 TEXT_COLOR_DISABLED = 11, 256 BORDER_WIDTH = 12, 257 TEXT_PADDING = 13, 258 TEXT_ALIGNMENT = 14, 259 RESERVED = 15 260 } 261 262 // Gui extended properties depend on control 263 // NOTE: RAYGUI_MAX_PROPS_EXTENDED properties (by default 8 properties) 264 265 // DEFAULT extended properties 266 // NOTE: Those properties are actually common to all controls 267 enum GuiDefaultProperty 268 { 269 TEXT_SIZE = 16, 270 TEXT_SPACING = 17, 271 LINE_COLOR = 18, 272 BACKGROUND_COLOR = 19 273 } 274 275 // Label 276 //typedef enum { } GuiLabelProperty; 277 278 // Button 279 //typedef enum { } GuiButtonProperty; 280 281 // Toggle/ToggleGroup 282 enum GuiToggleProperty 283 { 284 GROUP_PADDING = 16 285 } 286 287 // Slider/SliderBar 288 enum GuiSliderProperty 289 { 290 SLIDER_WIDTH = 16, 291 SLIDER_PADDING = 17 292 } 293 294 // ProgressBar 295 enum GuiProgressBarProperty 296 { 297 PROGRESS_PADDING = 16 298 } 299 300 // CheckBox 301 enum GuiCheckBoxProperty 302 { 303 CHECK_PADDING = 16 304 } 305 306 // ComboBox 307 enum GuiComboBoxProperty 308 { 309 COMBO_BUTTON_WIDTH = 16, 310 COMBO_BUTTON_PADDING = 17 311 } 312 313 // DropdownBox 314 enum GuiDropdownBoxProperty 315 { 316 ARROW_PADDING = 16, 317 DROPDOWN_ITEMS_PADDING = 17 318 } 319 320 // TextBox/TextBoxMulti/ValueBox/Spinner 321 enum GuiTextBoxProperty 322 { 323 TEXT_INNER_PADDING = 16, 324 TEXT_LINES_PADDING = 17, 325 COLOR_SELECTED_FG = 18, 326 COLOR_SELECTED_BG = 19 327 } 328 329 // Spinner 330 enum GuiSpinnerProperty 331 { 332 SPIN_BUTTON_WIDTH = 16, 333 SPIN_BUTTON_PADDING = 17 334 } 335 336 // ScrollBar 337 enum GuiScrollBarProperty 338 { 339 ARROWS_SIZE = 16, 340 ARROWS_VISIBLE = 17, 341 SCROLL_SLIDER_PADDING = 18, 342 SCROLL_SLIDER_SIZE = 19, 343 SCROLL_PADDING = 20, 344 SCROLL_SPEED = 21 345 } 346 347 // ScrollBar side 348 enum GuiScrollBarSide 349 { 350 SCROLLBAR_LEFT_SIDE = 0, 351 SCROLLBAR_RIGHT_SIDE = 1 352 } 353 354 // ListView 355 enum GuiListViewProperty 356 { 357 LIST_ITEMS_HEIGHT = 16, 358 LIST_ITEMS_PADDING = 17, 359 SCROLLBAR_WIDTH = 18, 360 SCROLLBAR_SIDE = 19 361 } 362 363 // ColorPicker 364 enum GuiColorPickerProperty 365 { 366 COLOR_SELECTOR_SIZE = 16, 367 HUEBAR_WIDTH = 17, // Right hue bar width 368 HUEBAR_PADDING = 18, // Right hue bar separation from panel 369 HUEBAR_SELECTOR_HEIGHT = 19, // Right hue bar selector height 370 HUEBAR_SELECTOR_OVERFLOW = 20 // Right hue bar selector overflow 371 } 372 373 //---------------------------------------------------------------------------------- 374 // Global Variables Definition 375 //---------------------------------------------------------------------------------- 376 // ... 377 378 //---------------------------------------------------------------------------------- 379 // Module Functions Declaration 380 //---------------------------------------------------------------------------------- 381 382 // Prevents name mangling of functions 383 384 // Global gui state control functions 385 void GuiEnable (); // Enable gui controls (global state) 386 void GuiDisable (); // Disable gui controls (global state) 387 void GuiLock (); // Lock gui controls (global state) 388 void GuiUnlock (); // Unlock gui controls (global state) 389 bool GuiIsLocked (); // Check if gui is locked (global state) 390 void GuiFade (float alpha); // Set gui controls alpha (global state), alpha goes from 0.0f to 1.0f 391 void GuiSetState (int state); // Set gui state (global state) 392 int GuiGetState (); // Get gui state (global state) 393 394 // Font set/get functions 395 void GuiSetFont (Font font); // Set gui custom font (global state) 396 Font GuiGetFont (); // Get gui custom font (global state) 397 398 // Style set/get functions 399 void GuiSetStyle (int control, int property, int value); // Set one style property 400 int GuiGetStyle (int control, int property); // Get one style property 401 402 // Container/separator controls, useful for controls organization 403 bool GuiWindowBox (Rectangle bounds, const(char)* title); // Window Box control, shows a window that can be closed 404 void GuiGroupBox (Rectangle bounds, const(char)* text); // Group Box control with text name 405 void GuiLine (Rectangle bounds, const(char)* text); // Line separator control, could contain text 406 void GuiPanel (Rectangle bounds); // Panel control, useful to group controls 407 Rectangle GuiScrollPanel (Rectangle bounds, Rectangle content, Vector2* scroll); // Scroll Panel control 408 409 // Basic controls set 410 void GuiLabel (Rectangle bounds, const(char)* text); // Label control, shows text 411 bool GuiButton (Rectangle bounds, const(char)* text); // Button control, returns true when clicked 412 bool GuiLabelButton (Rectangle bounds, const(char)* text); // Label button control, show true when clicked 413 bool GuiToggle (Rectangle bounds, const(char)* text, bool active); // Toggle Button control, returns true when active 414 int GuiToggleGroup (Rectangle bounds, const(char)* text, int active); // Toggle Group control, returns active toggle index 415 bool GuiCheckBox (Rectangle bounds, const(char)* text, bool checked); // Check Box control, returns true when active 416 int GuiComboBox (Rectangle bounds, const(char)* text, int active); // Combo Box control, returns selected item index 417 bool GuiDropdownBox (Rectangle bounds, const(char)* text, int* active, bool editMode); // Dropdown Box control, returns selected item 418 bool GuiSpinner (Rectangle bounds, const(char)* text, int* value, int minValue, int maxValue, bool editMode); // Spinner control, returns selected value 419 bool GuiValueBox (Rectangle bounds, const(char)* text, int* value, int minValue, int maxValue, bool editMode); // Value Box control, updates input text with numbers 420 bool GuiTextBox (Rectangle bounds, char* text, int textSize, bool editMode); // Text Box control, updates input text 421 bool GuiTextBoxMulti (Rectangle bounds, char* text, int textSize, bool editMode); // Text Box control with multiple lines 422 float GuiSlider (Rectangle bounds, const(char)* textLeft, const(char)* textRight, float value, float minValue, float maxValue); // Slider control, returns selected value 423 float GuiSliderBar (Rectangle bounds, const(char)* textLeft, const(char)* textRight, float value, float minValue, float maxValue); // Slider Bar control, returns selected value 424 float GuiProgressBar (Rectangle bounds, const(char)* textLeft, const(char)* textRight, float value, float minValue, float maxValue); // Progress Bar control, shows current progress value 425 void GuiStatusBar (Rectangle bounds, const(char)* text); // Status Bar control, shows info text 426 void GuiDummyRec (Rectangle bounds, const(char)* text); // Dummy control for placeholders 427 int GuiScrollBar (Rectangle bounds, int value, int minValue, int maxValue); // Scroll Bar control 428 Vector2 GuiGrid (Rectangle bounds, float spacing, int subdivs); // Grid control 429 430 // Advance controls set 431 int GuiListView (Rectangle bounds, const(char)* text, int* scrollIndex, int active); // List View control, returns selected list item index 432 int GuiListViewEx (Rectangle bounds, const(char*)* text, int count, int* focus, int* scrollIndex, int active); // List View with extended parameters 433 int GuiMessageBox (Rectangle bounds, const(char)* title, const(char)* message, const(char)* buttons); // Message Box control, displays a message 434 int GuiTextInputBox (Rectangle bounds, const(char)* title, const(char)* message, const(char)* buttons, char* text); // Text Input Box control, ask for text 435 Color GuiColorPicker (Rectangle bounds, Color color); // Color Picker control (multiple color controls) 436 Color GuiColorPanel (Rectangle bounds, Color color); // Color Panel control 437 float GuiColorBarAlpha (Rectangle bounds, float alpha); // Color Bar Alpha control 438 float GuiColorBarHue (Rectangle bounds, float value); // Color Bar Hue control 439 440 // Styles loading functions 441 void GuiLoadStyle (const(char)* fileName); // Load style file over global style variable (.rgs) 442 void GuiLoadStyleDefault (); // Load style default over global style 443 444 /* 445 typedef GuiStyle (unsigned int *) 446 RAYGUIAPI GuiStyle LoadGuiStyle(const char *fileName); // Load style from file (.rgs) 447 RAYGUIAPI void UnloadGuiStyle(GuiStyle style); // Unload style 448 */ 449 450 const(char)* GuiIconText (int iconId, const(char)* text); // Get text with icon id prepended (if supported) 451 452 // Gui icons functionality 453 void GuiDrawIcon (int iconId, int posX, int posY, int pixelSize, Color color); 454 455 uint* GuiGetIcons (); // Get full icons data pointer 456 uint* GuiGetIconData (int iconId); // Get icon bit data 457 void GuiSetIconData (int iconId, uint* data); // Set icon bit data 458 459 void GuiSetIconPixel (int iconId, int x, int y); // Set icon pixel value 460 void GuiClearIconPixel (int iconId, int x, int y); // Clear icon pixel value 461 bool GuiCheckIconPixel (int iconId, int x, int y); // Check icon pixel value 462 463 // Prevents name mangling of functions 464 465 // RAYGUI_H 466 467 /*********************************************************************************** 468 * 469 * RAYGUI IMPLEMENTATION 470 * 471 ************************************************************************************/ 472 473 // Required for: FILE, fopen(), fclose(), fprintf(), feof(), fscanf(), vsprintf() [GuiLoadStyle(), GuiLoadIcons()] 474 // Required for: malloc(), calloc(), free() [GuiLoadStyle(), GuiLoadIcons()] 475 // Required for: strlen() [GuiTextBox(), GuiTextBoxMulti(), GuiValueBox()], memset(), memcpy() 476 // Required for: va_list, va_start(), vfprintf(), va_end() [TextFormat()] 477 // Required for: roundf() [GuiColorPicker()] 478 479 // External icons data provided, it can be generated with rGuiIcons tool 480 481 // Embedded raygui icons, no external file provided 482 483 // Size of icons (squared) 484 // Maximum number of icons 485 // Maximum length of icon name id 486 487 // Icons data is defined by bit array (every bit represents one pixel) 488 // Those arrays are stored as unsigned int data arrays, so every array 489 // element defines 32 pixels (bits) of information 490 // Number of elemens depend on RICON_SIZE (by default 16x16 pixels) 491 492 //---------------------------------------------------------------------------------- 493 // Icons enumeration 494 //---------------------------------------------------------------------------------- 495 496 enum GuiIconName { 497 RICON_NONE = 0, 498 RICON_FOLDER_FILE_OPEN = 1, 499 RICON_FILE_SAVE_CLASSIC = 2, 500 RICON_FOLDER_OPEN = 3, 501 RICON_FOLDER_SAVE = 4, 502 RICON_FILE_OPEN = 5, 503 RICON_FILE_SAVE = 6, 504 RICON_FILE_EXPORT = 7, 505 RICON_FILE_NEW = 8, 506 RICON_FILE_DELETE = 9, 507 RICON_FILETYPE_TEXT = 10, 508 RICON_FILETYPE_AUDIO = 11, 509 RICON_FILETYPE_IMAGE = 12, 510 RICON_FILETYPE_PLAY = 13, 511 RICON_FILETYPE_VIDEO = 14, 512 RICON_FILETYPE_INFO = 15, 513 RICON_FILE_COPY = 16, 514 RICON_FILE_CUT = 17, 515 RICON_FILE_PASTE = 18, 516 RICON_CURSOR_HAND = 19, 517 RICON_CURSOR_POINTER = 20, 518 RICON_CURSOR_CLASSIC = 21, 519 RICON_PENCIL = 22, 520 RICON_PENCIL_BIG = 23, 521 RICON_BRUSH_CLASSIC = 24, 522 RICON_BRUSH_PAINTER = 25, 523 RICON_WATER_DROP = 26, 524 RICON_COLOR_PICKER = 27, 525 RICON_RUBBER = 28, 526 RICON_COLOR_BUCKET = 29, 527 RICON_TEXT_T = 30, 528 RICON_TEXT_A = 31, 529 RICON_SCALE = 32, 530 RICON_RESIZE = 33, 531 RICON_FILTER_POINT = 34, 532 RICON_FILTER_BILINEAR = 35, 533 RICON_CROP = 36, 534 RICON_CROP_ALPHA = 37, 535 RICON_SQUARE_TOGGLE = 38, 536 RICON_SYMMETRY = 39, 537 RICON_SYMMETRY_HORIZONTAL = 40, 538 RICON_SYMMETRY_VERTICAL = 41, 539 RICON_LENS = 42, 540 RICON_LENS_BIG = 43, 541 RICON_EYE_ON = 44, 542 RICON_EYE_OFF = 45, 543 RICON_FILTER_TOP = 46, 544 RICON_FILTER = 47, 545 RICON_TARGET_POINT = 48, 546 RICON_TARGET_SMALL = 49, 547 RICON_TARGET_BIG = 50, 548 RICON_TARGET_MOVE = 51, 549 RICON_CURSOR_MOVE = 52, 550 RICON_CURSOR_SCALE = 53, 551 RICON_CURSOR_SCALE_RIGHT = 54, 552 RICON_CURSOR_SCALE_LEFT = 55, 553 RICON_UNDO = 56, 554 RICON_REDO = 57, 555 RICON_REREDO = 58, 556 RICON_MUTATE = 59, 557 RICON_ROTATE = 60, 558 RICON_REPEAT = 61, 559 RICON_SHUFFLE = 62, 560 RICON_EMPTYBOX = 63, 561 RICON_TARGET = 64, 562 RICON_TARGET_SMALL_FILL = 65, 563 RICON_TARGET_BIG_FILL = 66, 564 RICON_TARGET_MOVE_FILL = 67, 565 RICON_CURSOR_MOVE_FILL = 68, 566 RICON_CURSOR_SCALE_FILL = 69, 567 RICON_CURSOR_SCALE_RIGHT_FILL = 70, 568 RICON_CURSOR_SCALE_LEFT_FILL = 71, 569 RICON_UNDO_FILL = 72, 570 RICON_REDO_FILL = 73, 571 RICON_REREDO_FILL = 74, 572 RICON_MUTATE_FILL = 75, 573 RICON_ROTATE_FILL = 76, 574 RICON_REPEAT_FILL = 77, 575 RICON_SHUFFLE_FILL = 78, 576 RICON_EMPTYBOX_SMALL = 79, 577 RICON_BOX = 80, 578 RICON_BOX_TOP = 81, 579 RICON_BOX_TOP_RIGHT = 82, 580 RICON_BOX_RIGHT = 83, 581 RICON_BOX_BOTTOM_RIGHT = 84, 582 RICON_BOX_BOTTOM = 85, 583 RICON_BOX_BOTTOM_LEFT = 86, 584 RICON_BOX_LEFT = 87, 585 RICON_BOX_TOP_LEFT = 88, 586 RICON_BOX_CENTER = 89, 587 RICON_BOX_CIRCLE_MASK = 90, 588 RICON_POT = 91, 589 RICON_ALPHA_MULTIPLY = 92, 590 RICON_ALPHA_CLEAR = 93, 591 RICON_DITHERING = 94, 592 RICON_MIPMAPS = 95, 593 RICON_BOX_GRID = 96, 594 RICON_GRID = 97, 595 RICON_BOX_CORNERS_SMALL = 98, 596 RICON_BOX_CORNERS_BIG = 99, 597 RICON_FOUR_BOXES = 100, 598 RICON_GRID_FILL = 101, 599 RICON_BOX_MULTISIZE = 102, 600 RICON_ZOOM_SMALL = 103, 601 RICON_ZOOM_MEDIUM = 104, 602 RICON_ZOOM_BIG = 105, 603 RICON_ZOOM_ALL = 106, 604 RICON_ZOOM_CENTER = 107, 605 RICON_BOX_DOTS_SMALL = 108, 606 RICON_BOX_DOTS_BIG = 109, 607 RICON_BOX_CONCENTRIC = 110, 608 RICON_BOX_GRID_BIG = 111, 609 RICON_OK_TICK = 112, 610 RICON_CROSS = 113, 611 RICON_ARROW_LEFT = 114, 612 RICON_ARROW_RIGHT = 115, 613 RICON_ARROW_DOWN = 116, 614 RICON_ARROW_UP = 117, 615 RICON_ARROW_LEFT_FILL = 118, 616 RICON_ARROW_RIGHT_FILL = 119, 617 RICON_ARROW_DOWN_FILL = 120, 618 RICON_ARROW_UP_FILL = 121, 619 RICON_AUDIO = 122, 620 RICON_FX = 123, 621 RICON_WAVE = 124, 622 RICON_WAVE_SINUS = 125, 623 RICON_WAVE_SQUARE = 126, 624 RICON_WAVE_TRIANGULAR = 127, 625 RICON_CROSS_SMALL = 128, 626 RICON_PLAYER_PREVIOUS = 129, 627 RICON_PLAYER_PLAY_BACK = 130, 628 RICON_PLAYER_PLAY = 131, 629 RICON_PLAYER_PAUSE = 132, 630 RICON_PLAYER_STOP = 133, 631 RICON_PLAYER_NEXT = 134, 632 RICON_PLAYER_RECORD = 135, 633 RICON_MAGNET = 136, 634 RICON_LOCK_CLOSE = 137, 635 RICON_LOCK_OPEN = 138, 636 RICON_CLOCK = 139, 637 RICON_TOOLS = 140, 638 RICON_GEAR = 141, 639 RICON_GEAR_BIG = 142, 640 RICON_BIN = 143, 641 RICON_HAND_POINTER = 144, 642 RICON_LASER = 145, 643 RICON_COIN = 146, 644 RICON_EXPLOSION = 147, 645 RICON_1UP = 148, 646 RICON_PLAYER = 149, 647 RICON_PLAYER_JUMP = 150, 648 RICON_KEY = 151, 649 RICON_DEMON = 152, 650 RICON_TEXT_POPUP = 153, 651 RICON_GEAR_EX = 154, 652 RICON_CRACK = 155, 653 RICON_CRACK_POINTS = 156, 654 RICON_STAR = 157, 655 RICON_DOOR = 158, 656 RICON_EXIT = 159, 657 RICON_MODE_2D = 160, 658 RICON_MODE_3D = 161, 659 RICON_CUBE = 162, 660 RICON_CUBE_FACE_TOP = 163, 661 RICON_CUBE_FACE_LEFT = 164, 662 RICON_CUBE_FACE_FRONT = 165, 663 RICON_CUBE_FACE_BOTTOM = 166, 664 RICON_CUBE_FACE_RIGHT = 167, 665 RICON_CUBE_FACE_BACK = 168, 666 RICON_CAMERA = 169, 667 RICON_SPECIAL = 170, 668 RICON_LINK_NET = 171, 669 RICON_LINK_BOXES = 172, 670 RICON_LINK_MULTI = 173, 671 RICON_LINK = 174, 672 RICON_LINK_BROKE = 175, 673 RICON_TEXT_NOTES = 176, 674 RICON_NOTEBOOK = 177, 675 RICON_SUITCASE = 178, 676 RICON_SUITCASE_ZIP = 179, 677 RICON_MAILBOX = 180, 678 RICON_MONITOR = 181, 679 RICON_PRINTER = 182, 680 RICON_PHOTO_CAMERA = 183, 681 RICON_PHOTO_CAMERA_FLASH = 184, 682 RICON_HOUSE = 185, 683 RICON_HEART = 186, 684 RICON_CORNER = 187, 685 RICON_VERTICAL_BARS = 188, 686 RICON_VERTICAL_BARS_FILL = 189, 687 RICON_LIFE_BARS = 190, 688 RICON_INFO = 191, 689 RICON_CROSSLINE = 192, 690 RICON_HELP = 193, 691 RICON_FILETYPE_ALPHA = 194, 692 RICON_FILETYPE_HOME = 195, 693 RICON_LAYERS_VISIBLE = 196, 694 RICON_LAYERS = 197, 695 RICON_WINDOW = 198, 696 RICON_HIDPI = 199, 697 RICON_200 = 200, 698 RICON_201 = 201, 699 RICON_202 = 202, 700 RICON_203 = 203, 701 RICON_204 = 204, 702 RICON_205 = 205, 703 RICON_206 = 206, 704 RICON_207 = 207, 705 RICON_208 = 208, 706 RICON_209 = 209, 707 RICON_210 = 210, 708 RICON_211 = 211, 709 RICON_212 = 212, 710 RICON_213 = 213, 711 RICON_214 = 214, 712 RICON_215 = 215, 713 RICON_216 = 216, 714 RICON_217 = 217, 715 RICON_218 = 218, 716 RICON_219 = 219, 717 RICON_220 = 220, 718 RICON_221 = 221, 719 RICON_222 = 222, 720 RICON_223 = 223, 721 RICON_224 = 224, 722 RICON_225 = 225, 723 RICON_226 = 226, 724 RICON_227 = 227, 725 RICON_228 = 228, 726 RICON_229 = 229, 727 RICON_230 = 230, 728 RICON_231 = 231, 729 RICON_232 = 232, 730 RICON_233 = 233, 731 RICON_234 = 234, 732 RICON_235 = 235, 733 RICON_236 = 236, 734 RICON_237 = 237, 735 RICON_238 = 238, 736 RICON_239 = 239, 737 RICON_240 = 240, 738 RICON_241 = 241, 739 RICON_242 = 242, 740 RICON_243 = 243, 741 RICON_244 = 244, 742 RICON_245 = 245, 743 RICON_246 = 246, 744 RICON_247 = 247, 745 RICON_248 = 248, 746 RICON_249 = 249, 747 RICON_250 = 250, 748 RICON_251 = 251, 749 RICON_252 = 252, 750 RICON_253 = 253, 751 RICON_254 = 254, 752 RICON_255 = 255, 753 } 754 755 //---------------------------------------------------------------------------------- 756 // Icons data for all gui possible icons (allocated on data segment by default) 757 // 758 // NOTE 1: Every icon is codified in binary form, using 1 bit per pixel, so, 759 // every 16x16 icon requires 8 integers (16*16/32) to be stored 760 // 761 // NOTE 2: A new icon set could be loaded over this array using GuiLoadIcons(), 762 // but loaded icons set must be same RICON_SIZE and no more than RICON_MAX_ICONS 763 // 764 // guiIcons size is by default: 256*(16*16/32) = 2048*4 = 8192 bytes = 8 KB 765 //---------------------------------------------------------------------------------- 766 767 // RICON_NONE 768 // RICON_FOLDER_FILE_OPEN 769 // RICON_FILE_SAVE_CLASSIC 770 // RICON_FOLDER_OPEN 771 // RICON_FOLDER_SAVE 772 // RICON_FILE_OPEN 773 // RICON_FILE_SAVE 774 // RICON_FILE_EXPORT 775 // RICON_FILE_NEW 776 // RICON_FILE_DELETE 777 // RICON_FILETYPE_TEXT 778 // RICON_FILETYPE_AUDIO 779 // RICON_FILETYPE_IMAGE 780 // RICON_FILETYPE_PLAY 781 // RICON_FILETYPE_VIDEO 782 // RICON_FILETYPE_INFO 783 // RICON_FILE_COPY 784 // RICON_FILE_CUT 785 // RICON_FILE_PASTE 786 // RICON_CURSOR_HAND 787 // RICON_CURSOR_POINTER 788 // RICON_CURSOR_CLASSIC 789 // RICON_PENCIL 790 // RICON_PENCIL_BIG 791 // RICON_BRUSH_CLASSIC 792 // RICON_BRUSH_PAINTER 793 // RICON_WATER_DROP 794 // RICON_COLOR_PICKER 795 // RICON_RUBBER 796 // RICON_COLOR_BUCKET 797 // RICON_TEXT_T 798 // RICON_TEXT_A 799 // RICON_SCALE 800 // RICON_RESIZE 801 // RICON_FILTER_POINT 802 // RICON_FILTER_BILINEAR 803 // RICON_CROP 804 // RICON_CROP_ALPHA 805 // RICON_SQUARE_TOGGLE 806 // RICON_SIMMETRY 807 // RICON_SIMMETRY_HORIZONTAL 808 // RICON_SIMMETRY_VERTICAL 809 // RICON_LENS 810 // RICON_LENS_BIG 811 // RICON_EYE_ON 812 // RICON_EYE_OFF 813 // RICON_FILTER_TOP 814 // RICON_FILTER 815 // RICON_TARGET_POINT 816 // RICON_TARGET_SMALL 817 // RICON_TARGET_BIG 818 // RICON_TARGET_MOVE 819 // RICON_CURSOR_MOVE 820 // RICON_CURSOR_SCALE 821 // RICON_CURSOR_SCALE_RIGHT 822 // RICON_CURSOR_SCALE_LEFT 823 // RICON_UNDO 824 // RICON_REDO 825 // RICON_REREDO 826 // RICON_MUTATE 827 // RICON_ROTATE 828 // RICON_REPEAT 829 // RICON_SHUFFLE 830 // RICON_EMPTYBOX 831 // RICON_TARGET 832 // RICON_TARGET_SMALL_FILL 833 // RICON_TARGET_BIG_FILL 834 // RICON_TARGET_MOVE_FILL 835 // RICON_CURSOR_MOVE_FILL 836 // RICON_CURSOR_SCALE_FILL 837 // RICON_CURSOR_SCALE_RIGHT 838 // RICON_CURSOR_SCALE_LEFT 839 // RICON_UNDO_FILL 840 // RICON_REDO_FILL 841 // RICON_REREDO_FILL 842 // RICON_MUTATE_FILL 843 // RICON_ROTATE_FILL 844 // RICON_REPEAT_FILL 845 // RICON_SHUFFLE_FILL 846 // RICON_EMPTYBOX_SMALL 847 // RICON_BOX 848 // RICON_BOX_TOP 849 // RICON_BOX_TOP_RIGHT 850 // RICON_BOX_RIGHT 851 // RICON_BOX_BOTTOM_RIGHT 852 // RICON_BOX_BOTTOM 853 // RICON_BOX_BOTTOM_LEFT 854 // RICON_BOX_LEFT 855 // RICON_BOX_TOP_LEFT 856 // RICON_BOX_CIRCLE_MASK 857 // RICON_BOX_CENTER 858 // RICON_POT 859 // RICON_ALPHA_MULTIPLY 860 // RICON_ALPHA_CLEAR 861 // RICON_DITHERING 862 // RICON_MIPMAPS 863 // RICON_BOX_GRID 864 // RICON_GRID 865 // RICON_BOX_CORNERS_SMALL 866 // RICON_BOX_CORNERS_BIG 867 // RICON_FOUR_BOXES 868 // RICON_GRID_FILL 869 // RICON_BOX_MULTISIZE 870 // RICON_ZOOM_SMALL 871 // RICON_ZOOM_MEDIUM 872 // RICON_ZOOM_BIG 873 // RICON_ZOOM_ALL 874 // RICON_ZOOM_CENTER 875 // RICON_BOX_DOTS_SMALL 876 // RICON_BOX_DOTS_BIG 877 // RICON_BOX_CONCENTRIC 878 // RICON_BOX_GRID_BIG 879 // RICON_OK_TICK 880 // RICON_CROSS 881 // RICON_ARROW_LEFT 882 // RICON_ARROW_RIGHT 883 // RICON_ARROW_DOWN 884 // RICON_ARROW_UP 885 // RICON_ARROW_LEFT_FILL 886 // RICON_ARROW_RIGHT_FILL 887 // RICON_ARROW_DOWN_FILL 888 // RICON_ARROW_UP_FILL 889 // RICON_AUDIO 890 // RICON_FX 891 // RICON_WAVE 892 // RICON_WAVE_SINUS 893 // RICON_WAVE_SQUARE 894 // RICON_WAVE_TRIANGULAR 895 // RICON_CROSS_SMALL 896 // RICON_PLAYER_PREVIOUS 897 // RICON_PLAYER_PLAY_BACK 898 // RICON_PLAYER_PLAY 899 // RICON_PLAYER_PAUSE 900 // RICON_PLAYER_STOP 901 // RICON_PLAYER_NEXT 902 // RICON_PLAYER_RECORD 903 // RICON_MAGNET 904 // RICON_LOCK_CLOSE 905 // RICON_LOCK_OPEN 906 // RICON_CLOCK 907 // RICON_TOOLS 908 // RICON_GEAR 909 // RICON_GEAR_BIG 910 // RICON_BIN 911 // RICON_HAND_POINTER 912 // RICON_LASER 913 // RICON_COIN 914 // RICON_EXPLOSION 915 // RICON_1UP 916 // RICON_PLAYER 917 // RICON_PLAYER_JUMP 918 // RICON_KEY 919 // RICON_DEMON 920 // RICON_TEXT_POPUP 921 // RICON_GEAR_EX 922 // RICON_CRACK 923 // RICON_CRACK_POINTS 924 // RICON_STAR 925 // RICON_DOOR 926 // RICON_EXIT 927 // RICON_MODE_2D 928 // RICON_MODE_3D 929 // RICON_CUBE 930 // RICON_CUBE_FACE_TOP 931 // RICON_CUBE_FACE_LEFT 932 // RICON_CUBE_FACE_FRONT 933 // RICON_CUBE_FACE_BOTTOM 934 // RICON_CUBE_FACE_RIGHT 935 // RICON_CUBE_FACE_BACK 936 // RICON_CAMERA 937 // RICON_SPECIAL 938 // RICON_LINK_NET 939 // RICON_LINK_BOXES 940 // RICON_LINK_MULTI 941 // RICON_LINK 942 // RICON_LINK_BROKE 943 // RICON_TEXT_NOTES 944 // RICON_NOTEBOOK 945 // RICON_SUITCASE 946 // RICON_SUITCASE_ZIP 947 // RICON_MAILBOX 948 // RICON_MONITOR 949 // RICON_PRINTER 950 // RICON_PHOTO_CAMERA 951 // RICON_PHOTO_CAMERA_FLASH 952 // RICON_HOUSE 953 // RICON_HEART 954 // RICON_CORNER 955 // RICON_VERTICAL_BARS 956 // RICON_VERTICAL_BARS_FILL 957 // RICON_LIFE_BARS 958 // RICON_INFO 959 // RICON_CROSSLINE 960 // RICON_HELP 961 // RICON_FILETYPE_ALPHA 962 // RICON_FILETYPE_HOME 963 // RICON_LAYERS_VISIBLE 964 // RICON_LAYERS 965 // RICON_WINDOW 966 // RICON_HIDPI 967 // RICON_200 968 // RICON_201 969 // RICON_202 970 // RICON_203 971 // RICON_204 972 // RICON_205 973 // RICON_206 974 // RICON_207 975 // RICON_208 976 // RICON_209 977 // RICON_210 978 // RICON_211 979 // RICON_212 980 // RICON_213 981 // RICON_214 982 // RICON_215 983 // RICON_216 984 // RICON_217 985 // RICON_218 986 // RICON_219 987 // RICON_220 988 // RICON_221 989 // RICON_222 990 // RICON_223 991 // RICON_224 992 // RICON_225 993 // RICON_226 994 // RICON_227 995 // RICON_228 996 // RICON_229 997 // RICON_230 998 // RICON_231 999 // RICON_232 1000 // RICON_233 1001 // RICON_234 1002 // RICON_235 1003 // RICON_236 1004 // RICON_237 1005 // RICON_238 1006 // RICON_239 1007 // RICON_240 1008 // RICON_241 1009 // RICON_242 1010 // RICON_243 1011 // RICON_244 1012 // RICON_245 1013 // RICON_246 1014 // RICON_247 1015 // RICON_248 1016 // RICON_249 1017 // RICON_250 1018 // RICON_251 1019 // RICON_252 1020 // RICON_253 1021 // RICON_254 1022 // RICON_255 1023 1024 // RAYGUI_CUSTOM_RICONS 1025 1026 // !RAYGUI_NO_RICONS 1027 1028 // Maximum number of standard controls 1029 // Maximum number of standard properties 1030 // Maximum number of extended properties 1031 1032 //---------------------------------------------------------------------------------- 1033 // Types and Structures Definition 1034 //---------------------------------------------------------------------------------- 1035 // Gui control property style color element 1036 1037 //---------------------------------------------------------------------------------- 1038 // Global Variables Definition 1039 //---------------------------------------------------------------------------------- 1040 1041 // Gui current font (WARNING: highly coupled to raylib) 1042 // Gui lock state (no inputs processed) 1043 // Gui element transpacency on drawing 1044 1045 //---------------------------------------------------------------------------------- 1046 // Style data array for all gui style properties (allocated on data segment by default) 1047 // 1048 // NOTE 1: First set of BASE properties are generic to all controls but could be individually 1049 // overwritten per control, first set of EXTENDED properties are generic to all controls and 1050 // can not be overwritten individually but custom EXTENDED properties can be used by control 1051 // 1052 // NOTE 2: A new style set could be loaded over this array using GuiLoadStyle(), 1053 // but default gui style could always be recovered with GuiLoadStyleDefault() 1054 // 1055 // guiStyle size is by default: 16*(16 + 8) = 384*4 = 1536 bytes = 1.5 KB 1056 //---------------------------------------------------------------------------------- 1057 1058 // Style loaded flag for lazy style initialization 1059 1060 //---------------------------------------------------------------------------------- 1061 // Standalone Mode Functions Declaration 1062 // 1063 // NOTE: raygui depend on some raylib input and drawing functions 1064 // To use raygui as standalone library, below functions must be defined by the user 1065 //---------------------------------------------------------------------------------- 1066 1067 // Input required functions 1068 //------------------------------------------------------------------------------- 1069 1070 // -- GuiTextBox(), GuiTextBoxMulti(), GuiValueBox() 1071 //------------------------------------------------------------------------------- 1072 1073 // Drawing required functions 1074 //------------------------------------------------------------------------------- 1075 // -- GuiDrawRectangle(), GuiDrawIcon() 1076 1077 // -- GuiColorPicker() 1078 //------------------------------------------------------------------------------- 1079 1080 // Text required functions 1081 //------------------------------------------------------------------------------- 1082 // -- GuiLoadStyle() 1083 // -- GuiLoadStyleDefault() 1084 // -- GuiLoadStyle() 1085 // -- GuiLoadStyle() 1086 // -- GuiLoadStyle() 1087 // -- GuiLoadStyle() 1088 1089 // -- GetTextWidth(), GuiTextBoxMulti() 1090 // -- GuiDrawText() 1091 //------------------------------------------------------------------------------- 1092 1093 // raylib functions already implemented in raygui 1094 //------------------------------------------------------------------------------- 1095 // Returns a Color struct from hexadecimal value 1096 // Returns hexadecimal value for a Color 1097 // Color fade-in or fade-out, alpha goes from 0.0f to 1.0f 1098 // Check if point is inside rectangle 1099 // Formatting of text with variables to 'embed' 1100 // Split text into multiple strings 1101 // Get integer value from text 1102 // Get next codepoint in a UTF-8 encoded text 1103 // Encode codepoint into UTF-8 text (char array size returned as parameter) 1104 1105 // Draw rectangle vertical gradient 1106 //------------------------------------------------------------------------------- 1107 1108 // RAYGUI_STANDALONE 1109 1110 //---------------------------------------------------------------------------------- 1111 // Module specific Functions Declaration 1112 //---------------------------------------------------------------------------------- 1113 // Gui get text width using default font 1114 // Get text bounds considering control bounds 1115 // Get text icon if provided and move text cursor 1116 1117 // Gui draw text using default font 1118 // Gui draw rectangle using default raygui style 1119 1120 // Split controls text into multiple strings 1121 // Convert color data from HSV to RGB 1122 // Convert color data from RGB to HSV 1123 1124 //---------------------------------------------------------------------------------- 1125 // Gui Setup Functions Definition 1126 //---------------------------------------------------------------------------------- 1127 // Enable gui global state 1128 1129 // Disable gui global state 1130 1131 // Lock gui global state 1132 1133 // Unlock gui global state 1134 1135 // Check if gui is locked (global state) 1136 1137 // Set gui controls alpha global state 1138 1139 // Set gui state (global state) 1140 1141 // Get gui state (global state) 1142 1143 // Set custom gui font 1144 // NOTE: Font loading/unloading is external to raygui 1145 1146 // NOTE: If we try to setup a font but default style has not been 1147 // lazily loaded before, it will be overwritten, so we need to force 1148 // default style loading first 1149 1150 // Get custom gui font 1151 1152 // Set control style property value 1153 1154 // Default properties are propagated to all controls 1155 1156 // Get control style property value 1157 1158 //---------------------------------------------------------------------------------- 1159 // Gui Controls Functions Definition 1160 //---------------------------------------------------------------------------------- 1161 1162 // Window Box control 1163 1164 // NOTE: This define is also used by GuiMessageBox() and GuiTextInputBox() 1165 1166 //GuiControlState state = guiState; 1167 1168 // Update control 1169 //-------------------------------------------------------------------- 1170 // NOTE: Logic is directly managed by button 1171 //-------------------------------------------------------------------- 1172 1173 // Draw control 1174 //-------------------------------------------------------------------- 1175 // Draw window header as status bar 1176 // Draw window base 1177 1178 // Draw window close button 1179 1180 //-------------------------------------------------------------------- 1181 1182 // Group Box control with text name 1183 1184 // Draw control 1185 //-------------------------------------------------------------------- 1186 1187 //-------------------------------------------------------------------- 1188 1189 // Line control 1190 1191 // Draw control 1192 //-------------------------------------------------------------------- 1193 1194 // Draw line with embedded text label: "--- text --------------" 1195 1196 //-------------------------------------------------------------------- 1197 1198 // Panel control 1199 1200 // Draw control 1201 //-------------------------------------------------------------------- 1202 1203 //-------------------------------------------------------------------- 1204 1205 // Scroll Panel control 1206 1207 // Recheck to account for the other scrollbar being visible 1208 1209 // Calculate view area (area without the scrollbars) 1210 1211 // Clip view area to the actual content size 1212 1213 // Update control 1214 //-------------------------------------------------------------------- 1215 1216 // Check button state 1217 1218 // Horizontal scroll (Shift + Mouse wheel) 1219 1220 // Vertical scroll 1221 1222 // Normalize scroll values 1223 1224 //-------------------------------------------------------------------- 1225 1226 // Draw control 1227 //-------------------------------------------------------------------- 1228 // Draw background 1229 1230 // Save size of the scrollbar slider 1231 1232 // Draw horizontal scrollbar if visible 1233 1234 // Change scrollbar slider size to show the diff in size between the content width and the widget width 1235 1236 // Draw vertical scrollbar if visible 1237 1238 // Change scrollbar slider size to show the diff in size between the content height and the widget height 1239 1240 // Draw detail corner rectangle if both scroll bars are visible 1241 1242 // Draw scrollbar lines depending on current state 1243 1244 // Set scrollbar slider size back to the way it was before 1245 1246 //-------------------------------------------------------------------- 1247 1248 // Label control 1249 1250 // Update control 1251 //-------------------------------------------------------------------- 1252 // ... 1253 //-------------------------------------------------------------------- 1254 1255 // Draw control 1256 //-------------------------------------------------------------------- 1257 1258 //-------------------------------------------------------------------- 1259 1260 // Button control, returns true when clicked 1261 1262 // Update control 1263 //-------------------------------------------------------------------- 1264 1265 // Check button state 1266 1267 //-------------------------------------------------------------------- 1268 1269 // Draw control 1270 //-------------------------------------------------------------------- 1271 1272 //------------------------------------------------------------------ 1273 1274 // Label button control 1275 1276 // NOTE: We force bounds.width to be all text 1277 1278 // Update control 1279 //-------------------------------------------------------------------- 1280 1281 // Check checkbox state 1282 1283 //-------------------------------------------------------------------- 1284 1285 // Draw control 1286 //-------------------------------------------------------------------- 1287 1288 //-------------------------------------------------------------------- 1289 1290 // Toggle Button control, returns true when active 1291 1292 // Update control 1293 //-------------------------------------------------------------------- 1294 1295 // Check toggle button state 1296 1297 //-------------------------------------------------------------------- 1298 1299 // Draw control 1300 //-------------------------------------------------------------------- 1301 1302 //-------------------------------------------------------------------- 1303 1304 // Toggle Group control, returns toggled button index 1305 1306 // Get substrings items from text (items pointers) 1307 1308 // Check Box control, returns true when active 1309 1310 // Update control 1311 //-------------------------------------------------------------------- 1312 1313 // Check checkbox state 1314 1315 //-------------------------------------------------------------------- 1316 1317 // Draw control 1318 //-------------------------------------------------------------------- 1319 1320 //-------------------------------------------------------------------- 1321 1322 // Combo Box control, returns selected item index 1323 1324 // Get substrings items from text (items pointers, lengths and count) 1325 1326 // Update control 1327 //-------------------------------------------------------------------- 1328 1329 //-------------------------------------------------------------------- 1330 1331 // Draw control 1332 //-------------------------------------------------------------------- 1333 // Draw combo box main 1334 1335 // Draw selector using a custom button 1336 // NOTE: BORDER_WIDTH and TEXT_ALIGNMENT forced values 1337 1338 //-------------------------------------------------------------------- 1339 1340 // Dropdown Box control 1341 // NOTE: Returns mouse click 1342 1343 // Get substrings items from text (items pointers, lengths and count) 1344 1345 // Check mouse button pressed 1346 1347 // Update control 1348 //-------------------------------------------------------------------- 1349 1350 // Check if mouse has been pressed or released outside limits 1351 1352 // Check if already selected item has been pressed again 1353 1354 // Check focused and selected item 1355 1356 // Update item rectangle y position for next item 1357 1358 // Item selected, change to editMode = false 1359 1360 //-------------------------------------------------------------------- 1361 1362 // Draw control 1363 //-------------------------------------------------------------------- 1364 1365 // Draw visible items 1366 1367 // Update item rectangle y position for next item 1368 1369 // Draw arrows (using icon if available) 1370 1371 // RICON_ARROW_DOWN_FILL 1372 1373 //-------------------------------------------------------------------- 1374 1375 // Text Box control, updates input text 1376 // NOTE 2: Returns if KEY_ENTER pressed (useful for data validation) 1377 1378 // Update control 1379 //-------------------------------------------------------------------- 1380 1381 // Returns codepoint as Unicode 1382 1383 // Only allow keys in range [32..125] 1384 1385 // Delete text 1386 1387 // Check text alignment to position cursor properly 1388 1389 //-------------------------------------------------------------------- 1390 1391 // Draw control 1392 //-------------------------------------------------------------------- 1393 1394 // Draw cursor 1395 1396 //-------------------------------------------------------------------- 1397 1398 // Spinner control, returns selected value 1399 1400 // Update control 1401 //-------------------------------------------------------------------- 1402 1403 // Check spinner state 1404 1405 //-------------------------------------------------------------------- 1406 1407 // Draw control 1408 //-------------------------------------------------------------------- 1409 // TODO: Set Spinner properties for ValueBox 1410 1411 // Draw value selector custom buttons 1412 // NOTE: BORDER_WIDTH and TEXT_ALIGNMENT forced values 1413 1414 // Draw text label if provided 1415 1416 //-------------------------------------------------------------------- 1417 1418 // Value Box control, updates input text with numbers 1419 // NOTE: Requires static variables: frameCounter 1420 1421 // Update control 1422 //-------------------------------------------------------------------- 1423 1424 // Only allow keys in range [48..57] 1425 1426 // Delete text 1427 1428 //-------------------------------------------------------------------- 1429 1430 // Draw control 1431 //-------------------------------------------------------------------- 1432 1433 // WARNING: BLANK color does not work properly with Fade() 1434 1435 // Draw cursor 1436 1437 // NOTE: ValueBox internal text is always centered 1438 1439 // Draw text label if provided 1440 1441 //-------------------------------------------------------------------- 1442 1443 // Text Box control with multiple lines 1444 1445 // Cursor position, [x, y] values should be updated 1446 1447 // Character rectangle scaling factor 1448 1449 // Update control 1450 //-------------------------------------------------------------------- 1451 1452 // We get an Unicode codepoint 1453 1454 // Length in bytes (UTF-8 string) 1455 1456 // Introduce characters 1457 1458 // Supports Unicode inputs -> Encoded to UTF-8 1459 1460 // Delete characters 1461 1462 // Remove ASCII equivalent character (1 byte) 1463 1464 // Remove latest UTF-8 unicode character introduced (n bytes) 1465 1466 // Exit edit mode 1467 1468 //-------------------------------------------------------------------- 1469 1470 // Draw control 1471 //-------------------------------------------------------------------- 1472 1473 // 0-No wrap, 1-Char wrap, 2-Word wrap 1474 1475 //int lastSpacePos = 0; 1476 //int lastSpaceWidth = 0; 1477 //int lastSpaceCursorPos = 0; 1478 1479 // If requested codepoint is not found, we get '?' (0x3f) 1480 1481 // Glyph measures 1482 1483 // Line feed 1484 // Carriage return 1485 1486 // Jump line if the end of the text box area has been reached 1487 1488 // Line feed 1489 // Carriage return 1490 1491 /* 1492 if ((codepointLength == 1) && (codepoint == ' ')) 1493 { 1494 lastSpacePos = i; 1495 lastSpaceWidth = 0; 1496 lastSpaceCursorPos = cursorPos.x; 1497 } 1498 1499 // Jump line if last word reaches end of text box area 1500 if ((lastSpaceCursorPos + lastSpaceWidth) > (textAreaBounds.x + textAreaBounds.width)) 1501 { 1502 cursorPos.y += 12; // Line feed 1503 cursorPos.x = textAreaBounds.x; // Carriage return 1504 } 1505 */ 1506 1507 // Draw current character glyph 1508 1509 //if (i > lastSpacePos) lastSpaceWidth += (atlasRec.width + (float)GuiGetStyle(DEFAULT, TEXT_SPACING)); 1510 1511 // Draw cursor position considering text glyphs 1512 1513 //-------------------------------------------------------------------- 1514 1515 // Slider control with pro parameters 1516 // NOTE: Other GuiSlider*() controls use this one 1517 1518 // Slider 1519 1520 // SliderBar 1521 1522 // Update control 1523 //-------------------------------------------------------------------- 1524 1525 // Get equivalent value and slider position from mousePoint.x 1526 1527 // Slider 1528 // SliderBar 1529 1530 // Bar limits check 1531 // Slider 1532 1533 // SliderBar 1534 1535 //-------------------------------------------------------------------- 1536 1537 // Draw control 1538 //-------------------------------------------------------------------- 1539 1540 // Draw slider internal bar (depends on state) 1541 1542 // Draw left/right text if provided 1543 1544 //-------------------------------------------------------------------- 1545 1546 // Slider control extended, returns selected value and has text 1547 1548 // Slider Bar control extended, returns selected value 1549 1550 // Progress Bar control extended, shows current progress value 1551 1552 // Update control 1553 //-------------------------------------------------------------------- 1554 1555 //-------------------------------------------------------------------- 1556 1557 // Draw control 1558 //-------------------------------------------------------------------- 1559 1560 // Draw slider internal progress bar (depends on state) 1561 1562 // Draw left/right text if provided 1563 1564 //-------------------------------------------------------------------- 1565 1566 // Status Bar control 1567 1568 // Draw control 1569 //-------------------------------------------------------------------- 1570 1571 //-------------------------------------------------------------------- 1572 1573 // Dummy rectangle control, intended for placeholding 1574 1575 // Update control 1576 //-------------------------------------------------------------------- 1577 1578 // Check button state 1579 1580 //-------------------------------------------------------------------- 1581 1582 // Draw control 1583 //-------------------------------------------------------------------- 1584 1585 //------------------------------------------------------------------ 1586 1587 // Scroll Bar control 1588 1589 // Is the scrollbar horizontal or vertical? 1590 1591 // The size (width or height depending on scrollbar type) of the spinner buttons 1592 1593 // Arrow buttons [<] [>] [∧] [∨] 1594 1595 // Actual area of the scrollbar excluding the arrow buttons 1596 1597 // Slider bar that moves --[///]----- 1598 1599 // Normalize value 1600 1601 // Calculate rectangles for all of the components 1602 1603 // Make sure the slider won't get outside of the scrollbar 1604 1605 // Make sure the slider won't get outside of the scrollbar 1606 1607 // Update control 1608 //-------------------------------------------------------------------- 1609 1610 // Handle mouse wheel 1611 1612 // Normalize value 1613 1614 //-------------------------------------------------------------------- 1615 1616 // Draw control 1617 //-------------------------------------------------------------------- 1618 // Draw the background 1619 1620 // Draw the scrollbar active area background 1621 // Draw the slider bar 1622 1623 // Draw arrows (using icon if available) 1624 1625 // RICON_ARROW_UP_FILL / RICON_ARROW_LEFT_FILL 1626 1627 // RICON_ARROW_DOWN_FILL / RICON_ARROW_RIGHT_FILL 1628 1629 //-------------------------------------------------------------------- 1630 1631 // List View control 1632 1633 // List View control with extended parameters 1634 1635 // Check if we need a scroll bar 1636 1637 // Define base item rectangle [0] 1638 1639 // Get items on the list 1640 1641 // Update control 1642 //-------------------------------------------------------------------- 1643 1644 // Check mouse inside list view 1645 1646 // Check focused and selected item 1647 1648 // Update item rectangle y position for next item 1649 1650 // Reset item rectangle y to [0] 1651 1652 //-------------------------------------------------------------------- 1653 1654 // Draw control 1655 //-------------------------------------------------------------------- 1656 // Draw background 1657 1658 // Draw visible items 1659 1660 // Draw item selected 1661 1662 // Draw item focused 1663 1664 // Draw item normal 1665 1666 // Update item rectangle y position for next item 1667 1668 // Calculate percentage of visible items and apply same percentage to scrollbar 1669 1670 // Save default slider size 1671 // Save default scroll speed 1672 // Change slider size 1673 // Change scroll speed 1674 1675 // Reset scroll speed to default 1676 // Reset slider size to default 1677 1678 //-------------------------------------------------------------------- 1679 1680 // Color Panel control 1681 1682 // HSV: Saturation 1683 // HSV: Value 1684 1685 // Update control 1686 //-------------------------------------------------------------------- 1687 1688 // Calculate color from picker 1689 1690 // Get normalized value on x 1691 // Get normalized value on y 1692 1693 // NOTE: Vector3ToColor() only available on raylib 1.8.1 1694 1695 //-------------------------------------------------------------------- 1696 1697 // Draw control 1698 //-------------------------------------------------------------------- 1699 1700 // Draw color picker: selector 1701 1702 //-------------------------------------------------------------------- 1703 1704 // Color Bar Alpha control 1705 // NOTE: Returns alpha value normalized [0..1] 1706 1707 // Update control 1708 //-------------------------------------------------------------------- 1709 1710 //selector.x = bounds.x + (int)(((alpha - 0)/(100 - 0))*(bounds.width - 2*GuiGetStyle(SLIDER, BORDER_WIDTH))) - selector.width/2; 1711 1712 //-------------------------------------------------------------------- 1713 1714 // Draw control 1715 //-------------------------------------------------------------------- 1716 1717 // Draw alpha bar: checked background 1718 1719 // Draw alpha bar: selector 1720 1721 //-------------------------------------------------------------------- 1722 1723 // Color Bar Hue control 1724 // Returns hue value normalized [0..1] 1725 // NOTE: Other similar bars (for reference): 1726 // Color GuiColorBarSat() [WHITE->color] 1727 // Color GuiColorBarValue() [BLACK->color], HSV/HSL 1728 // float GuiColorBarLuminance() [BLACK->WHITE] 1729 1730 // Update control 1731 //-------------------------------------------------------------------- 1732 1733 /*if (IsKeyDown(KEY_UP)) 1734 { 1735 hue -= 2.0f; 1736 if (hue <= 0.0f) hue = 0.0f; 1737 } 1738 else if (IsKeyDown(KEY_DOWN)) 1739 { 1740 hue += 2.0f; 1741 if (hue >= 360.0f) hue = 360.0f; 1742 }*/ 1743 1744 //-------------------------------------------------------------------- 1745 1746 // Draw control 1747 //-------------------------------------------------------------------- 1748 1749 // Draw hue bar:color bars 1750 1751 // Draw hue bar: selector 1752 1753 //-------------------------------------------------------------------- 1754 1755 // Color Picker control 1756 // NOTE: It's divided in multiple controls: 1757 // Color GuiColorPanel(Rectangle bounds, Color color) 1758 // float GuiColorBarAlpha(Rectangle bounds, float alpha) 1759 // float GuiColorBarHue(Rectangle bounds, float value) 1760 // NOTE: bounds define GuiColorPanel() size 1761 1762 //Rectangle boundsAlpha = { bounds.x, bounds.y + bounds.height + GuiGetStyle(COLORPICKER, BARS_PADDING), bounds.width, GuiGetStyle(COLORPICKER, BARS_THICK) }; 1763 1764 //color.a = (unsigned char)(GuiColorBarAlpha(boundsAlpha, (float)color.a/255.0f)*255.0f); 1765 1766 // Message Box control 1767 1768 // Returns clicked button from buttons list, 0 refers to closed window button 1769 1770 // Draw control 1771 //-------------------------------------------------------------------- 1772 1773 //-------------------------------------------------------------------- 1774 1775 // Text Input Box control, ask for text 1776 1777 // Used to enable text edit mode 1778 // WARNING: No more than one GuiTextInputBox() should be open at the same time 1779 1780 // Draw control 1781 //-------------------------------------------------------------------- 1782 1783 // Draw message if available 1784 1785 //-------------------------------------------------------------------- 1786 1787 // Grid control 1788 // NOTE: Returns grid mouse-hover selected cell 1789 // About drawing lines at subpixel spacing, simple put, not easy solution: 1790 // https://stackoverflow.com/questions/4435450/2d-opengl-drawing-lines-that-dont-exactly-fit-pixel-raster 1791 1792 // Grid lines alpha amount 1793 1794 // Update control 1795 //-------------------------------------------------------------------- 1796 1797 //-------------------------------------------------------------------- 1798 1799 // Draw control 1800 //-------------------------------------------------------------------- 1801 1802 // Draw vertical grid lines 1803 1804 // Draw horizontal grid lines 1805 1806 //---------------------------------------------------------------------------------- 1807 // Styles loading functions 1808 //---------------------------------------------------------------------------------- 1809 1810 // Load raygui style file (.rgs) 1811 1812 // Try reading the files as text file first 1813 1814 // Style property: p <control_id> <property_id> <property_value> <property_name> 1815 1816 // Style font: f <gen_font_size> <charmap_file> <font_file> 1817 1818 // Load characters from charmap file, 1819 // expected '\n' separated list of integer values 1820 1821 // DEFAULT control 1822 1823 // If a DEFAULT property is loaded, it is propagated to all controls 1824 // NOTE: All DEFAULT properties should be defined first in the file 1825 1826 // Font loading is highly dependant on raylib API to load font data and image 1827 1828 // Load custom font if available 1829 1830 // 0-Normal, 1-SDF 1831 1832 // Load font white rectangle 1833 1834 // Load font image parameters 1835 1836 // Load font recs data 1837 1838 // Load font chars info data 1839 1840 // Set font texture source rectangle to be used as white texture to draw shapes 1841 // NOTE: This way, all gui can be draw using a single draw call 1842 1843 // Load style default over global style 1844 1845 // We set this variable first to avoid cyclic function calls 1846 // when calling GuiSetStyle() and GuiGetStyle() 1847 1848 // Initialize default LIGHT style property values 1849 1850 // WARNING: Some controls use other values 1851 // WARNING: Some controls use other values 1852 // WARNING: Some controls use other values 1853 1854 // Initialize control-specific property values 1855 // NOTE: Those properties are in default list but require specific values by control type 1856 1857 // Initialize extended property values 1858 // NOTE: By default, extended property values are initialized to 0 1859 // DEFAULT, shared by all controls 1860 // DEFAULT, shared by all controls 1861 // DEFAULT specific property 1862 // DEFAULT specific property 1863 1864 // Initialize default font 1865 1866 // Get text with icon id prepended 1867 // NOTE: Useful to add icons by name id (enum) instead of 1868 // a number that can change between ricon versions 1869 1870 // Get full icons data pointer 1871 1872 // Load raygui icons file (.rgi) 1873 // NOTE: In case nameIds are required, they can be requested with loadIconsName, 1874 // they are returned as a guiIconsName[iconCount][RICON_MAX_NAME_LENGTH], 1875 // WARNING: guiIconsName[]][] memory should be manually freed! 1876 1877 // Style File Structure (.rgi) 1878 // ------------------------------------------------------ 1879 // Offset | Size | Type | Description 1880 // ------------------------------------------------------ 1881 // 0 | 4 | char | Signature: "rGI " 1882 // 4 | 2 | short | Version: 100 1883 // 6 | 2 | short | reserved 1884 1885 // 8 | 2 | short | Num icons (N) 1886 // 10 | 2 | short | Icons size (Options: 16, 32, 64) (S) 1887 1888 // Icons name id (32 bytes per name id) 1889 // foreach (icon) 1890 // { 1891 // 12+32*i | 32 | char | Icon NameId 1892 // } 1893 1894 // Icons data: One bit per pixel, stored as unsigned int array (depends on icon size) 1895 // S*S pixels/32bit per unsigned int = K unsigned int per icon 1896 // foreach (icon) 1897 // { 1898 // ... | K | unsigned int | Icon Data 1899 // } 1900 1901 // Read icons data directly over guiIcons data array 1902 1903 // Draw selected icon using rectangles pixel-by-pixel 1904 1905 // Get icon bit data 1906 // NOTE: Bit data array grouped as unsigned int (ICON_SIZE*ICON_SIZE/32 elements) 1907 1908 // Set icon bit data 1909 // NOTE: Data must be provided as unsigned int array (ICON_SIZE*ICON_SIZE/32 elements) 1910 1911 // Set icon pixel value 1912 1913 // This logic works for any RICON_SIZE pixels icons, 1914 // For example, in case of 16x16 pixels, every 2 lines fit in one unsigned int data element 1915 1916 // Clear icon pixel value 1917 1918 // This logic works for any RICON_SIZE pixels icons, 1919 // For example, in case of 16x16 pixels, every 2 lines fit in one unsigned int data element 1920 1921 // Check icon pixel value 1922 1923 // !RAYGUI_NO_RICONS 1924 1925 //---------------------------------------------------------------------------------- 1926 // Module specific Functions Definition 1927 //---------------------------------------------------------------------------------- 1928 // Gui get text width using default font 1929 // NOTE: Icon is not considered here 1930 1931 // Get text bounds considering control bounds 1932 1933 // Consider TEXT_PADDING properly, depends on control type and TEXT_ALIGNMENT 1934 1935 // NOTE: ValueBox text value always centered, text padding applies to label 1936 1937 // TODO: Special cases (no label): COMBOBOX, DROPDOWNBOX, LISTVIEW (scrollbar?) 1938 // More special cases (label on side): CHECKBOX, SLIDER, VALUEBOX, SPINNER 1939 1940 // Get text icon if provided and move text cursor 1941 // NOTE: We support up to 999 values for iconId 1942 1943 // Maybe we have an icon! 1944 1945 // Maximum length for icon value: 3 digits + '\0' 1946 1947 // Move text pointer after icon 1948 // WARNING: If only icon provided, it could point to EOL character: '\0' 1949 1950 // Gui draw text using default font 1951 1952 // Vertical alignment for pixel perfect 1953 1954 // Check text for icon and move cursor 1955 1956 // Get text position depending on alignment and iconId 1957 //--------------------------------------------------------------------------------- 1958 1959 // NOTE: We get text size after icon has been processed 1960 1961 // If text requires an icon, add size to measure 1962 1963 // WARNING: If only icon provided, text could be pointing to EOF character: '\0' 1964 1965 // Check guiTextAlign global variables 1966 1967 // NOTE: Make sure we get pixel-perfect coordinates, 1968 // In case of decimals we got weird text positioning 1969 1970 //--------------------------------------------------------------------------------- 1971 1972 // Draw text (with icon if available) 1973 //--------------------------------------------------------------------------------- 1974 1975 // NOTE: We consider icon height, probably different than text size 1976 1977 //--------------------------------------------------------------------------------- 1978 1979 // Gui draw rectangle using default raygui plain style with borders 1980 1981 // Draw rectangle filled with color 1982 1983 // Draw rectangle border lines with color 1984 1985 // Split controls text into multiple strings 1986 // Also check for multiple columns (required by GuiToggleGroup()) 1987 1988 // NOTE: Current implementation returns a copy of the provided string with '\0' (string end delimiter) 1989 // inserted between strings defined by "delimiter" parameter. No memory is dynamically allocated, 1990 // all used memory is static... it has some limitations: 1991 // 1. Maximum number of possible split strings is set by TEXTSPLIT_MAX_TEXT_ELEMENTS 1992 // 2. Maximum size of text to split is TEXTSPLIT_MAX_TEXT_LENGTH 1993 // NOTE: Those definitions could be externally provided if required 1994 1995 // Count how many substrings we have on text and point to every one 1996 1997 // Set an end of string at this point 1998 1999 // Convert color data from RGB to HSV 2000 // NOTE: Color data should be passed normalized 2001 2002 // Value 2003 2004 // Undefined, maybe NAN? 2005 2006 // NOTE: If max is 0, this divide would cause a crash 2007 // Saturation 2008 2009 // NOTE: If max is 0, then r = g = b = 0, s = 0, h is undefined 2010 2011 // Undefined, maybe NAN? 2012 2013 // NOTE: Comparing float values could not work properly 2014 // Between yellow & magenta 2015 2016 // Between cyan & yellow 2017 // Between magenta & cyan 2018 2019 // Convert to degrees 2020 2021 // Convert color data from HSV to RGB 2022 // NOTE: Color data should be passed normalized 2023 2024 // NOTE: Comparing float values could not work properly 2025 2026 // Returns a Color struct from hexadecimal value 2027 2028 // Returns hexadecimal value for a Color 2029 2030 // Check if point is inside rectangle 2031 2032 // Color fade-in or fade-out, alpha goes from 0.0f to 1.0f 2033 2034 // Formatting of text with variables to 'embed' 2035 2036 // Draw rectangle with vertical gradient fill color 2037 // NOTE: This function is only used by GuiColorPicker() 2038 2039 // Size of static buffer: TextSplit() 2040 // Size of static pointers array: TextSplit() 2041 2042 // Split string into multiple strings 2043 2044 // NOTE: Current implementation returns a copy of the provided string with '\0' (string end delimiter) 2045 // inserted between strings defined by "delimiter" parameter. No memory is dynamically allocated, 2046 // all used memory is static... it has some limitations: 2047 // 1. Maximum number of possible split strings is set by TEXTSPLIT_MAX_SUBSTRINGS_COUNT 2048 // 2. Maximum size of text to split is TEXTSPLIT_MAX_TEXT_BUFFER_LENGTH 2049 2050 // Count how many substrings we have on text and point to every one 2051 2052 // Set an end of string at this point 2053 2054 // Get integer value from text 2055 // NOTE: This function replaces atoi() [stdlib.h] 2056 2057 // Encode codepoint into UTF-8 text (char array size returned as parameter) 2058 2059 // Get next codepoint in a UTF-8 encoded text, scanning until '\0' is found 2060 // When a invalid UTF-8 byte is encountered we exit as soon as possible and a '?'(0x3f) codepoint is returned 2061 // Total number of bytes processed are returned as a parameter 2062 // NOTE: the standard says U+FFFD should be returned in case of errors 2063 // but that character is not supported by the default font in raylib 2064 2065 /* 2066 UTF-8 specs from https://www.ietf.org/rfc/rfc3629.txt 2067 2068 Char. number range | UTF-8 octet sequence 2069 (hexadecimal) | (binary) 2070 --------------------+--------------------------------------------- 2071 0000 0000-0000 007F | 0xxxxxxx 2072 0000 0080-0000 07FF | 110xxxxx 10xxxxxx 2073 0000 0800-0000 FFFF | 1110xxxx 10xxxxxx 10xxxxxx 2074 0001 0000-0010 FFFF | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx 2075 */ 2076 // NOTE: on decode errors we return as soon as possible 2077 2078 // Codepoint (defaults to '?') 2079 // The first UTF8 octet 2080 2081 // Only one octet (ASCII range x00-7F) 2082 2083 // Two octets 2084 2085 // [0]xC2-DF [1]UTF8-tail(x80-BF) 2086 2087 // Unexpected sequence 2088 2089 // Three octets 2090 2091 // Unexpected sequence 2092 2093 // Unexpected sequence 2094 2095 // [0]xE0 [1]xA0-BF [2]UTF8-tail(x80-BF) 2096 // [0]xE1-EC [1]UTF8-tail [2]UTF8-tail(x80-BF) 2097 // [0]xED [1]x80-9F [2]UTF8-tail(x80-BF) 2098 // [0]xEE-EF [1]UTF8-tail [2]UTF8-tail(x80-BF) 2099 2100 // Four octets 2101 2102 // Unexpected sequence 2103 2104 // Unexpected sequence 2105 2106 // Unexpected sequence 2107 2108 // [0]xF0 [1]x90-BF [2]UTF8-tail [3]UTF8-tail 2109 // [0]xF1-F3 [1]UTF8-tail [2]UTF8-tail [3]UTF8-tail 2110 // [0]xF4 [1]x80-8F [2]UTF8-tail [3]UTF8-tail 2111 2112 // Unexpected sequence 2113 2114 // Codepoints after U+10ffff are invalid 2115 2116 // RAYGUI_STANDALONE 2117 2118 // RAYGUI_IMPLEMENTATION