Wise&mystical  1.0
Project about Europe
Loading...
Searching...
No Matches
raygui.h
Go to the documentation of this file.
1
182#ifndef RAYGUI_H
183#define RAYGUI_H
184
185#define RAYGUI_VERSION "3.0"
186
187#if !defined(RAYGUI_STANDALONE)
188 #include "raylib.h"
189#endif
190
191// Function specifiers in case library is build/used as a shared library (Windows)
192// NOTE: Microsoft specifiers to tell compiler that symbols are imported/exported from a .dll
193#if defined(_WIN32)
194 #if defined(BUILD_LIBTYPE_SHARED)
195 #define RAYGUIAPI __declspec(dllexport) // We are building the library as a Win32 shared library (.dll)
196 #elif defined(USE_LIBTYPE_SHARED)
197 #define RAYGUIAPI __declspec(dllimport) // We are using the library as a Win32 shared library (.dll)
198 #endif
199#endif
200
201// Function specifiers definition
202#ifndef RAYGUIAPI
203 #define RAYGUIAPI // Functions defined as 'extern' by default (implicit specifiers)
204#endif
205
206//----------------------------------------------------------------------------------
207// Defines and Macros
208//----------------------------------------------------------------------------------
209
210// Allow custom memory allocators
211#ifndef RAYGUI_MALLOC
212 #define RAYGUI_MALLOC(sz) malloc(sz)
213#endif
214#ifndef RAYGUI_CALLOC
215 #define RAYGUI_CALLOC(n,sz) calloc(n,sz)
216#endif
217#ifndef RAYGUI_FREE
218 #define RAYGUI_FREE(p) free(p)
219#endif
220
221// TODO: Implement custom TraceLog()
222#define TRACELOG(level, ...) (void)0
223
224//----------------------------------------------------------------------------------
225// Types and Structures Definition
226// NOTE: Some types are required for RAYGUI_STANDALONE usage
227//----------------------------------------------------------------------------------
228#if defined(RAYGUI_STANDALONE)
229 #ifndef __cplusplus
230 // Boolean type
231 #ifndef true
232 typedef enum { false, true } bool;
233 #endif
234 #endif
235
236 // Vector2 type
237 typedef struct Vector2 {
238 float x;
239 float y;
240 } Vector2;
241
242 // Vector3 type // -- ConvertHSVtoRGB(), ConvertRGBtoHSV()
243 typedef struct Vector3 {
244 float x;
245 float y;
246 float z;
247 } Vector3;
248
249 // Color type, RGBA (32bit)
250 typedef struct Color {
251 unsigned char r;
252 unsigned char g;
253 unsigned char b;
254 unsigned char a;
255 } Color;
256
257 // Rectangle type
258 typedef struct Rectangle {
259 float x;
260 float y;
261 float width;
262 float height;
263 } Rectangle;
264
265 // TODO: Texture2D type is very coupled to raylib, required by Font type
266 // It should be redesigned to be provided by user
267 typedef struct Texture2D {
268 unsigned int id; // OpenGL texture id
269 int width; // Texture base width
270 int height; // Texture base height
271 int mipmaps; // Mipmap levels, 1 by default
272 int format; // Data format (PixelFormat type)
273 } Texture2D;
274
275 // GlyphInfo, font characters glyphs info
276 typedef struct GlyphInfo {
277 int value; // Character value (Unicode)
278 int offsetX; // Character offset X when drawing
279 int offsetY; // Character offset Y when drawing
280 int advanceX; // Character advance position X
281 Image image; // Character image data
282 } GlyphInfo;
283
284 // TODO: Font type is very coupled to raylib, mostly required by GuiLoadStyle()
285 // It should be redesigned to be provided by user
286 typedef struct Font {
287 int baseSize; // Base size (default chars height)
288 int glyphCount; // Number of characters
289 Texture2D texture; // Characters texture atlas
290 Rectangle *recs; // Characters rectangles in texture
291 GlyphInfo *chars; // Characters info data
292 } Font;
293#endif
294
295// Style property
296typedef struct GuiStyleProp {
297 unsigned short controlId;
298 unsigned short propertyId;
301
302// Gui control state
303typedef enum {
309
310// Gui control text alignment
311typedef enum {
316
317// Gui controls
318typedef enum {
319 DEFAULT = 0, // Generic control -> populates to all controls when set
320 LABEL, // Used also for: LABELBUTTON
322 TOGGLE, // Used also for: TOGGLEGROUP
323 SLIDER, // Used also for: SLIDERBAR
328 TEXTBOX, // Used also for: TEXTBOXMULTI
336
337// Gui base properties for every control
338// NOTE: RAYGUI_MAX_PROPS_BASE properties (by default 16 properties)
339typedef enum {
357
358// Gui extended properties depend on control
359// NOTE: RAYGUI_MAX_PROPS_EXTENDED properties (by default 8 properties)
360
361// DEFAULT extended properties
362// NOTE: Those properties are actually common to all controls
363typedef enum {
369
370// Label
371//typedef enum { } GuiLabelProperty;
372
373// Button
374//typedef enum { } GuiButtonProperty;
375
376// Toggle/ToggleGroup
377typedef enum {
380
381// Slider/SliderBar
382typedef enum {
386
387// ProgressBar
388typedef enum {
391
392// CheckBox
393typedef enum {
394 CHECK_PADDING = 16
396
397// ComboBox
398typedef enum {
402
403// DropdownBox
404typedef enum {
408
409// TextBox/TextBoxMulti/ValueBox/Spinner
410typedef enum {
416
417// Spinner
418typedef enum {
422
423// ScrollBar
424typedef enum {
432
433// ScrollBar side
434typedef enum {
438
439// ListView
440typedef enum {
446
447// ColorPicker
448typedef enum {
450 HUEBAR_WIDTH, // Right hue bar width
451 HUEBAR_PADDING, // Right hue bar separation from panel
452 HUEBAR_SELECTOR_HEIGHT, // Right hue bar selector height
453 HUEBAR_SELECTOR_OVERFLOW // Right hue bar selector overflow
455
456//----------------------------------------------------------------------------------
457// Global Variables Definition
458//----------------------------------------------------------------------------------
459// ...
460
461//----------------------------------------------------------------------------------
462// Module Functions Declaration
463//----------------------------------------------------------------------------------
464
465#if defined(__cplusplus)
466extern "C" { // Prevents name mangling of functions
467#endif
468
469// Global gui state control functions
470RAYGUIAPI void GuiEnable(void); // Enable gui controls (global state)
471RAYGUIAPI void GuiDisable(void); // Disable gui controls (global state)
472RAYGUIAPI void GuiLock(void); // Lock gui controls (global state)
473RAYGUIAPI void GuiUnlock(void); // Unlock gui controls (global state)
474RAYGUIAPI bool GuiIsLocked(void); // Check if gui is locked (global state)
475RAYGUIAPI void GuiFade(float alpha); // Set gui controls alpha (global state), alpha goes from 0.0f to 1.0f
476RAYGUIAPI void GuiSetState(int state); // Set gui state (global state)
477RAYGUIAPI int GuiGetState(void); // Get gui state (global state)
478
479// Font set/get functions
480RAYGUIAPI void GuiSetFont(Font font); // Set gui custom font (global state)
481RAYGUIAPI Font GuiGetFont(void); // Get gui custom font (global state)
482
483// Style set/get functions
484RAYGUIAPI void GuiSetStyle(int control, int property, int value); // Set one style property
485RAYGUIAPI int GuiGetStyle(int control, int property); // Get one style property
486
487// Container/separator controls, useful for controls organization
488RAYGUIAPI bool GuiWindowBox(Rectangle bounds, const char *title); // Window Box control, shows a window that can be closed
489RAYGUIAPI void GuiGroupBox(Rectangle bounds, const char *text); // Group Box control with text name
490RAYGUIAPI void GuiLine(Rectangle bounds, const char *text); // Line separator control, could contain text
491RAYGUIAPI void GuiPanel(Rectangle bounds); // Panel control, useful to group controls
492RAYGUIAPI Rectangle GuiScrollPanel(Rectangle bounds, Rectangle content, Vector2 *scroll); // Scroll Panel control
493
494// Basic controls set
495RAYGUIAPI void GuiLabel(Rectangle bounds, const char *text); // Label control, shows text
496RAYGUIAPI bool GuiButton(Rectangle bounds, const char *text); // Button control, returns true when clicked
497RAYGUIAPI bool GuiLabelButton(Rectangle bounds, const char *text); // Label button control, show true when clicked
498RAYGUIAPI bool GuiToggle(Rectangle bounds, const char *text, bool active); // Toggle Button control, returns true when active
499RAYGUIAPI int GuiToggleGroup(Rectangle bounds, const char *text, int active); // Toggle Group control, returns active toggle index
500RAYGUIAPI bool GuiCheckBox(Rectangle bounds, const char *text, bool checked); // Check Box control, returns true when active
501RAYGUIAPI int GuiComboBox(Rectangle bounds, const char *text, int active); // Combo Box control, returns selected item index
502RAYGUIAPI bool GuiDropdownBox(Rectangle bounds, const char *text, int *active, bool editMode); // Dropdown Box control, returns selected item
503RAYGUIAPI bool GuiSpinner(Rectangle bounds, const char *text, int *value, int minValue, int maxValue, bool editMode); // Spinner control, returns selected value
504RAYGUIAPI bool GuiValueBox(Rectangle bounds, const char *text, int *value, int minValue, int maxValue, bool editMode); // Value Box control, updates input text with numbers
505RAYGUIAPI bool GuiTextBox(Rectangle bounds, char *text, int textSize, bool editMode); // Text Box control, updates input text
506RAYGUIAPI bool GuiTextBoxMulti(Rectangle bounds, char *text, int textSize, bool editMode); // Text Box control with multiple lines
507RAYGUIAPI float GuiSlider(Rectangle bounds, const char *textLeft, const char *textRight, float value, float minValue, float maxValue); // Slider control, returns selected value
508RAYGUIAPI float GuiSliderBar(Rectangle bounds, const char *textLeft, const char *textRight, float value, float minValue, float maxValue); // Slider Bar control, returns selected value
509RAYGUIAPI float GuiProgressBar(Rectangle bounds, const char *textLeft, const char *textRight, float value, float minValue, float maxValue); // Progress Bar control, shows current progress value
510RAYGUIAPI void GuiStatusBar(Rectangle bounds, const char *text); // Status Bar control, shows info text
511RAYGUIAPI void GuiDummyRec(Rectangle bounds, const char *text); // Dummy control for placeholders
512RAYGUIAPI int GuiScrollBar(Rectangle bounds, int value, int minValue, int maxValue); // Scroll Bar control
513RAYGUIAPI Vector2 GuiGrid(Rectangle bounds, float spacing, int subdivs); // Grid control
514
515
516// Advance controls set
517RAYGUIAPI int GuiListView(Rectangle bounds, const char *text, int *scrollIndex, int active); // List View control, returns selected list item index
518RAYGUIAPI int GuiListViewEx(Rectangle bounds, const char **text, int count, int *focus, int *scrollIndex, int active); // List View with extended parameters
519RAYGUIAPI int GuiMessageBox(Rectangle bounds, const char *title, const char *message, const char *buttons); // Message Box control, displays a message
520RAYGUIAPI int GuiTextInputBox(Rectangle bounds, const char *title, const char *message, const char *buttons, char *text); // Text Input Box control, ask for text
521RAYGUIAPI Color GuiColorPicker(Rectangle bounds, Color color); // Color Picker control (multiple color controls)
522RAYGUIAPI Color GuiColorPanel(Rectangle bounds, Color color); // Color Panel control
523RAYGUIAPI float GuiColorBarAlpha(Rectangle bounds, float alpha); // Color Bar Alpha control
524RAYGUIAPI float GuiColorBarHue(Rectangle bounds, float value); // Color Bar Hue control
525
526// Styles loading functions
527RAYGUIAPI void GuiLoadStyle(const char *fileName); // Load style file over global style variable (.rgs)
528RAYGUIAPI void GuiLoadStyleDefault(void); // Load style default over global style
529
530/*
531typedef GuiStyle (unsigned int *)
532RAYGUIAPI GuiStyle LoadGuiStyle(const char *fileName); // Load style from file (.rgs)
533RAYGUIAPI void UnloadGuiStyle(GuiStyle style); // Unload style
534*/
535
536RAYGUIAPI const char *GuiIconText(int iconId, const char *text); // Get text with icon id prepended (if supported)
537
538#if !defined(RAYGUI_NO_RICONS)
539// Gui icons functionality
540RAYGUIAPI void GuiDrawIcon(int iconId, int posX, int posY, int pixelSize, Color color);
541
542RAYGUIAPI unsigned int *GuiGetIcons(void); // Get full icons data pointer
543RAYGUIAPI unsigned int *GuiGetIconData(int iconId); // Get icon bit data
544RAYGUIAPI void GuiSetIconData(int iconId, unsigned int *data); // Set icon bit data
545
546RAYGUIAPI void GuiSetIconPixel(int iconId, int x, int y); // Set icon pixel value
547RAYGUIAPI void GuiClearIconPixel(int iconId, int x, int y); // Clear icon pixel value
548RAYGUIAPI bool GuiCheckIconPixel(int iconId, int x, int y); // Check icon pixel value
549#endif
550
551#if defined(__cplusplus)
552} // Prevents name mangling of functions
553#endif
554
555#endif // RAYGUI_H
556
557
563#if defined(RAYGUI_IMPLEMENTATION)
564
565#include <stdio.h> // Required for: FILE, fopen(), fclose(), fprintf(), feof(), fscanf(), vsprintf() [GuiLoadStyle(), GuiLoadIcons()]
566#include <stdlib.h> // Required for: malloc(), calloc(), free() [GuiLoadStyle(), GuiLoadIcons()]
567#include <string.h> // Required for: strlen() [GuiTextBox(), GuiTextBoxMulti(), GuiValueBox()], memset(), memcpy()
568#include <stdarg.h> // Required for: va_list, va_start(), vfprintf(), va_end() [TextFormat()]
569#include <math.h> // Required for: roundf() [GuiColorPicker()]
570
571#ifdef __cplusplus
572 #define RAYGUI_CLITERAL(name) name
573#else
574 #define RAYGUI_CLITERAL(name) (name)
575#endif
576
577#if !defined(RAYGUI_NO_RICONS)
578
579#if defined(RAYGUI_CUSTOM_RICONS)
580
581#define RICONS_IMPLEMENTATION
582#include "ricons.h" // External icons data provided, it can be generated with rGuiIcons tool
583
584#else // Embedded raygui icons, no external file provided
585
586#define RICON_SIZE 16 // Size of icons (squared)
587#define RICON_MAX_ICONS 256 // Maximum number of icons
588#define RICON_MAX_NAME_LENGTH 32 // Maximum length of icon name id
589
590// Icons data is defined by bit array (every bit represents one pixel)
591// Those arrays are stored as unsigned int data arrays, so every array
592// element defines 32 pixels (bits) of information
593// Number of elemens depend on RICON_SIZE (by default 16x16 pixels)
594#define RICON_DATA_ELEMENTS (RICON_SIZE*RICON_SIZE/32)
595
596//----------------------------------------------------------------------------------
597// Icons enumeration
598//----------------------------------------------------------------------------------
599typedef enum {
600 RICON_NONE = 0,
601 RICON_FOLDER_FILE_OPEN = 1,
602 RICON_FILE_SAVE_CLASSIC = 2,
603 RICON_FOLDER_OPEN = 3,
604 RICON_FOLDER_SAVE = 4,
605 RICON_FILE_OPEN = 5,
606 RICON_FILE_SAVE = 6,
607 RICON_FILE_EXPORT = 7,
608 RICON_FILE_NEW = 8,
609 RICON_FILE_DELETE = 9,
610 RICON_FILETYPE_TEXT = 10,
611 RICON_FILETYPE_AUDIO = 11,
612 RICON_FILETYPE_IMAGE = 12,
613 RICON_FILETYPE_PLAY = 13,
614 RICON_FILETYPE_VIDEO = 14,
615 RICON_FILETYPE_INFO = 15,
616 RICON_FILE_COPY = 16,
617 RICON_FILE_CUT = 17,
618 RICON_FILE_PASTE = 18,
619 RICON_CURSOR_HAND = 19,
620 RICON_CURSOR_POINTER = 20,
621 RICON_CURSOR_CLASSIC = 21,
622 RICON_PENCIL = 22,
623 RICON_PENCIL_BIG = 23,
624 RICON_BRUSH_CLASSIC = 24,
625 RICON_BRUSH_PAINTER = 25,
626 RICON_WATER_DROP = 26,
627 RICON_COLOR_PICKER = 27,
628 RICON_RUBBER = 28,
629 RICON_COLOR_BUCKET = 29,
630 RICON_TEXT_T = 30,
631 RICON_TEXT_A = 31,
632 RICON_SCALE = 32,
633 RICON_RESIZE = 33,
634 RICON_FILTER_POINT = 34,
635 RICON_FILTER_BILINEAR = 35,
636 RICON_CROP = 36,
637 RICON_CROP_ALPHA = 37,
638 RICON_SQUARE_TOGGLE = 38,
639 RICON_SYMMETRY = 39,
640 RICON_SYMMETRY_HORIZONTAL = 40,
641 RICON_SYMMETRY_VERTICAL = 41,
642 RICON_LENS = 42,
643 RICON_LENS_BIG = 43,
644 RICON_EYE_ON = 44,
645 RICON_EYE_OFF = 45,
646 RICON_FILTER_TOP = 46,
647 RICON_FILTER = 47,
648 RICON_TARGET_POINT = 48,
649 RICON_TARGET_SMALL = 49,
650 RICON_TARGET_BIG = 50,
651 RICON_TARGET_MOVE = 51,
652 RICON_CURSOR_MOVE = 52,
653 RICON_CURSOR_SCALE = 53,
654 RICON_CURSOR_SCALE_RIGHT = 54,
655 RICON_CURSOR_SCALE_LEFT = 55,
656 RICON_UNDO = 56,
657 RICON_REDO = 57,
658 RICON_REREDO = 58,
659 RICON_MUTATE = 59,
660 RICON_ROTATE = 60,
661 RICON_REPEAT = 61,
662 RICON_SHUFFLE = 62,
663 RICON_EMPTYBOX = 63,
664 RICON_TARGET = 64,
665 RICON_TARGET_SMALL_FILL = 65,
666 RICON_TARGET_BIG_FILL = 66,
667 RICON_TARGET_MOVE_FILL = 67,
668 RICON_CURSOR_MOVE_FILL = 68,
669 RICON_CURSOR_SCALE_FILL = 69,
670 RICON_CURSOR_SCALE_RIGHT_FILL = 70,
671 RICON_CURSOR_SCALE_LEFT_FILL = 71,
672 RICON_UNDO_FILL = 72,
673 RICON_REDO_FILL = 73,
674 RICON_REREDO_FILL = 74,
675 RICON_MUTATE_FILL = 75,
676 RICON_ROTATE_FILL = 76,
677 RICON_REPEAT_FILL = 77,
678 RICON_SHUFFLE_FILL = 78,
679 RICON_EMPTYBOX_SMALL = 79,
680 RICON_BOX = 80,
681 RICON_BOX_TOP = 81,
682 RICON_BOX_TOP_RIGHT = 82,
683 RICON_BOX_RIGHT = 83,
684 RICON_BOX_BOTTOM_RIGHT = 84,
685 RICON_BOX_BOTTOM = 85,
686 RICON_BOX_BOTTOM_LEFT = 86,
687 RICON_BOX_LEFT = 87,
688 RICON_BOX_TOP_LEFT = 88,
689 RICON_BOX_CENTER = 89,
690 RICON_BOX_CIRCLE_MASK = 90,
691 RICON_POT = 91,
692 RICON_ALPHA_MULTIPLY = 92,
693 RICON_ALPHA_CLEAR = 93,
694 RICON_DITHERING = 94,
695 RICON_MIPMAPS = 95,
696 RICON_BOX_GRID = 96,
697 RICON_GRID = 97,
698 RICON_BOX_CORNERS_SMALL = 98,
699 RICON_BOX_CORNERS_BIG = 99,
700 RICON_FOUR_BOXES = 100,
701 RICON_GRID_FILL = 101,
702 RICON_BOX_MULTISIZE = 102,
703 RICON_ZOOM_SMALL = 103,
704 RICON_ZOOM_MEDIUM = 104,
705 RICON_ZOOM_BIG = 105,
706 RICON_ZOOM_ALL = 106,
707 RICON_ZOOM_CENTER = 107,
708 RICON_BOX_DOTS_SMALL = 108,
709 RICON_BOX_DOTS_BIG = 109,
710 RICON_BOX_CONCENTRIC = 110,
711 RICON_BOX_GRID_BIG = 111,
712 RICON_OK_TICK = 112,
713 RICON_CROSS = 113,
714 RICON_ARROW_LEFT = 114,
715 RICON_ARROW_RIGHT = 115,
716 RICON_ARROW_DOWN = 116,
717 RICON_ARROW_UP = 117,
718 RICON_ARROW_LEFT_FILL = 118,
719 RICON_ARROW_RIGHT_FILL = 119,
720 RICON_ARROW_DOWN_FILL = 120,
721 RICON_ARROW_UP_FILL = 121,
722 RICON_AUDIO = 122,
723 RICON_FX = 123,
724 RICON_WAVE = 124,
725 RICON_WAVE_SINUS = 125,
726 RICON_WAVE_SQUARE = 126,
727 RICON_WAVE_TRIANGULAR = 127,
728 RICON_CROSS_SMALL = 128,
729 RICON_PLAYER_PREVIOUS = 129,
730 RICON_PLAYER_PLAY_BACK = 130,
731 RICON_PLAYER_PLAY = 131,
732 RICON_PLAYER_PAUSE = 132,
733 RICON_PLAYER_STOP = 133,
734 RICON_PLAYER_NEXT = 134,
735 RICON_PLAYER_RECORD = 135,
736 RICON_MAGNET = 136,
737 RICON_LOCK_CLOSE = 137,
738 RICON_LOCK_OPEN = 138,
739 RICON_CLOCK = 139,
740 RICON_TOOLS = 140,
741 RICON_GEAR = 141,
742 RICON_GEAR_BIG = 142,
743 RICON_BIN = 143,
744 RICON_HAND_POINTER = 144,
745 RICON_LASER = 145,
746 RICON_COIN = 146,
747 RICON_EXPLOSION = 147,
748 RICON_1UP = 148,
749 RICON_PLAYER = 149,
750 RICON_PLAYER_JUMP = 150,
751 RICON_KEY = 151,
752 RICON_DEMON = 152,
753 RICON_TEXT_POPUP = 153,
754 RICON_GEAR_EX = 154,
755 RICON_CRACK = 155,
756 RICON_CRACK_POINTS = 156,
757 RICON_STAR = 157,
758 RICON_DOOR = 158,
759 RICON_EXIT = 159,
760 RICON_MODE_2D = 160,
761 RICON_MODE_3D = 161,
762 RICON_CUBE = 162,
763 RICON_CUBE_FACE_TOP = 163,
764 RICON_CUBE_FACE_LEFT = 164,
765 RICON_CUBE_FACE_FRONT = 165,
766 RICON_CUBE_FACE_BOTTOM = 166,
767 RICON_CUBE_FACE_RIGHT = 167,
768 RICON_CUBE_FACE_BACK = 168,
769 RICON_CAMERA = 169,
770 RICON_SPECIAL = 170,
771 RICON_LINK_NET = 171,
772 RICON_LINK_BOXES = 172,
773 RICON_LINK_MULTI = 173,
774 RICON_LINK = 174,
775 RICON_LINK_BROKE = 175,
776 RICON_TEXT_NOTES = 176,
777 RICON_NOTEBOOK = 177,
778 RICON_SUITCASE = 178,
779 RICON_SUITCASE_ZIP = 179,
780 RICON_MAILBOX = 180,
781 RICON_MONITOR = 181,
782 RICON_PRINTER = 182,
783 RICON_PHOTO_CAMERA = 183,
784 RICON_PHOTO_CAMERA_FLASH = 184,
785 RICON_HOUSE = 185,
786 RICON_HEART = 186,
787 RICON_CORNER = 187,
788 RICON_VERTICAL_BARS = 188,
789 RICON_VERTICAL_BARS_FILL = 189,
790 RICON_LIFE_BARS = 190,
791 RICON_INFO = 191,
792 RICON_CROSSLINE = 192,
793 RICON_HELP = 193,
794 RICON_FILETYPE_ALPHA = 194,
795 RICON_FILETYPE_HOME = 195,
796 RICON_LAYERS_VISIBLE = 196,
797 RICON_LAYERS = 197,
798 RICON_WINDOW = 198,
799 RICON_HIDPI = 199,
800 RICON_200 = 200,
801 RICON_201 = 201,
802 RICON_202 = 202,
803 RICON_203 = 203,
804 RICON_204 = 204,
805 RICON_205 = 205,
806 RICON_206 = 206,
807 RICON_207 = 207,
808 RICON_208 = 208,
809 RICON_209 = 209,
810 RICON_210 = 210,
811 RICON_211 = 211,
812 RICON_212 = 212,
813 RICON_213 = 213,
814 RICON_214 = 214,
815 RICON_215 = 215,
816 RICON_216 = 216,
817 RICON_217 = 217,
818 RICON_218 = 218,
819 RICON_219 = 219,
820 RICON_220 = 220,
821 RICON_221 = 221,
822 RICON_222 = 222,
823 RICON_223 = 223,
824 RICON_224 = 224,
825 RICON_225 = 225,
826 RICON_226 = 226,
827 RICON_227 = 227,
828 RICON_228 = 228,
829 RICON_229 = 229,
830 RICON_230 = 230,
831 RICON_231 = 231,
832 RICON_232 = 232,
833 RICON_233 = 233,
834 RICON_234 = 234,
835 RICON_235 = 235,
836 RICON_236 = 236,
837 RICON_237 = 237,
838 RICON_238 = 238,
839 RICON_239 = 239,
840 RICON_240 = 240,
841 RICON_241 = 241,
842 RICON_242 = 242,
843 RICON_243 = 243,
844 RICON_244 = 244,
845 RICON_245 = 245,
846 RICON_246 = 246,
847 RICON_247 = 247,
848 RICON_248 = 248,
849 RICON_249 = 249,
850 RICON_250 = 250,
851 RICON_251 = 251,
852 RICON_252 = 252,
853 RICON_253 = 253,
854 RICON_254 = 254,
855 RICON_255 = 255,
856} guiIconName;
857
858//----------------------------------------------------------------------------------
859// Icons data for all gui possible icons (allocated on data segment by default)
860//
861// NOTE 1: Every icon is codified in binary form, using 1 bit per pixel, so,
862// every 16x16 icon requires 8 integers (16*16/32) to be stored
863//
864// NOTE 2: A new icon set could be loaded over this array using GuiLoadIcons(),
865// but loaded icons set must be same RICON_SIZE and no more than RICON_MAX_ICONS
866//
867// guiIcons size is by default: 256*(16*16/32) = 2048*4 = 8192 bytes = 8 KB
868//----------------------------------------------------------------------------------
869static unsigned int guiIcons[RICON_MAX_ICONS*RICON_DATA_ELEMENTS] = {
870 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_NONE
871 0x3ff80000, 0x2f082008, 0x2042207e, 0x40027fc2, 0x40024002, 0x40024002, 0x40024002, 0x00007ffe, // RICON_FOLDER_FILE_OPEN
872 0x3ffe0000, 0x44226422, 0x400247e2, 0x5ffa4002, 0x57ea500a, 0x500a500a, 0x40025ffa, 0x00007ffe, // RICON_FILE_SAVE_CLASSIC
873 0x00000000, 0x0042007e, 0x40027fc2, 0x40024002, 0x41024002, 0x44424282, 0x793e4102, 0x00000100, // RICON_FOLDER_OPEN
874 0x00000000, 0x0042007e, 0x40027fc2, 0x40024002, 0x41024102, 0x44424102, 0x793e4282, 0x00000000, // RICON_FOLDER_SAVE
875 0x3ff00000, 0x201c2010, 0x20042004, 0x21042004, 0x24442284, 0x21042104, 0x20042104, 0x00003ffc, // RICON_FILE_OPEN
876 0x3ff00000, 0x201c2010, 0x20042004, 0x21042004, 0x21042104, 0x22842444, 0x20042104, 0x00003ffc, // RICON_FILE_SAVE
877 0x3ff00000, 0x201c2010, 0x00042004, 0x20041004, 0x20844784, 0x00841384, 0x20042784, 0x00003ffc, // RICON_FILE_EXPORT
878 0x3ff00000, 0x201c2010, 0x20042004, 0x20042004, 0x22042204, 0x22042f84, 0x20042204, 0x00003ffc, // RICON_FILE_NEW
879 0x3ff00000, 0x201c2010, 0x20042004, 0x20042004, 0x25042884, 0x25042204, 0x20042884, 0x00003ffc, // RICON_FILE_DELETE
880 0x3ff00000, 0x201c2010, 0x20042004, 0x20042ff4, 0x20042ff4, 0x20042ff4, 0x20042004, 0x00003ffc, // RICON_FILETYPE_TEXT
881 0x3ff00000, 0x201c2010, 0x27042004, 0x244424c4, 0x26442444, 0x20642664, 0x20042004, 0x00003ffc, // RICON_FILETYPE_AUDIO
882 0x3ff00000, 0x201c2010, 0x26042604, 0x20042004, 0x35442884, 0x2414222c, 0x20042004, 0x00003ffc, // RICON_FILETYPE_IMAGE
883 0x3ff00000, 0x201c2010, 0x20c42004, 0x22442144, 0x22442444, 0x20c42144, 0x20042004, 0x00003ffc, // RICON_FILETYPE_PLAY
884 0x3ff00000, 0x3ffc2ff0, 0x3f3c2ff4, 0x3dbc2eb4, 0x3dbc2bb4, 0x3f3c2eb4, 0x3ffc2ff4, 0x00002ff4, // RICON_FILETYPE_VIDEO
885 0x3ff00000, 0x201c2010, 0x21842184, 0x21842004, 0x21842184, 0x21842184, 0x20042184, 0x00003ffc, // RICON_FILETYPE_INFO
886 0x0ff00000, 0x381c0810, 0x28042804, 0x28042804, 0x28042804, 0x28042804, 0x20102ffc, 0x00003ff0, // RICON_FILE_COPY
887 0x00000000, 0x701c0000, 0x079c1e14, 0x55a000f0, 0x079c00f0, 0x701c1e14, 0x00000000, 0x00000000, // RICON_FILE_CUT
888 0x01c00000, 0x13e41bec, 0x3f841004, 0x204420c4, 0x20442044, 0x20442044, 0x207c2044, 0x00003fc0, // RICON_FILE_PASTE
889 0x00000000, 0x3aa00fe0, 0x2abc2aa0, 0x2aa42aa4, 0x20042aa4, 0x20042004, 0x3ffc2004, 0x00000000, // RICON_CURSOR_HAND
890 0x00000000, 0x003c000c, 0x030800c8, 0x30100c10, 0x10202020, 0x04400840, 0x01800280, 0x00000000, // RICON_CURSOR_POINTER
891 0x00000000, 0x00180000, 0x01f00078, 0x03e007f0, 0x07c003e0, 0x04000e40, 0x00000000, 0x00000000, // RICON_CURSOR_CLASSIC
892 0x00000000, 0x04000000, 0x11000a00, 0x04400a80, 0x01100220, 0x00580088, 0x00000038, 0x00000000, // RICON_PENCIL
893 0x04000000, 0x15000a00, 0x50402880, 0x14102820, 0x05040a08, 0x015c028c, 0x007c00bc, 0x00000000, // RICON_PENCIL_BIG
894 0x01c00000, 0x01400140, 0x01400140, 0x0ff80140, 0x0ff80808, 0x0aa80808, 0x0aa80aa8, 0x00000ff8, // RICON_BRUSH_CLASSIC
895 0x1ffc0000, 0x5ffc7ffe, 0x40004000, 0x00807f80, 0x01c001c0, 0x01c001c0, 0x01c001c0, 0x00000080, // RICON_BRUSH_PAINTER
896 0x00000000, 0x00800000, 0x01c00080, 0x03e001c0, 0x07f003e0, 0x036006f0, 0x000001c0, 0x00000000, // RICON_WATER_DROP
897 0x00000000, 0x3e003800, 0x1f803f80, 0x0c201e40, 0x02080c10, 0x00840104, 0x00380044, 0x00000000, // RICON_COLOR_PICKER
898 0x00000000, 0x07800300, 0x1fe00fc0, 0x3f883fd0, 0x0e021f04, 0x02040402, 0x00f00108, 0x00000000, // RICON_RUBBER
899 0x00c00000, 0x02800140, 0x08200440, 0x20081010, 0x2ffe3004, 0x03f807fc, 0x00e001f0, 0x00000040, // RICON_COLOR_BUCKET
900 0x00000000, 0x21843ffc, 0x01800180, 0x01800180, 0x01800180, 0x01800180, 0x03c00180, 0x00000000, // RICON_TEXT_T
901 0x00800000, 0x01400180, 0x06200340, 0x0c100620, 0x1ff80c10, 0x380c1808, 0x70067004, 0x0000f80f, // RICON_TEXT_A
902 0x78000000, 0x50004000, 0x00004800, 0x03c003c0, 0x03c003c0, 0x00100000, 0x0002000a, 0x0000000e, // RICON_SCALE
903 0x75560000, 0x5e004002, 0x54001002, 0x41001202, 0x408200fe, 0x40820082, 0x40820082, 0x00006afe, // RICON_RESIZE
904 0x00000000, 0x3f003f00, 0x3f003f00, 0x3f003f00, 0x00400080, 0x001c0020, 0x001c001c, 0x00000000, // RICON_FILTER_POINT
905 0x6d800000, 0x00004080, 0x40804080, 0x40800000, 0x00406d80, 0x001c0020, 0x001c001c, 0x00000000, // RICON_FILTER_BILINEAR
906 0x40080000, 0x1ffe2008, 0x14081008, 0x11081208, 0x10481088, 0x10081028, 0x10047ff8, 0x00001002, // RICON_CROP
907 0x00100000, 0x3ffc0010, 0x2ab03550, 0x22b02550, 0x20b02150, 0x20302050, 0x2000fff0, 0x00002000, // RICON_CROP_ALPHA
908 0x40000000, 0x1ff82000, 0x04082808, 0x01082208, 0x00482088, 0x00182028, 0x35542008, 0x00000002, // RICON_SQUARE_TOGGLE
909 0x00000000, 0x02800280, 0x06c006c0, 0x0ea00ee0, 0x1e901eb0, 0x3e883e98, 0x7efc7e8c, 0x00000000, // RICON_SIMMETRY
910 0x01000000, 0x05600100, 0x1d480d50, 0x7d423d44, 0x3d447d42, 0x0d501d48, 0x01000560, 0x00000100, // RICON_SIMMETRY_HORIZONTAL
911 0x01800000, 0x04200240, 0x10080810, 0x00001ff8, 0x00007ffe, 0x0ff01ff8, 0x03c007e0, 0x00000180, // RICON_SIMMETRY_VERTICAL
912 0x00000000, 0x010800f0, 0x02040204, 0x02040204, 0x07f00308, 0x1c000e00, 0x30003800, 0x00000000, // RICON_LENS
913 0x00000000, 0x061803f0, 0x08240c0c, 0x08040814, 0x0c0c0804, 0x23f01618, 0x18002400, 0x00000000, // RICON_LENS_BIG
914 0x00000000, 0x00000000, 0x1c7007c0, 0x638e3398, 0x1c703398, 0x000007c0, 0x00000000, 0x00000000, // RICON_EYE_ON
915 0x00000000, 0x10002000, 0x04700fc0, 0x610e3218, 0x1c703098, 0x001007a0, 0x00000008, 0x00000000, // RICON_EYE_OFF
916 0x00000000, 0x00007ffc, 0x40047ffc, 0x10102008, 0x04400820, 0x02800280, 0x02800280, 0x00000100, // RICON_FILTER_TOP
917 0x00000000, 0x40027ffe, 0x10082004, 0x04200810, 0x02400240, 0x02400240, 0x01400240, 0x000000c0, // RICON_FILTER
918 0x00800000, 0x00800080, 0x00000080, 0x3c9e0000, 0x00000000, 0x00800080, 0x00800080, 0x00000000, // RICON_TARGET_POINT
919 0x00800000, 0x00800080, 0x00800080, 0x3f7e01c0, 0x008001c0, 0x00800080, 0x00800080, 0x00000000, // RICON_TARGET_SMALL
920 0x00800000, 0x00800080, 0x03e00080, 0x3e3e0220, 0x03e00220, 0x00800080, 0x00800080, 0x00000000, // RICON_TARGET_BIG
921 0x01000000, 0x04400280, 0x01000100, 0x43842008, 0x43849ab2, 0x01002008, 0x04400100, 0x01000280, // RICON_TARGET_MOVE
922 0x01000000, 0x04400280, 0x01000100, 0x41042108, 0x41049ff2, 0x01002108, 0x04400100, 0x01000280, // RICON_CURSOR_MOVE
923 0x781e0000, 0x500a4002, 0x04204812, 0x00000240, 0x02400000, 0x48120420, 0x4002500a, 0x0000781e, // RICON_CURSOR_SCALE
924 0x00000000, 0x20003c00, 0x24002800, 0x01000200, 0x00400080, 0x00140024, 0x003c0004, 0x00000000, // RICON_CURSOR_SCALE_RIGHT
925 0x00000000, 0x0004003c, 0x00240014, 0x00800040, 0x02000100, 0x28002400, 0x3c002000, 0x00000000, // RICON_CURSOR_SCALE_LEFT
926 0x00000000, 0x00100020, 0x10101fc8, 0x10001020, 0x10001000, 0x10001000, 0x00001fc0, 0x00000000, // RICON_UNDO
927 0x00000000, 0x08000400, 0x080813f8, 0x00080408, 0x00080008, 0x00080008, 0x000003f8, 0x00000000, // RICON_REDO
928 0x00000000, 0x3ffc0000, 0x20042004, 0x20002000, 0x20402000, 0x3f902020, 0x00400020, 0x00000000, // RICON_REREDO
929 0x00000000, 0x3ffc0000, 0x20042004, 0x27fc2004, 0x20202000, 0x3fc82010, 0x00200010, 0x00000000, // RICON_MUTATE
930 0x00000000, 0x0ff00000, 0x10081818, 0x11801008, 0x10001180, 0x18101020, 0x00100fc8, 0x00000020, // RICON_ROTATE
931 0x00000000, 0x04000200, 0x240429fc, 0x20042204, 0x20442004, 0x3f942024, 0x00400020, 0x00000000, // RICON_REPEAT
932 0x00000000, 0x20001000, 0x22104c0e, 0x00801120, 0x11200040, 0x4c0e2210, 0x10002000, 0x00000000, // RICON_SHUFFLE
933 0x7ffe0000, 0x50024002, 0x44024802, 0x41024202, 0x40424082, 0x40124022, 0x4002400a, 0x00007ffe, // RICON_EMPTYBOX
934 0x00800000, 0x03e00080, 0x08080490, 0x3c9e0808, 0x08080808, 0x03e00490, 0x00800080, 0x00000000, // RICON_TARGET
935 0x00800000, 0x00800080, 0x00800080, 0x3ffe01c0, 0x008001c0, 0x00800080, 0x00800080, 0x00000000, // RICON_TARGET_SMALL_FILL
936 0x00800000, 0x00800080, 0x03e00080, 0x3ffe03e0, 0x03e003e0, 0x00800080, 0x00800080, 0x00000000, // RICON_TARGET_BIG_FILL
937 0x01000000, 0x07c00380, 0x01000100, 0x638c2008, 0x638cfbbe, 0x01002008, 0x07c00100, 0x01000380, // RICON_TARGET_MOVE_FILL
938 0x01000000, 0x07c00380, 0x01000100, 0x610c2108, 0x610cfffe, 0x01002108, 0x07c00100, 0x01000380, // RICON_CURSOR_MOVE_FILL
939 0x781e0000, 0x6006700e, 0x04204812, 0x00000240, 0x02400000, 0x48120420, 0x700e6006, 0x0000781e, // RICON_CURSOR_SCALE_FILL
940 0x00000000, 0x38003c00, 0x24003000, 0x01000200, 0x00400080, 0x000c0024, 0x003c001c, 0x00000000, // RICON_CURSOR_SCALE_RIGHT
941 0x00000000, 0x001c003c, 0x0024000c, 0x00800040, 0x02000100, 0x30002400, 0x3c003800, 0x00000000, // RICON_CURSOR_SCALE_LEFT
942 0x00000000, 0x00300020, 0x10301ff8, 0x10001020, 0x10001000, 0x10001000, 0x00001fc0, 0x00000000, // RICON_UNDO_FILL
943 0x00000000, 0x0c000400, 0x0c081ff8, 0x00080408, 0x00080008, 0x00080008, 0x000003f8, 0x00000000, // RICON_REDO_FILL
944 0x00000000, 0x3ffc0000, 0x20042004, 0x20002000, 0x20402000, 0x3ff02060, 0x00400060, 0x00000000, // RICON_REREDO_FILL
945 0x00000000, 0x3ffc0000, 0x20042004, 0x27fc2004, 0x20202000, 0x3ff82030, 0x00200030, 0x00000000, // RICON_MUTATE_FILL
946 0x00000000, 0x0ff00000, 0x10081818, 0x11801008, 0x10001180, 0x18301020, 0x00300ff8, 0x00000020, // RICON_ROTATE_FILL
947 0x00000000, 0x06000200, 0x26042ffc, 0x20042204, 0x20442004, 0x3ff42064, 0x00400060, 0x00000000, // RICON_REPEAT_FILL
948 0x00000000, 0x30001000, 0x32107c0e, 0x00801120, 0x11200040, 0x7c0e3210, 0x10003000, 0x00000000, // RICON_SHUFFLE_FILL
949 0x00000000, 0x30043ffc, 0x24042804, 0x21042204, 0x20442084, 0x20142024, 0x3ffc200c, 0x00000000, // RICON_EMPTYBOX_SMALL
950 0x00000000, 0x20043ffc, 0x20042004, 0x20042004, 0x20042004, 0x20042004, 0x3ffc2004, 0x00000000, // RICON_BOX
951 0x00000000, 0x23c43ffc, 0x23c423c4, 0x200423c4, 0x20042004, 0x20042004, 0x3ffc2004, 0x00000000, // RICON_BOX_TOP
952 0x00000000, 0x3e043ffc, 0x3e043e04, 0x20043e04, 0x20042004, 0x20042004, 0x3ffc2004, 0x00000000, // RICON_BOX_TOP_RIGHT
953 0x00000000, 0x20043ffc, 0x20042004, 0x3e043e04, 0x3e043e04, 0x20042004, 0x3ffc2004, 0x00000000, // RICON_BOX_RIGHT
954 0x00000000, 0x20043ffc, 0x20042004, 0x20042004, 0x3e042004, 0x3e043e04, 0x3ffc3e04, 0x00000000, // RICON_BOX_BOTTOM_RIGHT
955 0x00000000, 0x20043ffc, 0x20042004, 0x20042004, 0x23c42004, 0x23c423c4, 0x3ffc23c4, 0x00000000, // RICON_BOX_BOTTOM
956 0x00000000, 0x20043ffc, 0x20042004, 0x20042004, 0x207c2004, 0x207c207c, 0x3ffc207c, 0x00000000, // RICON_BOX_BOTTOM_LEFT
957 0x00000000, 0x20043ffc, 0x20042004, 0x207c207c, 0x207c207c, 0x20042004, 0x3ffc2004, 0x00000000, // RICON_BOX_LEFT
958 0x00000000, 0x207c3ffc, 0x207c207c, 0x2004207c, 0x20042004, 0x20042004, 0x3ffc2004, 0x00000000, // RICON_BOX_TOP_LEFT
959 0x00000000, 0x20043ffc, 0x20042004, 0x23c423c4, 0x23c423c4, 0x20042004, 0x3ffc2004, 0x00000000, // RICON_BOX_CIRCLE_MASK
960 0x7ffe0000, 0x40024002, 0x47e24182, 0x4ff247e2, 0x47e24ff2, 0x418247e2, 0x40024002, 0x00007ffe, // RICON_BOX_CENTER
961 0x7fff0000, 0x40014001, 0x40014001, 0x49555ddd, 0x4945495d, 0x400149c5, 0x40014001, 0x00007fff, // RICON_POT
962 0x7ffe0000, 0x53327332, 0x44ce4cce, 0x41324332, 0x404e40ce, 0x48125432, 0x4006540e, 0x00007ffe, // RICON_ALPHA_MULTIPLY
963 0x7ffe0000, 0x53327332, 0x44ce4cce, 0x41324332, 0x5c4e40ce, 0x44124432, 0x40065c0e, 0x00007ffe, // RICON_ALPHA_CLEAR
964 0x7ffe0000, 0x42fe417e, 0x42fe417e, 0x42fe417e, 0x42fe417e, 0x42fe417e, 0x42fe417e, 0x00007ffe, // RICON_DITHERING
965 0x07fe0000, 0x1ffa0002, 0x7fea000a, 0x402a402a, 0x5b2a512a, 0x5128552a, 0x40205128, 0x00007fe0, // RICON_MIPMAPS
966 0x00000000, 0x1ff80000, 0x12481248, 0x12481ff8, 0x1ff81248, 0x12481248, 0x00001ff8, 0x00000000, // RICON_BOX_GRID
967 0x12480000, 0x7ffe1248, 0x12481248, 0x12487ffe, 0x7ffe1248, 0x12481248, 0x12487ffe, 0x00001248, // RICON_GRID
968 0x00000000, 0x1c380000, 0x1c3817e8, 0x08100810, 0x08100810, 0x17e81c38, 0x00001c38, 0x00000000, // RICON_BOX_CORNERS_SMALL
969 0x700e0000, 0x700e5ffa, 0x20042004, 0x20042004, 0x20042004, 0x20042004, 0x5ffa700e, 0x0000700e, // RICON_BOX_CORNERS_BIG
970 0x3f7e0000, 0x21422142, 0x21422142, 0x00003f7e, 0x21423f7e, 0x21422142, 0x3f7e2142, 0x00000000, // RICON_FOUR_BOXES
971 0x00000000, 0x3bb80000, 0x3bb83bb8, 0x3bb80000, 0x3bb83bb8, 0x3bb80000, 0x3bb83bb8, 0x00000000, // RICON_GRID_FILL
972 0x7ffe0000, 0x7ffe7ffe, 0x77fe7000, 0x77fe77fe, 0x777e7700, 0x777e777e, 0x777e777e, 0x0000777e, // RICON_BOX_MULTISIZE
973 0x781e0000, 0x40024002, 0x00004002, 0x01800000, 0x00000180, 0x40020000, 0x40024002, 0x0000781e, // RICON_ZOOM_SMALL
974 0x781e0000, 0x40024002, 0x00004002, 0x03c003c0, 0x03c003c0, 0x40020000, 0x40024002, 0x0000781e, // RICON_ZOOM_MEDIUM
975 0x781e0000, 0x40024002, 0x07e04002, 0x07e007e0, 0x07e007e0, 0x400207e0, 0x40024002, 0x0000781e, // RICON_ZOOM_BIG
976 0x781e0000, 0x5ffa4002, 0x1ff85ffa, 0x1ff81ff8, 0x1ff81ff8, 0x5ffa1ff8, 0x40025ffa, 0x0000781e, // RICON_ZOOM_ALL
977 0x00000000, 0x2004381c, 0x00002004, 0x00000000, 0x00000000, 0x20040000, 0x381c2004, 0x00000000, // RICON_ZOOM_CENTER
978 0x00000000, 0x1db80000, 0x10081008, 0x10080000, 0x00001008, 0x10081008, 0x00001db8, 0x00000000, // RICON_BOX_DOTS_SMALL
979 0x35560000, 0x00002002, 0x00002002, 0x00002002, 0x00002002, 0x00002002, 0x35562002, 0x00000000, // RICON_BOX_DOTS_BIG
980 0x7ffe0000, 0x40024002, 0x48124ff2, 0x49924812, 0x48124992, 0x4ff24812, 0x40024002, 0x00007ffe, // RICON_BOX_CONCENTRIC
981 0x00000000, 0x10841ffc, 0x10841084, 0x1ffc1084, 0x10841084, 0x10841084, 0x00001ffc, 0x00000000, // RICON_BOX_GRID_BIG
982 0x00000000, 0x00000000, 0x10000000, 0x04000800, 0x01040200, 0x00500088, 0x00000020, 0x00000000, // RICON_OK_TICK
983 0x00000000, 0x10080000, 0x04200810, 0x01800240, 0x02400180, 0x08100420, 0x00001008, 0x00000000, // RICON_CROSS
984 0x00000000, 0x02000000, 0x00800100, 0x00200040, 0x00200010, 0x00800040, 0x02000100, 0x00000000, // RICON_ARROW_LEFT
985 0x00000000, 0x00400000, 0x01000080, 0x04000200, 0x04000800, 0x01000200, 0x00400080, 0x00000000, // RICON_ARROW_RIGHT
986 0x00000000, 0x00000000, 0x00000000, 0x08081004, 0x02200410, 0x00800140, 0x00000000, 0x00000000, // RICON_ARROW_DOWN
987 0x00000000, 0x00000000, 0x01400080, 0x04100220, 0x10040808, 0x00000000, 0x00000000, 0x00000000, // RICON_ARROW_UP
988 0x00000000, 0x02000000, 0x03800300, 0x03e003c0, 0x03e003f0, 0x038003c0, 0x02000300, 0x00000000, // RICON_ARROW_LEFT_FILL
989 0x00000000, 0x00400000, 0x01c000c0, 0x07c003c0, 0x07c00fc0, 0x01c003c0, 0x004000c0, 0x00000000, // RICON_ARROW_RIGHT_FILL
990 0x00000000, 0x00000000, 0x00000000, 0x0ff81ffc, 0x03e007f0, 0x008001c0, 0x00000000, 0x00000000, // RICON_ARROW_DOWN_FILL
991 0x00000000, 0x00000000, 0x01c00080, 0x07f003e0, 0x1ffc0ff8, 0x00000000, 0x00000000, 0x00000000, // RICON_ARROW_UP_FILL
992 0x00000000, 0x18a008c0, 0x32881290, 0x24822686, 0x26862482, 0x12903288, 0x08c018a0, 0x00000000, // RICON_AUDIO
993 0x00000000, 0x04800780, 0x004000c0, 0x662000f0, 0x08103c30, 0x130a0e18, 0x0000318e, 0x00000000, // RICON_FX
994 0x00000000, 0x00800000, 0x08880888, 0x2aaa0a8a, 0x0a8a2aaa, 0x08880888, 0x00000080, 0x00000000, // RICON_WAVE
995 0x00000000, 0x00600000, 0x01080090, 0x02040108, 0x42044204, 0x24022402, 0x00001800, 0x00000000, // RICON_WAVE_SINUS
996 0x00000000, 0x07f80000, 0x04080408, 0x04080408, 0x04080408, 0x7c0e0408, 0x00000000, 0x00000000, // RICON_WAVE_SQUARE
997 0x00000000, 0x00000000, 0x00a00040, 0x22084110, 0x08021404, 0x00000000, 0x00000000, 0x00000000, // RICON_WAVE_TRIANGULAR
998 0x00000000, 0x00000000, 0x04200000, 0x01800240, 0x02400180, 0x00000420, 0x00000000, 0x00000000, // RICON_CROSS_SMALL
999 0x00000000, 0x18380000, 0x12281428, 0x10a81128, 0x112810a8, 0x14281228, 0x00001838, 0x00000000, // RICON_PLAYER_PREVIOUS
1000 0x00000000, 0x18000000, 0x11801600, 0x10181060, 0x10601018, 0x16001180, 0x00001800, 0x00000000, // RICON_PLAYER_PLAY_BACK
1001 0x00000000, 0x00180000, 0x01880068, 0x18080608, 0x06081808, 0x00680188, 0x00000018, 0x00000000, // RICON_PLAYER_PLAY
1002 0x00000000, 0x1e780000, 0x12481248, 0x12481248, 0x12481248, 0x12481248, 0x00001e78, 0x00000000, // RICON_PLAYER_PAUSE
1003 0x00000000, 0x1ff80000, 0x10081008, 0x10081008, 0x10081008, 0x10081008, 0x00001ff8, 0x00000000, // RICON_PLAYER_STOP
1004 0x00000000, 0x1c180000, 0x14481428, 0x15081488, 0x14881508, 0x14281448, 0x00001c18, 0x00000000, // RICON_PLAYER_NEXT
1005 0x00000000, 0x03c00000, 0x08100420, 0x10081008, 0x10081008, 0x04200810, 0x000003c0, 0x00000000, // RICON_PLAYER_RECORD
1006 0x00000000, 0x0c3007e0, 0x13c81818, 0x14281668, 0x14281428, 0x1c381c38, 0x08102244, 0x00000000, // RICON_MAGNET
1007 0x07c00000, 0x08200820, 0x3ff80820, 0x23882008, 0x21082388, 0x20082108, 0x1ff02008, 0x00000000, // RICON_LOCK_CLOSE
1008 0x07c00000, 0x08000800, 0x3ff80800, 0x23882008, 0x21082388, 0x20082108, 0x1ff02008, 0x00000000, // RICON_LOCK_OPEN
1009 0x01c00000, 0x0c180770, 0x3086188c, 0x60832082, 0x60034781, 0x30062002, 0x0c18180c, 0x01c00770, // RICON_CLOCK
1010 0x0a200000, 0x1b201b20, 0x04200e20, 0x04200420, 0x04700420, 0x0e700e70, 0x0e700e70, 0x04200e70, // RICON_TOOLS
1011 0x01800000, 0x3bdc318c, 0x0ff01ff8, 0x7c3e1e78, 0x1e787c3e, 0x1ff80ff0, 0x318c3bdc, 0x00000180, // RICON_GEAR
1012 0x01800000, 0x3ffc318c, 0x1c381ff8, 0x781e1818, 0x1818781e, 0x1ff81c38, 0x318c3ffc, 0x00000180, // RICON_GEAR_BIG
1013 0x00000000, 0x08080ff8, 0x08081ffc, 0x0aa80aa8, 0x0aa80aa8, 0x0aa80aa8, 0x08080aa8, 0x00000ff8, // RICON_BIN
1014 0x00000000, 0x00000000, 0x20043ffc, 0x08043f84, 0x04040f84, 0x04040784, 0x000007fc, 0x00000000, // RICON_HAND_POINTER
1015 0x00000000, 0x24400400, 0x00001480, 0x6efe0e00, 0x00000e00, 0x24401480, 0x00000400, 0x00000000, // RICON_LASER
1016 0x00000000, 0x03c00000, 0x08300460, 0x11181118, 0x11181118, 0x04600830, 0x000003c0, 0x00000000, // RICON_COIN
1017 0x00000000, 0x10880080, 0x06c00810, 0x366c07e0, 0x07e00240, 0x00001768, 0x04200240, 0x00000000, // RICON_EXPLOSION
1018 0x00000000, 0x3d280000, 0x2528252c, 0x3d282528, 0x05280528, 0x05e80528, 0x00000000, 0x00000000, // RICON_1UP
1019 0x01800000, 0x03c003c0, 0x018003c0, 0x0ff007e0, 0x0bd00bd0, 0x0a500bd0, 0x02400240, 0x02400240, // RICON_PLAYER
1020 0x01800000, 0x03c003c0, 0x118013c0, 0x03c81ff8, 0x07c003c8, 0x04400440, 0x0c080478, 0x00000000, // RICON_PLAYER_JUMP
1021 0x3ff80000, 0x30183ff8, 0x30183018, 0x3ff83ff8, 0x03000300, 0x03c003c0, 0x03e00300, 0x000003e0, // RICON_KEY
1022 0x3ff80000, 0x3ff83ff8, 0x33983ff8, 0x3ff83398, 0x3ff83ff8, 0x00000540, 0x0fe00aa0, 0x00000fe0, // RICON_DEMON
1023 0x00000000, 0x0ff00000, 0x20041008, 0x25442004, 0x10082004, 0x06000bf0, 0x00000300, 0x00000000, // RICON_TEXT_POPUP
1024 0x00000000, 0x11440000, 0x07f00be8, 0x1c1c0e38, 0x1c1c0c18, 0x07f00e38, 0x11440be8, 0x00000000, // RICON_GEAR_EX
1025 0x00000000, 0x20080000, 0x0c601010, 0x07c00fe0, 0x07c007c0, 0x0c600fe0, 0x20081010, 0x00000000, // RICON_CRACK
1026 0x00000000, 0x20080000, 0x0c601010, 0x04400fe0, 0x04405554, 0x0c600fe0, 0x20081010, 0x00000000, // RICON_CRACK_POINTS
1027 0x00000000, 0x00800080, 0x01c001c0, 0x1ffc3ffe, 0x03e007f0, 0x07f003e0, 0x0c180770, 0x00000808, // RICON_STAR
1028 0x0ff00000, 0x08180810, 0x08100818, 0x0a100810, 0x08180810, 0x08100818, 0x08100810, 0x00001ff8, // RICON_DOOR
1029 0x0ff00000, 0x08100810, 0x08100810, 0x10100010, 0x4f902010, 0x10102010, 0x08100010, 0x00000ff0, // RICON_EXIT
1030 0x00040000, 0x001f000e, 0x0ef40004, 0x12f41284, 0x0ef41214, 0x10040004, 0x7ffc3004, 0x10003000, // RICON_MODE_2D
1031 0x78040000, 0x501f600e, 0x0ef44004, 0x12f41284, 0x0ef41284, 0x10140004, 0x7ffc300c, 0x10003000, // RICON_MODE_3D
1032 0x7fe00000, 0x50286030, 0x47fe4804, 0x44224402, 0x44224422, 0x241275e2, 0x0c06140a, 0x000007fe, // RICON_CUBE
1033 0x7fe00000, 0x5ff87ff0, 0x47fe4ffc, 0x44224402, 0x44224422, 0x241275e2, 0x0c06140a, 0x000007fe, // RICON_CUBE_FACE_TOP
1034 0x7fe00000, 0x50386030, 0x47fe483c, 0x443e443e, 0x443e443e, 0x241e75fe, 0x0c06140e, 0x000007fe, // RICON_CUBE_FACE_LEFT
1035 0x7fe00000, 0x50286030, 0x47fe4804, 0x47fe47fe, 0x47fe47fe, 0x27fe77fe, 0x0ffe17fe, 0x000007fe, // RICON_CUBE_FACE_FRONT
1036 0x7fe00000, 0x50286030, 0x47fe4804, 0x44224402, 0x44224422, 0x3ff27fe2, 0x0ffe1ffa, 0x000007fe, // RICON_CUBE_FACE_BOTTOM
1037 0x7fe00000, 0x70286030, 0x7ffe7804, 0x7c227c02, 0x7c227c22, 0x3c127de2, 0x0c061c0a, 0x000007fe, // RICON_CUBE_FACE_RIGHT
1038 0x7fe00000, 0x7fe87ff0, 0x7ffe7fe4, 0x7fe27fe2, 0x7fe27fe2, 0x24127fe2, 0x0c06140a, 0x000007fe, // RICON_CUBE_FACE_BACK
1039 0x00000000, 0x2a0233fe, 0x22022602, 0x22022202, 0x2a022602, 0x00a033fe, 0x02080110, 0x00000000, // RICON_CAMERA
1040 0x00000000, 0x200c3ffc, 0x000c000c, 0x3ffc000c, 0x30003000, 0x30003000, 0x3ffc3004, 0x00000000, // RICON_SPECIAL
1041 0x00000000, 0x0022003e, 0x012201e2, 0x0100013e, 0x01000100, 0x79000100, 0x4f004900, 0x00007800, // RICON_LINK_NET
1042 0x00000000, 0x44007c00, 0x45004600, 0x00627cbe, 0x00620022, 0x45007cbe, 0x44004600, 0x00007c00, // RICON_LINK_BOXES
1043 0x00000000, 0x0044007c, 0x0010007c, 0x3f100010, 0x3f1021f0, 0x3f100010, 0x3f0021f0, 0x00000000, // RICON_LINK_MULTI
1044 0x00000000, 0x0044007c, 0x00440044, 0x0010007c, 0x00100010, 0x44107c10, 0x440047f0, 0x00007c00, // RICON_LINK
1045 0x00000000, 0x0044007c, 0x00440044, 0x0000007c, 0x00000010, 0x44007c10, 0x44004550, 0x00007c00, // RICON_LINK_BROKE
1046 0x02a00000, 0x22a43ffc, 0x20042004, 0x20042ff4, 0x20042ff4, 0x20042ff4, 0x20042004, 0x00003ffc, // RICON_TEXT_NOTES
1047 0x3ffc0000, 0x20042004, 0x245e27c4, 0x27c42444, 0x2004201e, 0x201e2004, 0x20042004, 0x00003ffc, // RICON_NOTEBOOK
1048 0x00000000, 0x07e00000, 0x04200420, 0x24243ffc, 0x24242424, 0x24242424, 0x3ffc2424, 0x00000000, // RICON_SUITCASE
1049 0x00000000, 0x0fe00000, 0x08200820, 0x40047ffc, 0x7ffc5554, 0x40045554, 0x7ffc4004, 0x00000000, // RICON_SUITCASE_ZIP
1050 0x00000000, 0x20043ffc, 0x3ffc2004, 0x13c81008, 0x100813c8, 0x10081008, 0x1ff81008, 0x00000000, // RICON_MAILBOX
1051 0x00000000, 0x40027ffe, 0x5ffa5ffa, 0x5ffa5ffa, 0x40025ffa, 0x03c07ffe, 0x1ff81ff8, 0x00000000, // RICON_MONITOR
1052 0x0ff00000, 0x6bfe7ffe, 0x7ffe7ffe, 0x68167ffe, 0x08106816, 0x08100810, 0x0ff00810, 0x00000000, // RICON_PRINTER
1053 0x3ff80000, 0xfffe2008, 0x870a8002, 0x904a888a, 0x904a904a, 0x870a888a, 0xfffe8002, 0x00000000, // RICON_PHOTO_CAMERA
1054 0x0fc00000, 0xfcfe0cd8, 0x8002fffe, 0x84428382, 0x84428442, 0x80028382, 0xfffe8002, 0x00000000, // RICON_PHOTO_CAMERA_FLASH
1055 0x00000000, 0x02400180, 0x08100420, 0x20041008, 0x23c42004, 0x22442244, 0x3ffc2244, 0x00000000, // RICON_HOUSE
1056 0x00000000, 0x1c700000, 0x3ff83ef8, 0x3ff83ff8, 0x0fe01ff0, 0x038007c0, 0x00000100, 0x00000000, // RICON_HEART
1057 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x80000000, 0xe000c000, // RICON_CORNER
1058 0x00000000, 0x14001c00, 0x15c01400, 0x15401540, 0x155c1540, 0x15541554, 0x1ddc1554, 0x00000000, // RICON_VERTICAL_BARS
1059 0x00000000, 0x03000300, 0x1b001b00, 0x1b601b60, 0x1b6c1b60, 0x1b6c1b6c, 0x1b6c1b6c, 0x00000000, // RICON_VERTICAL_BARS_FILL
1060 0x00000000, 0x00000000, 0x403e7ffe, 0x7ffe403e, 0x7ffe0000, 0x43fe43fe, 0x00007ffe, 0x00000000, // RICON_LIFE_BARS
1061 0x7ffc0000, 0x43844004, 0x43844284, 0x43844004, 0x42844284, 0x42844284, 0x40044384, 0x00007ffc, // RICON_INFO
1062 0x40008000, 0x10002000, 0x04000800, 0x01000200, 0x00400080, 0x00100020, 0x00040008, 0x00010002, // RICON_CROSSLINE
1063 0x00000000, 0x1ff01ff0, 0x18301830, 0x1f001830, 0x03001f00, 0x00000300, 0x03000300, 0x00000000, // RICON_HELP
1064 0x3ff00000, 0x2abc3550, 0x2aac3554, 0x2aac3554, 0x2aac3554, 0x2aac3554, 0x2aac3554, 0x00003ffc, // RICON_FILETYPE_ALPHA
1065 0x3ff00000, 0x201c2010, 0x22442184, 0x28142424, 0x29942814, 0x2ff42994, 0x20042004, 0x00003ffc, // RICON_FILETYPE_HOME
1066 0x07fe0000, 0x04020402, 0x7fe20402, 0x44224422, 0x44224422, 0x402047fe, 0x40204020, 0x00007fe0, // RICON_LAYERS_VISIBLE
1067 0x07fe0000, 0x04020402, 0x7c020402, 0x44024402, 0x44024402, 0x402047fe, 0x40204020, 0x00007fe0, // RICON_LAYERS
1068 0x00000000, 0x40027ffe, 0x7ffe4002, 0x40024002, 0x40024002, 0x40024002, 0x7ffe4002, 0x00000000, // RICON_WINDOW
1069 0x09100000, 0x09f00910, 0x09100910, 0x00000910, 0x24a2779e, 0x27a224a2, 0x709e20a2, 0x00000000, // RICON_HIDPI
1070 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_200
1071 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_201
1072 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_202
1073 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_203
1074 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_204
1075 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_205
1076 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_206
1077 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_207
1078 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_208
1079 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_209
1080 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_210
1081 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_211
1082 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_212
1083 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_213
1084 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_214
1085 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_215
1086 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_216
1087 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_217
1088 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_218
1089 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_219
1090 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_220
1091 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_221
1092 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_222
1093 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_223
1094 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_224
1095 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_225
1096 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_226
1097 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_227
1098 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_228
1099 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_229
1100 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_230
1101 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_231
1102 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_232
1103 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_233
1104 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_234
1105 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_235
1106 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_236
1107 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_237
1108 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_238
1109 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_239
1110 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_240
1111 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_241
1112 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_242
1113 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_243
1114 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_244
1115 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_245
1116 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_246
1117 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_247
1118 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_248
1119 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_249
1120 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_250
1121 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_251
1122 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_252
1123 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_253
1124 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_254
1125 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RICON_255
1126};
1127
1128#endif // RAYGUI_CUSTOM_RICONS
1129
1130#endif // !RAYGUI_NO_RICONS
1131
1132#ifndef RICON_SIZE
1133 #define RICON_SIZE 0
1134#endif
1135
1136#define RAYGUI_MAX_CONTROLS 16 // Maximum number of standard controls
1137#define RAYGUI_MAX_PROPS_BASE 16 // Maximum number of standard properties
1138#define RAYGUI_MAX_PROPS_EXTENDED 8 // Maximum number of extended properties
1139
1140//----------------------------------------------------------------------------------
1141// Types and Structures Definition
1142//----------------------------------------------------------------------------------
1143// Gui control property style color element
1144typedef enum { BORDER = 0, BASE, TEXT, OTHER } GuiPropertyElement;
1145
1146//----------------------------------------------------------------------------------
1147// Global Variables Definition
1148//----------------------------------------------------------------------------------
1149static GuiControlState guiState = GUI_STATE_NORMAL;
1150
1151static Font guiFont = { 0 }; // Gui current font (WARNING: highly coupled to raylib)
1152static bool guiLocked = false; // Gui lock state (no inputs processed)
1153static float guiAlpha = 1.0f; // Gui element transpacency on drawing
1154
1155//----------------------------------------------------------------------------------
1156// Style data array for all gui style properties (allocated on data segment by default)
1157//
1158// NOTE 1: First set of BASE properties are generic to all controls but could be individually
1159// overwritten per control, first set of EXTENDED properties are generic to all controls and
1160// can not be overwritten individually but custom EXTENDED properties can be used by control
1161//
1162// NOTE 2: A new style set could be loaded over this array using GuiLoadStyle(),
1163// but default gui style could always be recovered with GuiLoadStyleDefault()
1164//
1165// guiStyle size is by default: 16*(16 + 8) = 384*4 = 1536 bytes = 1.5 KB
1166//----------------------------------------------------------------------------------
1167static unsigned int guiStyle[RAYGUI_MAX_CONTROLS*(RAYGUI_MAX_PROPS_BASE + RAYGUI_MAX_PROPS_EXTENDED)] = { 0 };
1168
1169static bool guiStyleLoaded = false; // Style loaded flag for lazy style initialization
1170
1171//----------------------------------------------------------------------------------
1172// Standalone Mode Functions Declaration
1173//
1174// NOTE: raygui depend on some raylib input and drawing functions
1175// To use raygui as standalone library, below functions must be defined by the user
1176//----------------------------------------------------------------------------------
1177#if defined(RAYGUI_STANDALONE)
1178
1179#define KEY_RIGHT 262
1180#define KEY_LEFT 263
1181#define KEY_DOWN 264
1182#define KEY_UP 265
1183#define KEY_BACKSPACE 259
1184#define KEY_ENTER 257
1185
1186#define MOUSE_LEFT_BUTTON 0
1187
1188// Input required functions
1189//-------------------------------------------------------------------------------
1190static Vector2 GetMousePosition(void);
1191static float GetMouseWheelMove(void);
1192static bool IsMouseButtonDown(int button);
1193static bool IsMouseButtonPressed(int button);
1194static bool IsMouseButtonReleased(int button);
1195
1196static bool IsKeyDown(int key);
1197static bool IsKeyPressed(int key);
1198static int GetCharPressed(void); // -- GuiTextBox(), GuiTextBoxMulti(), GuiValueBox()
1199//-------------------------------------------------------------------------------
1200
1201// Drawing required functions
1202//-------------------------------------------------------------------------------
1203static void DrawRectangle(int x, int y, int width, int height, Color color); // -- GuiDrawRectangle(), GuiDrawIcon()
1204
1205static void DrawRectangleGradientEx(Rectangle rec, Color col1, Color col2, Color col3, Color col4); // -- GuiColorPicker()
1206//-------------------------------------------------------------------------------
1207
1208// Text required functions
1209//-------------------------------------------------------------------------------
1210static Font LoadFontEx(const char *fileName, int fontSize, int *fontChars, int glyphCount); // -- GuiLoadStyle()
1211static Font GetFontDefault(void); // -- GuiLoadStyleDefault()
1212static Texture2D LoadTextureFromImage(Image image); // -- GuiLoadStyle()
1213static void SetShapesTexture(Texture2D tex, Rectangle rec); // -- GuiLoadStyle()
1214static char *LoadFileText(const char *fileName); // -- GuiLoadStyle()
1215static const char *GetDirectoryPath(const char *filePath); // -- GuiLoadStyle()
1216
1217static Vector2 MeasureTextEx(Font font, const char *text, float fontSize, float spacing); // -- GetTextWidth(), GuiTextBoxMulti()
1218static void DrawTextEx(Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint); // -- GuiDrawText()
1219//-------------------------------------------------------------------------------
1220
1221// raylib functions already implemented in raygui
1222//-------------------------------------------------------------------------------
1223static Color GetColor(int hexValue); // Returns a Color struct from hexadecimal value
1224static int ColorToInt(Color color); // Returns hexadecimal value for a Color
1225static Color Fade(Color color, float alpha); // Color fade-in or fade-out, alpha goes from 0.0f to 1.0f
1226static bool CheckCollisionPointRec(Vector2 point, Rectangle rec); // Check if point is inside rectangle
1227static const char *TextFormat(const char *text, ...); // Formatting of text with variables to 'embed'
1228static const char **TextSplit(const char *text, char delimiter, int *count); // Split text into multiple strings
1229static int TextToInteger(const char *text); // Get integer value from text
1230static int GetCodepoint(const char *text, int *bytesProcessed); // Get next codepoint in a UTF-8 encoded text
1231static const char *CodepointToUTF8(int codepoint, int *byteSize); // Encode codepoint into UTF-8 text (char array size returned as parameter)
1232
1233static void DrawRectangleGradientV(int posX, int posY, int width, int height, Color color1, Color color2); // Draw rectangle vertical gradient
1234//-------------------------------------------------------------------------------
1235
1236#endif // RAYGUI_STANDALONE
1237
1238//----------------------------------------------------------------------------------
1239// Module specific Functions Declaration
1240//----------------------------------------------------------------------------------
1241static int GetTextWidth(const char *text); // Gui get text width using default font
1242static Rectangle GetTextBounds(int control, Rectangle bounds); // Get text bounds considering control bounds
1243static const char *GetTextIcon(const char *text, int *iconId); // Get text icon if provided and move text cursor
1244
1245static void GuiDrawText(const char *text, Rectangle bounds, int alignment, Color tint); // Gui draw text using default font
1246static void GuiDrawRectangle(Rectangle rec, int borderWidth, Color borderColor, Color color); // Gui draw rectangle using default raygui style
1247
1248static const char **GuiTextSplit(const char *text, int *count, int *textRow); // Split controls text into multiple strings
1249static Vector3 ConvertHSVtoRGB(Vector3 hsv); // Convert color data from HSV to RGB
1250static Vector3 ConvertRGBtoHSV(Vector3 rgb); // Convert color data from RGB to HSV
1251
1252//----------------------------------------------------------------------------------
1253// Gui Setup Functions Definition
1254//----------------------------------------------------------------------------------
1255// Enable gui global state
1256void GuiEnable(void) { guiState = GUI_STATE_NORMAL; }
1257
1258// Disable gui global state
1259void GuiDisable(void) { guiState = GUI_STATE_DISABLED; }
1260
1261// Lock gui global state
1262void GuiLock(void) { guiLocked = true; }
1263
1264// Unlock gui global state
1265void GuiUnlock(void) { guiLocked = false; }
1266
1267// Check if gui is locked (global state)
1268bool GuiIsLocked(void) { return guiLocked; }
1269
1270// Set gui controls alpha global state
1271void GuiFade(float alpha)
1272{
1273 if (alpha < 0.0f) alpha = 0.0f;
1274 else if (alpha > 1.0f) alpha = 1.0f;
1275
1276 guiAlpha = alpha;
1277}
1278
1279// Set gui state (global state)
1280void GuiSetState(int state) { guiState = (GuiControlState)state; }
1281
1282// Get gui state (global state)
1283int GuiGetState(void) { return guiState; }
1284
1285// Set custom gui font
1286// NOTE: Font loading/unloading is external to raygui
1287void GuiSetFont(Font font)
1288{
1289 if (font.texture.id > 0)
1290 {
1291 // NOTE: If we try to setup a font but default style has not been
1292 // lazily loaded before, it will be overwritten, so we need to force
1293 // default style loading first
1294 if (!guiStyleLoaded) GuiLoadStyleDefault();
1295
1296 guiFont = font;
1298 }
1299}
1300
1301// Get custom gui font
1302Font GuiGetFont(void)
1303{
1304 return guiFont;
1305}
1306
1307// Set control style property value
1308void GuiSetStyle(int control, int property, int value)
1309{
1310 if (!guiStyleLoaded) GuiLoadStyleDefault();
1311 guiStyle[control*(RAYGUI_MAX_PROPS_BASE + RAYGUI_MAX_PROPS_EXTENDED) + property] = value;
1312
1313 // Default properties are propagated to all controls
1314 if ((control == 0) && (property < RAYGUI_MAX_PROPS_BASE))
1315 {
1316 for (int i = 1; i < RAYGUI_MAX_CONTROLS; i++) guiStyle[i*(RAYGUI_MAX_PROPS_BASE + RAYGUI_MAX_PROPS_EXTENDED) + property] = value;
1317 }
1318}
1319
1320// Get control style property value
1321int GuiGetStyle(int control, int property)
1322{
1323 if (!guiStyleLoaded) GuiLoadStyleDefault();
1324 return guiStyle[control*(RAYGUI_MAX_PROPS_BASE + RAYGUI_MAX_PROPS_EXTENDED) + property];
1325}
1326
1327//----------------------------------------------------------------------------------
1328// Gui Controls Functions Definition
1329//----------------------------------------------------------------------------------
1330
1331// Window Box control
1332bool GuiWindowBox(Rectangle bounds, const char *title)
1333{
1334 // NOTE: This define is also used by GuiMessageBox() and GuiTextInputBox()
1335 #define WINDOW_STATUSBAR_HEIGHT 22
1336
1337 //GuiControlState state = guiState;
1338 bool clicked = false;
1339
1340 int statusBarHeight = WINDOW_STATUSBAR_HEIGHT + 2*GuiGetStyle(STATUSBAR, BORDER_WIDTH);
1341 statusBarHeight += (statusBarHeight%2);
1342
1343 Rectangle statusBar = { bounds.x, bounds.y, bounds.width, (float)statusBarHeight };
1344 if (bounds.height < statusBarHeight*2.0f) bounds.height = statusBarHeight*2.0f;
1345
1346 Rectangle windowPanel = { bounds.x, bounds.y + (float)statusBarHeight - 1, bounds.width, bounds.height - (float)statusBarHeight };
1347 Rectangle closeButtonRec = { statusBar.x + statusBar.width - GuiGetStyle(STATUSBAR, BORDER_WIDTH) - 20,
1348 statusBar.y + statusBarHeight/2.0f - 18.0f/2.0f, 18, 18 };
1349
1350 // Update control
1351 //--------------------------------------------------------------------
1352 // NOTE: Logic is directly managed by button
1353 //--------------------------------------------------------------------
1354
1355 // Draw control
1356 //--------------------------------------------------------------------
1357 GuiStatusBar(statusBar, title); // Draw window header as status bar
1358 GuiPanel(windowPanel); // Draw window base
1359
1360 // Draw window close button
1361 int tempBorderWidth = GuiGetStyle(BUTTON, BORDER_WIDTH);
1362 int tempTextAlignment = GuiGetStyle(BUTTON, TEXT_ALIGNMENT);
1365#if defined(RAYGUI_NO_RICONS)
1366 clicked = GuiButton(closeButtonRec, "x");
1367#else
1368 clicked = GuiButton(closeButtonRec, GuiIconText(RICON_CROSS_SMALL, NULL));
1369#endif
1370 GuiSetStyle(BUTTON, BORDER_WIDTH, tempBorderWidth);
1371 GuiSetStyle(BUTTON, TEXT_ALIGNMENT, tempTextAlignment);
1372 //--------------------------------------------------------------------
1373
1374 return clicked;
1375}
1376
1377// Group Box control with text name
1378void GuiGroupBox(Rectangle bounds, const char *text)
1379{
1380 #define GROUPBOX_LINE_THICK 1
1381 #define GROUPBOX_TEXT_PADDING 10
1382
1383 GuiControlState state = guiState;
1384
1385 // Draw control
1386 //--------------------------------------------------------------------
1387 GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x, bounds.y, GROUPBOX_LINE_THICK, bounds.height }, 0, BLANK, Fade(GetColor(GuiGetStyle(DEFAULT, (state == GUI_STATE_DISABLED)? BORDER_COLOR_DISABLED : LINE_COLOR)), guiAlpha));
1388 GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x, bounds.y + bounds.height - 1, bounds.width, GROUPBOX_LINE_THICK }, 0, BLANK, Fade(GetColor(GuiGetStyle(DEFAULT, (state == GUI_STATE_DISABLED)? BORDER_COLOR_DISABLED : LINE_COLOR)), guiAlpha));
1389 GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x + bounds.width - 1, bounds.y, GROUPBOX_LINE_THICK, bounds.height }, 0, BLANK, Fade(GetColor(GuiGetStyle(DEFAULT, (state == GUI_STATE_DISABLED)? BORDER_COLOR_DISABLED : LINE_COLOR)), guiAlpha));
1390
1391 GuiLine(RAYGUI_CLITERAL(Rectangle){ bounds.x, bounds.y, bounds.width, 1 }, text);
1392 //--------------------------------------------------------------------
1393}
1394
1395// Line control
1396void GuiLine(Rectangle bounds, const char *text)
1397{
1398 #define LINE_TEXT_PADDING 10
1399
1400 GuiControlState state = guiState;
1401
1403
1404 // Draw control
1405 //--------------------------------------------------------------------
1406 if (text == NULL) GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x, bounds.y + bounds.height/2, bounds.width, 1 }, 0, BLANK, color);
1407 else
1408 {
1409 Rectangle textBounds = { 0 };
1410 textBounds.width = (float)GetTextWidth(text);
1411 textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE);
1412 textBounds.x = bounds.x + LINE_TEXT_PADDING;
1413 textBounds.y = bounds.y - (float)GuiGetStyle(DEFAULT, TEXT_SIZE)/2;
1414
1415 // Draw line with embedded text label: "--- text --------------"
1416 GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x, bounds.y, LINE_TEXT_PADDING - 2, 1 }, 0, BLANK, color);
1417 GuiLabel(textBounds, text);
1418 GuiDrawRectangle(RAYGUI_CLITERAL(Rectangle){ bounds.x + LINE_TEXT_PADDING + textBounds.width + 4, bounds.y, bounds.width - textBounds.width - LINE_TEXT_PADDING - 4, 1 }, 0, BLANK, color);
1419 }
1420 //--------------------------------------------------------------------
1421}
1422
1423// Panel control
1424void GuiPanel(Rectangle bounds)
1425{
1426 #define PANEL_BORDER_WIDTH 1
1427
1428 GuiControlState state = guiState;
1429
1430 // Draw control
1431 //--------------------------------------------------------------------
1432 GuiDrawRectangle(bounds, PANEL_BORDER_WIDTH, Fade(GetColor(GuiGetStyle(DEFAULT, (state == GUI_STATE_DISABLED)? BORDER_COLOR_DISABLED: LINE_COLOR)), guiAlpha),
1434 //--------------------------------------------------------------------
1435}
1436
1437// Scroll Panel control
1438Rectangle GuiScrollPanel(Rectangle bounds, Rectangle content, Vector2 *scroll)
1439{
1440 GuiControlState state = guiState;
1441
1442 Vector2 scrollPos = { 0.0f, 0.0f };
1443 if (scroll != NULL) scrollPos = *scroll;
1444
1445 bool hasHorizontalScrollBar = (content.width > bounds.width - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH))? true : false;
1446 bool hasVerticalScrollBar = (content.height > bounds.height - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH))? true : false;
1447
1448 // Recheck to account for the other scrollbar being visible
1449 if (!hasHorizontalScrollBar) hasHorizontalScrollBar = (hasVerticalScrollBar && (content.width > (bounds.width - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - GuiGetStyle(LISTVIEW, SCROLLBAR_WIDTH))))? true : false;
1450 if (!hasVerticalScrollBar) hasVerticalScrollBar = (hasHorizontalScrollBar && (content.height > (bounds.height - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - GuiGetStyle(LISTVIEW, SCROLLBAR_WIDTH))))? true : false;
1451
1452 const int horizontalScrollBarWidth = hasHorizontalScrollBar? GuiGetStyle(LISTVIEW, SCROLLBAR_WIDTH) : 0;
1453 const int verticalScrollBarWidth = hasVerticalScrollBar? GuiGetStyle(LISTVIEW, SCROLLBAR_WIDTH) : 0;
1454 const Rectangle horizontalScrollBar = { (float)((GuiGetStyle(LISTVIEW, SCROLLBAR_SIDE) == SCROLLBAR_LEFT_SIDE)? (float)bounds.x + verticalScrollBarWidth : (float)bounds.x) + GuiGetStyle(DEFAULT, BORDER_WIDTH), (float)bounds.y + bounds.height - horizontalScrollBarWidth - GuiGetStyle(DEFAULT, BORDER_WIDTH), (float)bounds.width - verticalScrollBarWidth - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH), (float)horizontalScrollBarWidth };
1455 const Rectangle verticalScrollBar = { (float)((GuiGetStyle(LISTVIEW, SCROLLBAR_SIDE) == SCROLLBAR_LEFT_SIDE)? (float)bounds.x + GuiGetStyle(DEFAULT, BORDER_WIDTH) : (float)bounds.x + bounds.width - verticalScrollBarWidth - GuiGetStyle(DEFAULT, BORDER_WIDTH)), (float)bounds.y + GuiGetStyle(DEFAULT, BORDER_WIDTH), (float)verticalScrollBarWidth, (float)bounds.height - horizontalScrollBarWidth - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) };
1456
1457 // Calculate view area (area without the scrollbars)
1459 RAYGUI_CLITERAL(Rectangle){ bounds.x + verticalScrollBarWidth + GuiGetStyle(DEFAULT, BORDER_WIDTH), bounds.y + GuiGetStyle(DEFAULT, BORDER_WIDTH), bounds.width - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - verticalScrollBarWidth, bounds.height - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - horizontalScrollBarWidth } :
1460 RAYGUI_CLITERAL(Rectangle){ bounds.x + GuiGetStyle(DEFAULT, BORDER_WIDTH), bounds.y + GuiGetStyle(DEFAULT, BORDER_WIDTH), bounds.width - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - verticalScrollBarWidth, bounds.height - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - horizontalScrollBarWidth };
1461
1462 // Clip view area to the actual content size
1463 if (view.width > content.width) view.width = content.width;
1464 if (view.height > content.height) view.height = content.height;
1465
1466 const float horizontalMin = hasHorizontalScrollBar? ((GuiGetStyle(LISTVIEW, SCROLLBAR_SIDE) == SCROLLBAR_LEFT_SIDE)? (float)-verticalScrollBarWidth : 0) - (float)GuiGetStyle(DEFAULT, BORDER_WIDTH) : (((float)GuiGetStyle(LISTVIEW, SCROLLBAR_SIDE) == SCROLLBAR_LEFT_SIDE)? (float)-verticalScrollBarWidth : 0) - (float)GuiGetStyle(DEFAULT, BORDER_WIDTH);
1467 const float horizontalMax = hasHorizontalScrollBar? content.width - bounds.width + (float)verticalScrollBarWidth + GuiGetStyle(DEFAULT, BORDER_WIDTH) - (((float)GuiGetStyle(LISTVIEW, SCROLLBAR_SIDE) == SCROLLBAR_LEFT_SIDE)? (float)verticalScrollBarWidth : 0) : (float)-GuiGetStyle(DEFAULT, BORDER_WIDTH);
1468 const float verticalMin = hasVerticalScrollBar? (float)-GuiGetStyle(DEFAULT, BORDER_WIDTH) : (float)-GuiGetStyle(DEFAULT, BORDER_WIDTH);
1469 const float verticalMax = hasVerticalScrollBar? content.height - bounds.height + (float)horizontalScrollBarWidth + (float)GuiGetStyle(DEFAULT, BORDER_WIDTH) : (float)-GuiGetStyle(DEFAULT, BORDER_WIDTH);
1470
1471 // Update control
1472 //--------------------------------------------------------------------
1473 if ((state != GUI_STATE_DISABLED) && !guiLocked)
1474 {
1475 Vector2 mousePoint = GetMousePosition();
1476
1477 // Check button state
1478 if (CheckCollisionPointRec(mousePoint, bounds))
1479 {
1481 else state = GUI_STATE_FOCUSED;
1482
1483 if (hasHorizontalScrollBar)
1484 {
1487 }
1488
1489 if (hasVerticalScrollBar)
1490 {
1492 if (IsKeyDown(KEY_UP)) scrollPos.y += GuiGetStyle(SCROLLBAR, SCROLL_SPEED);
1493 }
1494
1495 float wheelMove = GetMouseWheelMove();
1496
1497 // Horizontal scroll (Shift + Mouse wheel)
1498 if (hasHorizontalScrollBar && (IsKeyDown(KEY_LEFT_SHIFT) || IsKeyDown(KEY_RIGHT_SHIFT))) scrollPos.x += wheelMove*20;
1499 else scrollPos.y += wheelMove*20; // Vertical scroll
1500 }
1501 }
1502
1503 // Normalize scroll values
1504 if (scrollPos.x > -horizontalMin) scrollPos.x = -horizontalMin;
1505 if (scrollPos.x < -horizontalMax) scrollPos.x = -horizontalMax;
1506 if (scrollPos.y > -verticalMin) scrollPos.y = -verticalMin;
1507 if (scrollPos.y < -verticalMax) scrollPos.y = -verticalMax;
1508 //--------------------------------------------------------------------
1509
1510 // Draw control
1511 //--------------------------------------------------------------------
1512 GuiDrawRectangle(bounds, 0, BLANK, GetColor(GuiGetStyle(DEFAULT, BACKGROUND_COLOR))); // Draw background
1513
1514 // Save size of the scrollbar slider
1515 const int slider = GuiGetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE);
1516
1517 // Draw horizontal scrollbar if visible
1518 if (hasHorizontalScrollBar)
1519 {
1520 // Change scrollbar slider size to show the diff in size between the content width and the widget width
1521 GuiSetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE, (int)(((bounds.width - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - verticalScrollBarWidth)/(int)content.width)*((int)bounds.width - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - verticalScrollBarWidth)));
1522 scrollPos.x = (float)-GuiScrollBar(horizontalScrollBar, (int)-scrollPos.x, (int)horizontalMin, (int)horizontalMax);
1523 }
1524
1525 // Draw vertical scrollbar if visible
1526 if (hasVerticalScrollBar)
1527 {
1528 // Change scrollbar slider size to show the diff in size between the content height and the widget height
1529 GuiSetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE, (int)(((bounds.height - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - horizontalScrollBarWidth)/(int)content.height)*((int)bounds.height - 2*GuiGetStyle(DEFAULT, BORDER_WIDTH) - horizontalScrollBarWidth)));
1530 scrollPos.y = (float)-GuiScrollBar(verticalScrollBar, (int)-scrollPos.y, (int)verticalMin, (int)verticalMax);
1531 }
1532
1533 // Draw detail corner rectangle if both scroll bars are visible
1534 if (hasHorizontalScrollBar && hasVerticalScrollBar)
1535 {
1536 Rectangle corner = { (GuiGetStyle(LISTVIEW, SCROLLBAR_SIDE) == SCROLLBAR_LEFT_SIDE) ? (bounds.x + GuiGetStyle(DEFAULT, BORDER_WIDTH) + 2) : (horizontalScrollBar.x + horizontalScrollBar.width + 2), verticalScrollBar.y + verticalScrollBar.height + 2, (float)horizontalScrollBarWidth - 4, (float)verticalScrollBarWidth - 4 };
1537 GuiDrawRectangle(corner, 0, BLANK, Fade(GetColor(GuiGetStyle(LISTVIEW, TEXT + (state*3))), guiAlpha));
1538 }
1539
1540 // Draw scrollbar lines depending on current state
1541 GuiDrawRectangle(bounds, GuiGetStyle(DEFAULT, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(LISTVIEW, BORDER + (state*3))), guiAlpha), BLANK);
1542
1543 // Set scrollbar slider size back to the way it was before
1545 //--------------------------------------------------------------------
1546
1547 if (scroll != NULL) *scroll = scrollPos;
1548
1549 return view;
1550}
1551
1552// Label control
1553void GuiLabel(Rectangle bounds, const char *text)
1554{
1555 GuiControlState state = guiState;
1556
1557 // Update control
1558 //--------------------------------------------------------------------
1559 // ...
1560 //--------------------------------------------------------------------
1561
1562 // Draw control
1563 //--------------------------------------------------------------------
1564 GuiDrawText(text, GetTextBounds(LABEL, bounds), GuiGetStyle(LABEL, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(LABEL, (state == GUI_STATE_DISABLED)? TEXT_COLOR_DISABLED : TEXT_COLOR_NORMAL)), guiAlpha));
1565 //--------------------------------------------------------------------
1566}
1567
1568// Button control, returns true when clicked
1569bool GuiButton(Rectangle bounds, const char *text)
1570{
1571 GuiControlState state = guiState;
1572 bool pressed = false;
1573
1574 // Update control
1575 //--------------------------------------------------------------------
1576 if ((state != GUI_STATE_DISABLED) && !guiLocked)
1577 {
1578 Vector2 mousePoint = GetMousePosition();
1579
1580 // Check button state
1581 if (CheckCollisionPointRec(mousePoint, bounds))
1582 {
1584 else state = GUI_STATE_FOCUSED;
1585
1586 if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) pressed = true;
1587 }
1588 }
1589 //--------------------------------------------------------------------
1590
1591 // Draw control
1592 //--------------------------------------------------------------------
1593 GuiDrawRectangle(bounds, GuiGetStyle(BUTTON, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(BUTTON, BORDER + (state*3))), guiAlpha), Fade(GetColor(GuiGetStyle(BUTTON, BASE + (state*3))), guiAlpha));
1594 GuiDrawText(text, GetTextBounds(BUTTON, bounds), GuiGetStyle(BUTTON, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(BUTTON, TEXT + (state*3))), guiAlpha));
1595 //------------------------------------------------------------------
1596
1597 return pressed;
1598}
1599
1600// Label button control
1601bool GuiLabelButton(Rectangle bounds, const char *text)
1602{
1603 GuiControlState state = guiState;
1604 bool pressed = false;
1605
1606 // NOTE: We force bounds.width to be all text
1607 float textWidth = MeasureTextEx(guiFont, text, (float)GuiGetStyle(DEFAULT, TEXT_SIZE), (float)GuiGetStyle(DEFAULT, TEXT_SPACING)).x;
1608 if (bounds.width < textWidth) bounds.width = textWidth;
1609
1610 // Update control
1611 //--------------------------------------------------------------------
1612 if ((state != GUI_STATE_DISABLED) && !guiLocked)
1613 {
1614 Vector2 mousePoint = GetMousePosition();
1615
1616 // Check checkbox state
1617 if (CheckCollisionPointRec(mousePoint, bounds))
1618 {
1620 else state = GUI_STATE_FOCUSED;
1621
1622 if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) pressed = true;
1623 }
1624 }
1625 //--------------------------------------------------------------------
1626
1627 // Draw control
1628 //--------------------------------------------------------------------
1629 GuiDrawText(text, GetTextBounds(LABEL, bounds), GuiGetStyle(LABEL, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(LABEL, TEXT + (state*3))), guiAlpha));
1630 //--------------------------------------------------------------------
1631
1632 return pressed;
1633}
1634
1635// Toggle Button control, returns true when active
1636bool GuiToggle(Rectangle bounds, const char *text, bool active)
1637{
1638 GuiControlState state = guiState;
1639
1640 // Update control
1641 //--------------------------------------------------------------------
1642 if ((state != GUI_STATE_DISABLED) && !guiLocked)
1643 {
1644 Vector2 mousePoint = GetMousePosition();
1645
1646 // Check toggle button state
1647 if (CheckCollisionPointRec(mousePoint, bounds))
1648 {
1651 {
1652 state = GUI_STATE_NORMAL;
1653 active = !active;
1654 }
1655 else state = GUI_STATE_FOCUSED;
1656 }
1657 }
1658 //--------------------------------------------------------------------
1659
1660 // Draw control
1661 //--------------------------------------------------------------------
1662 if (state == GUI_STATE_NORMAL)
1663 {
1664 GuiDrawRectangle(bounds, GuiGetStyle(TOGGLE, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(TOGGLE, (active? BORDER_COLOR_PRESSED : (BORDER + state*3)))), guiAlpha), Fade(GetColor(GuiGetStyle(TOGGLE, (active? BASE_COLOR_PRESSED : (BASE + state*3)))), guiAlpha));
1665 GuiDrawText(text, GetTextBounds(TOGGLE, bounds), GuiGetStyle(TOGGLE, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(TOGGLE, (active? TEXT_COLOR_PRESSED : (TEXT + state*3)))), guiAlpha));
1666 }
1667 else
1668 {
1669 GuiDrawRectangle(bounds, GuiGetStyle(TOGGLE, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(TOGGLE, BORDER + state*3)), guiAlpha), Fade(GetColor(GuiGetStyle(TOGGLE, BASE + state*3)), guiAlpha));
1670 GuiDrawText(text, GetTextBounds(TOGGLE, bounds), GuiGetStyle(TOGGLE, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(TOGGLE, TEXT + state*3)), guiAlpha));
1671 }
1672 //--------------------------------------------------------------------
1673
1674 return active;
1675}
1676
1677// Toggle Group control, returns toggled button index
1678int GuiToggleGroup(Rectangle bounds, const char *text, int active)
1679{
1680 #if !defined(TOGGLEGROUP_MAX_ELEMENTS)
1681 #define TOGGLEGROUP_MAX_ELEMENTS 32
1682 #endif
1683
1684 float initBoundsX = bounds.x;
1685
1686 // Get substrings items from text (items pointers)
1687 int rows[TOGGLEGROUP_MAX_ELEMENTS] = { 0 };
1688 int itemCount = 0;
1689 const char **items = GuiTextSplit(text, &itemCount, rows);
1690
1691 int prevRow = rows[0];
1692
1693 for (int i = 0; i < itemCount; i++)
1694 {
1695 if (prevRow != rows[i])
1696 {
1697 bounds.x = initBoundsX;
1698 bounds.y += (bounds.height + GuiGetStyle(TOGGLE, GROUP_PADDING));
1699 prevRow = rows[i];
1700 }
1701
1702 if (i == active) GuiToggle(bounds, items[i], true);
1703 else if (GuiToggle(bounds, items[i], false) == true) active = i;
1704
1705 bounds.x += (bounds.width + GuiGetStyle(TOGGLE, GROUP_PADDING));
1706 }
1707
1708 return active;
1709}
1710
1711// Check Box control, returns true when active
1712bool GuiCheckBox(Rectangle bounds, const char *text, bool checked)
1713{
1714 GuiControlState state = guiState;
1715
1716 Rectangle textBounds = { 0 };
1717
1718 if (text != NULL)
1719 {
1720 textBounds.width = (float)GetTextWidth(text);
1721 textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE);
1722 textBounds.x = bounds.x + bounds.width + GuiGetStyle(CHECKBOX, TEXT_PADDING);
1723 textBounds.y = bounds.y + bounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE)/2;
1724 if (GuiGetStyle(CHECKBOX, TEXT_ALIGNMENT) == GUI_TEXT_ALIGN_LEFT) textBounds.x = bounds.x - textBounds.width - GuiGetStyle(CHECKBOX, TEXT_PADDING);
1725 }
1726
1727 // Update control
1728 //--------------------------------------------------------------------
1729 if ((state != GUI_STATE_DISABLED) && !guiLocked)
1730 {
1731 Vector2 mousePoint = GetMousePosition();
1732
1733 Rectangle totalBounds = {
1734 (GuiGetStyle(CHECKBOX, TEXT_ALIGNMENT) == GUI_TEXT_ALIGN_LEFT)? textBounds.x : bounds.x,
1735 bounds.y,
1736 bounds.width + textBounds.width + GuiGetStyle(CHECKBOX, TEXT_PADDING),
1737 bounds.height,
1738 };
1739
1740 // Check checkbox state
1741 if (CheckCollisionPointRec(mousePoint, totalBounds))
1742 {
1744 else state = GUI_STATE_FOCUSED;
1745
1746 if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON)) checked = !checked;
1747 }
1748 }
1749 //--------------------------------------------------------------------
1750
1751 // Draw control
1752 //--------------------------------------------------------------------
1753 GuiDrawRectangle(bounds, GuiGetStyle(CHECKBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(CHECKBOX, BORDER + (state*3))), guiAlpha), BLANK);
1754
1755 if (checked)
1756 {
1761 GuiDrawRectangle(check, 0, BLANK, Fade(GetColor(GuiGetStyle(CHECKBOX, TEXT + state*3)), guiAlpha));
1762 }
1763
1764 GuiDrawText(text, textBounds, (GuiGetStyle(CHECKBOX, TEXT_ALIGNMENT) == GUI_TEXT_ALIGN_RIGHT)? GUI_TEXT_ALIGN_LEFT : GUI_TEXT_ALIGN_RIGHT, Fade(GetColor(GuiGetStyle(LABEL, TEXT + (state*3))), guiAlpha));
1765 //--------------------------------------------------------------------
1766
1767 return checked;
1768}
1769
1770// Combo Box control, returns selected item index
1771int GuiComboBox(Rectangle bounds, const char *text, int active)
1772{
1773 GuiControlState state = guiState;
1774
1776
1777 Rectangle selector = { (float)bounds.x + bounds.width + GuiGetStyle(COMBOBOX, COMBO_BUTTON_PADDING),
1778 (float)bounds.y, (float)GuiGetStyle(COMBOBOX, COMBO_BUTTON_WIDTH), (float)bounds.height };
1779
1780 // Get substrings items from text (items pointers, lengths and count)
1781 int itemCount = 0;
1782 const char **items = GuiTextSplit(text, &itemCount, NULL);
1783
1784 if (active < 0) active = 0;
1785 else if (active > itemCount - 1) active = itemCount - 1;
1786
1787 // Update control
1788 //--------------------------------------------------------------------
1789 if ((state != GUI_STATE_DISABLED) && !guiLocked && (itemCount > 1))
1790 {
1791 Vector2 mousePoint = GetMousePosition();
1792
1793 if (CheckCollisionPointRec(mousePoint, bounds) ||
1794 CheckCollisionPointRec(mousePoint, selector))
1795 {
1797 {
1798 active += 1;
1799 if (active >= itemCount) active = 0;
1800 }
1801
1803 else state = GUI_STATE_FOCUSED;
1804 }
1805 }
1806 //--------------------------------------------------------------------
1807
1808 // Draw control
1809 //--------------------------------------------------------------------
1810 // Draw combo box main
1811 GuiDrawRectangle(bounds, GuiGetStyle(COMBOBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(COMBOBOX, BORDER + (state*3))), guiAlpha), Fade(GetColor(GuiGetStyle(COMBOBOX, BASE + (state*3))), guiAlpha));
1812 GuiDrawText(items[active], GetTextBounds(COMBOBOX, bounds), GuiGetStyle(COMBOBOX, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(COMBOBOX, TEXT + (state*3))), guiAlpha));
1813
1814 // Draw selector using a custom button
1815 // NOTE: BORDER_WIDTH and TEXT_ALIGNMENT forced values
1816 int tempBorderWidth = GuiGetStyle(BUTTON, BORDER_WIDTH);
1817 int tempTextAlign = GuiGetStyle(BUTTON, TEXT_ALIGNMENT);
1820
1821 GuiButton(selector, TextFormat("%i/%i", active + 1, itemCount));
1822
1823 GuiSetStyle(BUTTON, TEXT_ALIGNMENT, tempTextAlign);
1824 GuiSetStyle(BUTTON, BORDER_WIDTH, tempBorderWidth);
1825 //--------------------------------------------------------------------
1826
1827 return active;
1828}
1829
1830// Dropdown Box control
1831// NOTE: Returns mouse click
1832bool GuiDropdownBox(Rectangle bounds, const char *text, int *active, bool editMode)
1833{
1834 GuiControlState state = guiState;
1835 int itemSelected = *active;
1836 int itemFocused = -1;
1837
1838 // Get substrings items from text (items pointers, lengths and count)
1839 int itemCount = 0;
1840 const char **items = GuiTextSplit(text, &itemCount, NULL);
1841
1842 Rectangle boundsOpen = bounds;
1843 boundsOpen.height = (itemCount + 1)*(bounds.height + GuiGetStyle(DROPDOWNBOX, DROPDOWN_ITEMS_PADDING));
1844
1845 Rectangle itemBounds = bounds;
1846
1847 bool pressed = false; // Check mouse button pressed
1848
1849 // Update control
1850 //--------------------------------------------------------------------
1851 if ((state != GUI_STATE_DISABLED) && (editMode || !guiLocked) && (itemCount > 1))
1852 {
1853 Vector2 mousePoint = GetMousePosition();
1854
1855 if (editMode)
1856 {
1857 state = GUI_STATE_PRESSED;
1858
1859 // Check if mouse has been pressed or released outside limits
1860 if (!CheckCollisionPointRec(mousePoint, boundsOpen))
1861 {
1863 }
1864
1865 // Check if already selected item has been pressed again
1866 if (CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) pressed = true;
1867
1868 // Check focused and selected item
1869 for (int i = 0; i < itemCount; i++)
1870 {
1871 // Update item rectangle y position for next item
1872 itemBounds.y += (bounds.height + GuiGetStyle(DROPDOWNBOX, DROPDOWN_ITEMS_PADDING));
1873
1874 if (CheckCollisionPointRec(mousePoint, itemBounds))
1875 {
1876 itemFocused = i;
1878 {
1879 itemSelected = i;
1880 pressed = true; // Item selected, change to editMode = false
1881 }
1882 break;
1883 }
1884 }
1885
1886 itemBounds = bounds;
1887 }
1888 else
1889 {
1890 if (CheckCollisionPointRec(mousePoint, bounds))
1891 {
1893 {
1894 pressed = true;
1895 state = GUI_STATE_PRESSED;
1896 }
1897 else state = GUI_STATE_FOCUSED;
1898 }
1899 }
1900 }
1901 //--------------------------------------------------------------------
1902
1903 // Draw control
1904 //--------------------------------------------------------------------
1905 if (editMode) GuiPanel(boundsOpen);
1906
1907 GuiDrawRectangle(bounds, GuiGetStyle(DROPDOWNBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(DROPDOWNBOX, BORDER + state*3)), guiAlpha), Fade(GetColor(GuiGetStyle(DROPDOWNBOX, BASE + state*3)), guiAlpha));
1908 GuiDrawText(items[itemSelected], GetTextBounds(DEFAULT, bounds), GuiGetStyle(DROPDOWNBOX, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(DROPDOWNBOX, TEXT + state*3)), guiAlpha));
1909
1910 if (editMode)
1911 {
1912 // Draw visible items
1913 for (int i = 0; i < itemCount; i++)
1914 {
1915 // Update item rectangle y position for next item
1916 itemBounds.y += (bounds.height + GuiGetStyle(DROPDOWNBOX, DROPDOWN_ITEMS_PADDING));
1917
1918 if (i == itemSelected)
1919 {
1921 GuiDrawText(items[i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(DROPDOWNBOX, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(DROPDOWNBOX, TEXT_COLOR_PRESSED)), guiAlpha));
1922 }
1923 else if (i == itemFocused)
1924 {
1926 GuiDrawText(items[i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(DROPDOWNBOX, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(DROPDOWNBOX, TEXT_COLOR_FOCUSED)), guiAlpha));
1927 }
1928 else GuiDrawText(items[i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(DROPDOWNBOX, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(DROPDOWNBOX, TEXT_COLOR_NORMAL)), guiAlpha));
1929 }
1930 }
1931
1932 // Draw arrows (using icon if available)
1933#if defined(RAYGUI_NO_RICONS)
1934 GuiDrawText("v", RAYGUI_CLITERAL(Rectangle){ bounds.x + bounds.width - GuiGetStyle(DROPDOWNBOX, ARROW_PADDING), bounds.y + bounds.height/2 - 2, 10, 10 },
1935 GUI_TEXT_ALIGN_CENTER, Fade(GetColor(GuiGetStyle(DROPDOWNBOX, TEXT + (state*3))), guiAlpha));
1936#else
1937 GuiDrawText("#120#", RAYGUI_CLITERAL(Rectangle){ bounds.x + bounds.width - GuiGetStyle(DROPDOWNBOX, ARROW_PADDING), bounds.y + bounds.height/2 - 6, 10, 10 },
1938 GUI_TEXT_ALIGN_CENTER, Fade(GetColor(GuiGetStyle(DROPDOWNBOX, TEXT + (state*3))), guiAlpha)); // RICON_ARROW_DOWN_FILL
1939#endif
1940 //--------------------------------------------------------------------
1941
1942 *active = itemSelected;
1943 return pressed;
1944}
1945
1946// Text Box control, updates input text
1947// NOTE 2: Returns if KEY_ENTER pressed (useful for data validation)
1948bool GuiTextBox(Rectangle bounds, char *text, int textSize, bool editMode)
1949{
1950 GuiControlState state = guiState;
1951 bool pressed = false;
1952
1953 Rectangle cursor = {
1954 bounds.x + GuiGetStyle(TEXTBOX, TEXT_PADDING) + GetTextWidth(text) + 2,
1955 bounds.y + bounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE),
1956 4,
1957 (float)GuiGetStyle(DEFAULT, TEXT_SIZE)*2
1958 };
1959
1960 if (cursor.height > bounds.height) cursor.height = bounds.height - GuiGetStyle(TEXTBOX, BORDER_WIDTH)*2;
1961
1962 // Update control
1963 //--------------------------------------------------------------------
1964 if ((state != GUI_STATE_DISABLED) && !guiLocked)
1965 {
1966 Vector2 mousePoint = GetMousePosition();
1967
1968 if (editMode)
1969 {
1970 state = GUI_STATE_PRESSED;
1971
1972 int key = GetCharPressed(); // Returns codepoint as Unicode
1973 int keyCount = (int)strlen(text);
1974
1975 // Only allow keys in range [32..125]
1976 if (keyCount < (textSize - 1))
1977 {
1978 float maxWidth = (bounds.width - (GuiGetStyle(TEXTBOX, TEXT_INNER_PADDING)*2));
1979
1980 if ((GetTextWidth(text) < (maxWidth - GuiGetStyle(DEFAULT, TEXT_SIZE))) && (key >= 32))
1981 {
1982 int byteSize = 0;
1983 const char *textUTF8 = CodepointToUTF8(key, &byteSize);
1984
1985 for (int i = 0; i < byteSize; i++)
1986 {
1987 text[keyCount] = textUTF8[i];
1988 keyCount++;
1989 }
1990
1991 text[keyCount] = '\0';
1992 }
1993 }
1994
1995 // Delete text
1996 if (keyCount > 0)
1997 {
1999 {
2000 keyCount--;
2001 text[keyCount] = '\0';
2002 if (keyCount < 0) keyCount = 0;
2003 }
2004 }
2005
2006 if (IsKeyPressed(KEY_ENTER) || (!CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON))) pressed = true;
2007
2008 // Check text alignment to position cursor properly
2009 int textAlignment = GuiGetStyle(TEXTBOX, TEXT_ALIGNMENT);
2010 if (textAlignment == GUI_TEXT_ALIGN_CENTER) cursor.x = bounds.x + GetTextWidth(text)/2 + bounds.width/2 + 1;
2011 else if (textAlignment == GUI_TEXT_ALIGN_RIGHT) cursor.x = bounds.x + bounds.width - GuiGetStyle(TEXTBOX, TEXT_INNER_PADDING);
2012 }
2013 else
2014 {
2015 if (CheckCollisionPointRec(mousePoint, bounds))
2016 {
2017 state = GUI_STATE_FOCUSED;
2018 if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) pressed = true;
2019 }
2020 }
2021 }
2022 //--------------------------------------------------------------------
2023
2024 // Draw control
2025 //--------------------------------------------------------------------
2026 if (state == GUI_STATE_PRESSED)
2027 {
2028 GuiDrawRectangle(bounds, GuiGetStyle(TEXTBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(TEXTBOX, BORDER + (state*3))), guiAlpha), Fade(GetColor(GuiGetStyle(TEXTBOX, BASE_COLOR_PRESSED)), guiAlpha));
2029 }
2030 else if (state == GUI_STATE_DISABLED)
2031 {
2032 GuiDrawRectangle(bounds, GuiGetStyle(TEXTBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(TEXTBOX, BORDER + (state*3))), guiAlpha), Fade(GetColor(GuiGetStyle(TEXTBOX, BASE_COLOR_DISABLED)), guiAlpha));
2033 }
2034 else GuiDrawRectangle(bounds, 1, Fade(GetColor(GuiGetStyle(TEXTBOX, BORDER + (state*3))), guiAlpha), BLANK);
2035
2036 GuiDrawText(text, GetTextBounds(TEXTBOX, bounds), GuiGetStyle(TEXTBOX, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(TEXTBOX, TEXT + (state*3))), guiAlpha));
2037
2038 // Draw cursor
2039 if (editMode) GuiDrawRectangle(cursor, 0, BLANK, Fade(GetColor(GuiGetStyle(TEXTBOX, BORDER_COLOR_PRESSED)), guiAlpha));
2040 //--------------------------------------------------------------------
2041
2042 return pressed;
2043}
2044
2045// Spinner control, returns selected value
2046bool GuiSpinner(Rectangle bounds, const char *text, int *value, int minValue, int maxValue, bool editMode)
2047{
2048 GuiControlState state = guiState;
2049
2050 bool pressed = false;
2051 int tempValue = *value;
2052
2055 Rectangle leftButtonBound = { (float)bounds.x, (float)bounds.y, (float)GuiGetStyle(SPINNER, SPIN_BUTTON_WIDTH), (float)bounds.height };
2056 Rectangle rightButtonBound = { (float)bounds.x + bounds.width - GuiGetStyle(SPINNER, SPIN_BUTTON_WIDTH), (float)bounds.y, (float)GuiGetStyle(SPINNER, SPIN_BUTTON_WIDTH), (float)bounds.height };
2057
2058 Rectangle textBounds = { 0 };
2059 if (text != NULL)
2060 {
2061 textBounds.width = (float)GetTextWidth(text);
2062 textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE);
2063 textBounds.x = bounds.x + bounds.width + GuiGetStyle(SPINNER, TEXT_PADDING);
2064 textBounds.y = bounds.y + bounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE)/2;
2065 if (GuiGetStyle(SPINNER, TEXT_ALIGNMENT) == GUI_TEXT_ALIGN_LEFT) textBounds.x = bounds.x - textBounds.width - GuiGetStyle(SPINNER, TEXT_PADDING);
2066 }
2067
2068 // Update control
2069 //--------------------------------------------------------------------
2070 if ((state != GUI_STATE_DISABLED) && !guiLocked)
2071 {
2072 Vector2 mousePoint = GetMousePosition();
2073
2074 // Check spinner state
2075 if (CheckCollisionPointRec(mousePoint, bounds))
2076 {
2078 else state = GUI_STATE_FOCUSED;
2079 }
2080 }
2081
2082 if (!editMode)
2083 {
2084 if (tempValue < minValue) tempValue = minValue;
2085 if (tempValue > maxValue) tempValue = maxValue;
2086 }
2087 //--------------------------------------------------------------------
2088
2089 // Draw control
2090 //--------------------------------------------------------------------
2091 // TODO: Set Spinner properties for ValueBox
2092 pressed = GuiValueBox(spinner, NULL, &tempValue, minValue, maxValue, editMode);
2093
2094 // Draw value selector custom buttons
2095 // NOTE: BORDER_WIDTH and TEXT_ALIGNMENT forced values
2096 int tempBorderWidth = GuiGetStyle(BUTTON, BORDER_WIDTH);
2097 int tempTextAlign = GuiGetStyle(BUTTON, TEXT_ALIGNMENT);
2100
2101#if defined(RAYGUI_NO_RICONS)
2102 if (GuiButton(leftButtonBound, "<")) tempValue--;
2103 if (GuiButton(rightButtonBound, ">")) tempValue++;
2104#else
2105 if (GuiButton(leftButtonBound, GuiIconText(RICON_ARROW_LEFT_FILL, NULL))) tempValue--;
2106 if (GuiButton(rightButtonBound, GuiIconText(RICON_ARROW_RIGHT_FILL, NULL))) tempValue++;
2107#endif
2108
2109 GuiSetStyle(BUTTON, TEXT_ALIGNMENT, tempTextAlign);
2110 GuiSetStyle(BUTTON, BORDER_WIDTH, tempBorderWidth);
2111
2112 // Draw text label if provided
2113 GuiDrawText(text, textBounds, (GuiGetStyle(SPINNER, TEXT_ALIGNMENT) == GUI_TEXT_ALIGN_RIGHT)? GUI_TEXT_ALIGN_LEFT : GUI_TEXT_ALIGN_RIGHT, Fade(GetColor(GuiGetStyle(LABEL, TEXT + (state*3))), guiAlpha));
2114 //--------------------------------------------------------------------
2115
2116 *value = tempValue;
2117 return pressed;
2118}
2119
2120// Value Box control, updates input text with numbers
2121// NOTE: Requires static variables: frameCounter
2122bool GuiValueBox(Rectangle bounds, const char *text, int *value, int minValue, int maxValue, bool editMode)
2123{
2124 #if !defined(VALUEBOX_MAX_CHARS)
2125 #define VALUEBOX_MAX_CHARS 32
2126 #endif
2127
2128 GuiControlState state = guiState;
2129 bool pressed = false;
2130
2131 char textValue[VALUEBOX_MAX_CHARS + 1] = "\0";
2132 sprintf(textValue, "%i", *value);
2133
2134 Rectangle textBounds = { 0 };
2135 if (text != NULL)
2136 {
2137 textBounds.width = (float)GetTextWidth(text);
2138 textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE);
2139 textBounds.x = bounds.x + bounds.width + GuiGetStyle(VALUEBOX, TEXT_PADDING);
2140 textBounds.y = bounds.y + bounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE)/2;
2141 if (GuiGetStyle(VALUEBOX, TEXT_ALIGNMENT) == GUI_TEXT_ALIGN_LEFT) textBounds.x = bounds.x - textBounds.width - GuiGetStyle(VALUEBOX, TEXT_PADDING);
2142 }
2143
2144 // Update control
2145 //--------------------------------------------------------------------
2146 if ((state != GUI_STATE_DISABLED) && !guiLocked)
2147 {
2148 Vector2 mousePoint = GetMousePosition();
2149
2150 bool valueHasChanged = false;
2151
2152 if (editMode)
2153 {
2154 state = GUI_STATE_PRESSED;
2155
2156 int keyCount = (int)strlen(textValue);
2157
2158 // Only allow keys in range [48..57]
2159 if (keyCount < VALUEBOX_MAX_CHARS)
2160 {
2161 if (GetTextWidth(textValue) < bounds.width)
2162 {
2163 int key = GetCharPressed();
2164 if ((key >= 48) && (key <= 57))
2165 {
2166 textValue[keyCount] = (char)key;
2167 keyCount++;
2168 valueHasChanged = true;
2169 }
2170 }
2171 }
2172
2173 // Delete text
2174 if (keyCount > 0)
2175 {
2177 {
2178 keyCount--;
2179 textValue[keyCount] = '\0';
2180 if (keyCount < 0) keyCount = 0;
2181 valueHasChanged = true;
2182 }
2183 }
2184
2185 if (valueHasChanged) *value = TextToInteger(textValue);
2186
2187 if (IsKeyPressed(KEY_ENTER) || (!CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON))) pressed = true;
2188 }
2189 else
2190 {
2191 if (*value > maxValue) *value = maxValue;
2192 else if (*value < minValue) *value = minValue;
2193
2194 if (CheckCollisionPointRec(mousePoint, bounds))
2195 {
2196 state = GUI_STATE_FOCUSED;
2197 if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) pressed = true;
2198 }
2199 }
2200 }
2201 //--------------------------------------------------------------------
2202
2203 // Draw control
2204 //--------------------------------------------------------------------
2205 Color baseColor = BLANK;
2207 else if (state == GUI_STATE_DISABLED) baseColor = GetColor(GuiGetStyle(VALUEBOX, BASE_COLOR_DISABLED));
2208
2209 // WARNING: BLANK color does not work properly with Fade()
2210 GuiDrawRectangle(bounds, GuiGetStyle(VALUEBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(VALUEBOX, BORDER + (state*3))), guiAlpha), baseColor);
2211 GuiDrawText(textValue, GetTextBounds(VALUEBOX, bounds), GUI_TEXT_ALIGN_CENTER, Fade(GetColor(GuiGetStyle(VALUEBOX, TEXT + (state*3))), guiAlpha));
2212
2213 // Draw cursor
2214 if (editMode)
2215 {
2216 // NOTE: ValueBox internal text is always centered
2217 Rectangle cursor = { bounds.x + GetTextWidth(textValue)/2 + bounds.width/2 + 2, bounds.y + 2*GuiGetStyle(VALUEBOX, BORDER_WIDTH), 4, bounds.height - 4*GuiGetStyle(VALUEBOX, BORDER_WIDTH) };
2218 GuiDrawRectangle(cursor, 0, BLANK, Fade(GetColor(GuiGetStyle(VALUEBOX, BORDER_COLOR_PRESSED)), guiAlpha));
2219 }
2220
2221 // Draw text label if provided
2222 GuiDrawText(text, textBounds, (GuiGetStyle(VALUEBOX, TEXT_ALIGNMENT) == GUI_TEXT_ALIGN_RIGHT)? GUI_TEXT_ALIGN_LEFT : GUI_TEXT_ALIGN_RIGHT, Fade(GetColor(GuiGetStyle(LABEL, TEXT + (state*3))), guiAlpha));
2223 //--------------------------------------------------------------------
2224
2225 return pressed;
2226}
2227
2228// Text Box control with multiple lines
2229bool GuiTextBoxMulti(Rectangle bounds, char *text, int textSize, bool editMode)
2230{
2231 GuiControlState state = guiState;
2232 bool pressed = false;
2233
2234 Rectangle textAreaBounds = {
2239 };
2240
2241 // Cursor position, [x, y] values should be updated
2242 Rectangle cursor = { 0, -1, 4, (float)GuiGetStyle(DEFAULT, TEXT_SIZE) + 2 };
2243
2244 float scaleFactor = (float)GuiGetStyle(DEFAULT, TEXT_SIZE)/(float)guiFont.baseSize; // Character rectangle scaling factor
2245
2246 // Update control
2247 //--------------------------------------------------------------------
2248 if ((state != GUI_STATE_DISABLED) && !guiLocked)
2249 {
2250 Vector2 mousePoint = GetMousePosition();
2251
2252 if (editMode)
2253 {
2254 state = GUI_STATE_PRESSED;
2255
2256 // We get an Unicode codepoint
2257 int codepoint = GetCharPressed();
2258 int textLength = (int)strlen(text); // Length in bytes (UTF-8 string)
2259
2260 // Introduce characters
2261 if (textLength < (textSize - 1))
2262 {
2264 {
2265 text[textLength] = '\n';
2266 textLength++;
2267 }
2268 else if (codepoint >= 32)
2269 {
2270 // Supports Unicode inputs -> Encoded to UTF-8
2271 int charUTF8Length = 0;
2272 const char *charEncoded = CodepointToUTF8(codepoint, &charUTF8Length);
2273 memcpy(text + textLength, charEncoded, charUTF8Length);
2274 textLength += charUTF8Length;
2275 }
2276 }
2277
2278 // Delete characters
2279 if (textLength > 0)
2280 {
2282 {
2283 if ((unsigned char)text[textLength - 1] < 127)
2284 {
2285 // Remove ASCII equivalent character (1 byte)
2286 textLength--;
2287 text[textLength] = '\0';
2288 }
2289 else
2290 {
2291 // Remove latest UTF-8 unicode character introduced (n bytes)
2292 int charUTF8Length = 0;
2293 while (((unsigned char)text[textLength - 1 - charUTF8Length] & 0b01000000) == 0) charUTF8Length++;
2294
2295 textLength -= (charUTF8Length + 1);
2296 text[textLength] = '\0';
2297 }
2298 }
2299 }
2300
2301 // Exit edit mode
2302 if (!CheckCollisionPointRec(mousePoint, bounds) && IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) pressed = true;
2303 }
2304 else
2305 {
2306 if (CheckCollisionPointRec(mousePoint, bounds))
2307 {
2308 state = GUI_STATE_FOCUSED;
2309 if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) pressed = true;
2310 }
2311 }
2312 }
2313 //--------------------------------------------------------------------
2314
2315 // Draw control
2316 //--------------------------------------------------------------------
2317 if (state == GUI_STATE_PRESSED)
2318 {
2319 GuiDrawRectangle(bounds, GuiGetStyle(TEXTBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(TEXTBOX, BORDER + (state*3))), guiAlpha), Fade(GetColor(GuiGetStyle(TEXTBOX, BASE_COLOR_PRESSED)), guiAlpha));
2320 }
2321 else if (state == GUI_STATE_DISABLED)
2322 {
2323 GuiDrawRectangle(bounds, GuiGetStyle(TEXTBOX, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(TEXTBOX, BORDER + (state*3))), guiAlpha), Fade(GetColor(GuiGetStyle(TEXTBOX, BASE_COLOR_DISABLED)), guiAlpha));
2324 }
2325 else GuiDrawRectangle(bounds, 1, Fade(GetColor(GuiGetStyle(TEXTBOX, BORDER + (state*3))), guiAlpha), BLANK);
2326
2327 int wrapMode = 1; // 0-No wrap, 1-Char wrap, 2-Word wrap
2328 Vector2 cursorPos = { textAreaBounds.x, textAreaBounds.y };
2329
2330 //int lastSpacePos = 0;
2331 //int lastSpaceWidth = 0;
2332 //int lastSpaceCursorPos = 0;
2333
2334 for (int i = 0, codepointLength = 0; text[i] != '\0'; i += codepointLength)
2335 {
2336 int codepoint = GetCodepoint(text + i, &codepointLength);
2337 int index = GetGlyphIndex(guiFont, codepoint); // If requested codepoint is not found, we get '?' (0x3f)
2338 Rectangle atlasRec = guiFont.recs[index];
2339 GlyphInfo glyphInfo = guiFont.glyphs[index]; // Glyph measures
2340
2341 if ((codepointLength == 1) && (codepoint == '\n'))
2342 {
2343 cursorPos.y += (guiFont.baseSize*scaleFactor + GuiGetStyle(TEXTBOX, TEXT_LINES_PADDING)); // Line feed
2344 cursorPos.x = textAreaBounds.x; // Carriage return
2345 }
2346 else
2347 {
2348 if (wrapMode == 1)
2349 {
2350 int glyphWidth = 0;
2351 if (glyphInfo.advanceX != 0) glyphWidth += glyphInfo.advanceX;
2352 else glyphWidth += (atlasRec.width + glyphInfo.offsetX);
2353
2354 // Jump line if the end of the text box area has been reached
2355 if ((cursorPos.x + (glyphWidth*scaleFactor)) > (textAreaBounds.x + textAreaBounds.width))
2356 {
2357 cursorPos.y += (guiFont.baseSize*scaleFactor + GuiGetStyle(TEXTBOX, TEXT_LINES_PADDING)); // Line feed
2358 cursorPos.x = textAreaBounds.x; // Carriage return
2359 }
2360 }
2361 else if (wrapMode == 2)
2362 {
2363 /*
2364 if ((codepointLength == 1) && (codepoint == ' '))
2365 {
2366 lastSpacePos = i;
2367 lastSpaceWidth = 0;
2368 lastSpaceCursorPos = cursorPos.x;
2369 }
2370
2371 // Jump line if last word reaches end of text box area
2372 if ((lastSpaceCursorPos + lastSpaceWidth) > (textAreaBounds.x + textAreaBounds.width))
2373 {
2374 cursorPos.y += 12; // Line feed
2375 cursorPos.x = textAreaBounds.x; // Carriage return
2376 }
2377 */
2378 }
2379
2380 // Draw current character glyph
2381 DrawTextCodepoint(guiFont, codepoint, cursorPos, (float)GuiGetStyle(DEFAULT, TEXT_SIZE), Fade(GetColor(GuiGetStyle(TEXTBOX, TEXT + (state*3))), guiAlpha));
2382
2383 int glyphWidth = 0;
2384 if (glyphInfo.advanceX != 0) glyphWidth += glyphInfo.advanceX;
2385 else glyphWidth += (atlasRec.width + glyphInfo.offsetX);
2386
2387 cursorPos.x += (glyphWidth*scaleFactor + (float)GuiGetStyle(DEFAULT, TEXT_SPACING));
2388 //if (i > lastSpacePos) lastSpaceWidth += (atlasRec.width + (float)GuiGetStyle(DEFAULT, TEXT_SPACING));
2389 }
2390 }
2391
2392 cursor.x = cursorPos.x;
2393 cursor.y = cursorPos.y;
2394
2395 // Draw cursor position considering text glyphs
2396 if (editMode) GuiDrawRectangle(cursor, 0, BLANK, Fade(GetColor(GuiGetStyle(TEXTBOX, BORDER_COLOR_PRESSED)), guiAlpha));
2397 //--------------------------------------------------------------------
2398
2399 return pressed;
2400}
2401
2402// Slider control with pro parameters
2403// NOTE: Other GuiSlider*() controls use this one
2404float GuiSliderPro(Rectangle bounds, const char *textLeft, const char *textRight, float value, float minValue, float maxValue, int sliderWidth)
2405{
2406 GuiControlState state = guiState;
2407
2408 int sliderValue = (int)(((value - minValue)/(maxValue - minValue))*(bounds.width - 2*GuiGetStyle(SLIDER, BORDER_WIDTH)));
2409
2410 Rectangle slider = { bounds.x, bounds.y + GuiGetStyle(SLIDER, BORDER_WIDTH) + GuiGetStyle(SLIDER, SLIDER_PADDING),
2412
2413 if (sliderWidth > 0) // Slider
2414 {
2415 slider.x += (sliderValue - sliderWidth/2);
2416 slider.width = (float)sliderWidth;
2417 }
2418 else if (sliderWidth == 0) // SliderBar
2419 {
2420 slider.x += GuiGetStyle(SLIDER, BORDER_WIDTH);
2421 slider.width = (float)sliderValue;
2422 }
2423
2424 // Update control
2425 //--------------------------------------------------------------------
2426 if ((state != GUI_STATE_DISABLED) && !guiLocked)
2427 {
2428 Vector2 mousePoint = GetMousePosition();
2429
2430 if (CheckCollisionPointRec(mousePoint, bounds))
2431 {
2433 {
2434 state = GUI_STATE_PRESSED;
2435
2436 // Get equivalent value and slider position from mousePoint.x
2437 value = ((maxValue - minValue)*(mousePoint.x - (float)(bounds.x + sliderWidth/2)))/(float)(bounds.width - sliderWidth) + minValue;
2438
2439 if (sliderWidth > 0) slider.x = mousePoint.x - slider.width/2; // Slider
2440 else if (sliderWidth == 0) slider.width = (float)sliderValue; // SliderBar
2441 }
2442 else state = GUI_STATE_FOCUSED;
2443 }
2444
2445 if (value > maxValue) value = maxValue;
2446 else if (value < minValue) value = minValue;
2447 }
2448
2449 // Bar limits check
2450 if (sliderWidth > 0) // Slider
2451 {
2452 if (slider.x <= (bounds.x + GuiGetStyle(SLIDER, BORDER_WIDTH))) slider.x = bounds.x + GuiGetStyle(SLIDER, BORDER_WIDTH);
2453 else if ((slider.x + slider.width) >= (bounds.x + bounds.width)) slider.x = bounds.x + bounds.width - slider.width - GuiGetStyle(SLIDER, BORDER_WIDTH);
2454 }
2455 else if (sliderWidth == 0) // SliderBar
2456 {
2457 if (slider.width > bounds.width) slider.width = bounds.width - 2*GuiGetStyle(SLIDER, BORDER_WIDTH);
2458 }
2459 //--------------------------------------------------------------------
2460
2461 // Draw control
2462 //--------------------------------------------------------------------
2463 GuiDrawRectangle(bounds, GuiGetStyle(SLIDER, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(SLIDER, BORDER + (state*3))), guiAlpha), Fade(GetColor(GuiGetStyle(SLIDER, (state != GUI_STATE_DISABLED)? BASE_COLOR_NORMAL : BASE_COLOR_DISABLED)), guiAlpha));
2464
2465 // Draw slider internal bar (depends on state)
2466 if ((state == GUI_STATE_NORMAL) || (state == GUI_STATE_PRESSED)) GuiDrawRectangle(slider, 0, BLANK, Fade(GetColor(GuiGetStyle(SLIDER, BASE_COLOR_PRESSED)), guiAlpha));
2467 else if (state == GUI_STATE_FOCUSED) GuiDrawRectangle(slider, 0, BLANK, Fade(GetColor(GuiGetStyle(SLIDER, TEXT_COLOR_FOCUSED)), guiAlpha));
2468
2469 // Draw left/right text if provided
2470 if (textLeft != NULL)
2471 {
2472 Rectangle textBounds = { 0 };
2473 textBounds.width = (float)GetTextWidth(textLeft);
2474 textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE);
2475 textBounds.x = bounds.x - textBounds.width - GuiGetStyle(SLIDER, TEXT_PADDING);
2476 textBounds.y = bounds.y + bounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE)/2;
2477
2478 GuiDrawText(textLeft, textBounds, GUI_TEXT_ALIGN_RIGHT, Fade(GetColor(GuiGetStyle(SLIDER, TEXT + (state*3))), guiAlpha));
2479 }
2480
2481 if (textRight != NULL)
2482 {
2483 Rectangle textBounds = { 0 };
2484 textBounds.width = (float)GetTextWidth(textRight);
2485 textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE);
2486 textBounds.x = bounds.x + bounds.width + GuiGetStyle(SLIDER, TEXT_PADDING);
2487 textBounds.y = bounds.y + bounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE)/2;
2488
2489 GuiDrawText(textRight, textBounds, GUI_TEXT_ALIGN_LEFT, Fade(GetColor(GuiGetStyle(SLIDER, TEXT + (state*3))), guiAlpha));
2490 }
2491 //--------------------------------------------------------------------
2492
2493 return value;
2494}
2495
2496// Slider control extended, returns selected value and has text
2497float GuiSlider(Rectangle bounds, const char *textLeft, const char *textRight, float value, float minValue, float maxValue)
2498{
2499 return GuiSliderPro(bounds, textLeft, textRight, value, minValue, maxValue, GuiGetStyle(SLIDER, SLIDER_WIDTH));
2500}
2501
2502// Slider Bar control extended, returns selected value
2503float GuiSliderBar(Rectangle bounds, const char *textLeft, const char *textRight, float value, float minValue, float maxValue)
2504{
2505 return GuiSliderPro(bounds, textLeft, textRight, value, minValue, maxValue, 0);
2506}
2507
2508// Progress Bar control extended, shows current progress value
2509float GuiProgressBar(Rectangle bounds, const char *textLeft, const char *textRight, float value, float minValue, float maxValue)
2510{
2511 GuiControlState state = guiState;
2512
2513 Rectangle progress = { bounds.x + GuiGetStyle(PROGRESSBAR, BORDER_WIDTH),
2516
2517 // Update control
2518 //--------------------------------------------------------------------
2519 if (state != GUI_STATE_DISABLED) progress.width = ((float)(value/(maxValue - minValue))*(float)(bounds.width - 2*GuiGetStyle(PROGRESSBAR, BORDER_WIDTH)));
2520 //--------------------------------------------------------------------
2521
2522 // Draw control
2523 //--------------------------------------------------------------------
2524 GuiDrawRectangle(bounds, GuiGetStyle(PROGRESSBAR, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(PROGRESSBAR, BORDER + (state*3))), guiAlpha), BLANK);
2525
2526 // Draw slider internal progress bar (depends on state)
2527 if ((state == GUI_STATE_NORMAL) || (state == GUI_STATE_PRESSED)) GuiDrawRectangle(progress, 0, BLANK, Fade(GetColor(GuiGetStyle(PROGRESSBAR, BASE_COLOR_PRESSED)), guiAlpha));
2528 else if (state == GUI_STATE_FOCUSED) GuiDrawRectangle(progress, 0, BLANK, Fade(GetColor(GuiGetStyle(PROGRESSBAR, TEXT_COLOR_FOCUSED)), guiAlpha));
2529
2530 // Draw left/right text if provided
2531 if (textLeft != NULL)
2532 {
2533 Rectangle textBounds = { 0 };
2534 textBounds.width = (float)GetTextWidth(textLeft);
2535 textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE);
2536 textBounds.x = bounds.x - textBounds.width - GuiGetStyle(PROGRESSBAR, TEXT_PADDING);
2537 textBounds.y = bounds.y + bounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE)/2;
2538
2539 GuiDrawText(textLeft, textBounds, GUI_TEXT_ALIGN_RIGHT, Fade(GetColor(GuiGetStyle(PROGRESSBAR, TEXT + (state*3))), guiAlpha));
2540 }
2541
2542 if (textRight != NULL)
2543 {
2544 Rectangle textBounds = { 0 };
2545 textBounds.width = (float)GetTextWidth(textRight);
2546 textBounds.height = (float)GuiGetStyle(DEFAULT, TEXT_SIZE);
2547 textBounds.x = bounds.x + bounds.width + GuiGetStyle(PROGRESSBAR, TEXT_PADDING);
2548 textBounds.y = bounds.y + bounds.height/2 - GuiGetStyle(DEFAULT, TEXT_SIZE)/2;
2549
2550 GuiDrawText(textRight, textBounds, GUI_TEXT_ALIGN_LEFT, Fade(GetColor(GuiGetStyle(PROGRESSBAR, TEXT + (state*3))), guiAlpha));
2551 }
2552 //--------------------------------------------------------------------
2553
2554 return value;
2555}
2556
2557// Status Bar control
2558void GuiStatusBar(Rectangle bounds, const char *text)
2559{
2560 GuiControlState state = guiState;
2561
2562 // Draw control
2563 //--------------------------------------------------------------------
2566 GuiDrawText(text, GetTextBounds(STATUSBAR, bounds), GuiGetStyle(STATUSBAR, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(STATUSBAR, (state != GUI_STATE_DISABLED)? TEXT_COLOR_NORMAL : TEXT_COLOR_DISABLED)), guiAlpha));
2567 //--------------------------------------------------------------------
2568}
2569
2570// Dummy rectangle control, intended for placeholding
2571void GuiDummyRec(Rectangle bounds, const char *text)
2572{
2573 GuiControlState state = guiState;
2574
2575 // Update control
2576 //--------------------------------------------------------------------
2577 if ((state != GUI_STATE_DISABLED) && !guiLocked)
2578 {
2579 Vector2 mousePoint = GetMousePosition();
2580
2581 // Check button state
2582 if (CheckCollisionPointRec(mousePoint, bounds))
2583 {
2585 else state = GUI_STATE_FOCUSED;
2586 }
2587 }
2588 //--------------------------------------------------------------------
2589
2590 // Draw control
2591 //--------------------------------------------------------------------
2592 GuiDrawRectangle(bounds, 0, BLANK, Fade(GetColor(GuiGetStyle(DEFAULT, (state != GUI_STATE_DISABLED)? BASE_COLOR_NORMAL : BASE_COLOR_DISABLED)), guiAlpha));
2593 GuiDrawText(text, GetTextBounds(DEFAULT, bounds), GUI_TEXT_ALIGN_CENTER, Fade(GetColor(GuiGetStyle(BUTTON, (state != GUI_STATE_DISABLED)? TEXT_COLOR_NORMAL : TEXT_COLOR_DISABLED)), guiAlpha));
2594 //------------------------------------------------------------------
2595}
2596
2597// Scroll Bar control
2598int GuiScrollBar(Rectangle bounds, int value, int minValue, int maxValue)
2599{
2600 GuiControlState state = guiState;
2601
2602 // Is the scrollbar horizontal or vertical?
2603 bool isVertical = (bounds.width > bounds.height)? false : true;
2604
2605 // The size (width or height depending on scrollbar type) of the spinner buttons
2606 const int spinnerSize = GuiGetStyle(SCROLLBAR, ARROWS_VISIBLE)? (isVertical? (int)bounds.width - 2*GuiGetStyle(SCROLLBAR, BORDER_WIDTH) : (int)bounds.height - 2*GuiGetStyle(SCROLLBAR, BORDER_WIDTH)) : 0;
2607
2608 // Arrow buttons [<] [>] [∧] [∨]
2609 Rectangle arrowUpLeft = { 0 };
2610 Rectangle arrowDownRight = { 0 };
2611
2612 // Actual area of the scrollbar excluding the arrow buttons
2613 Rectangle scrollbar = { 0 };
2614
2615 // Slider bar that moves --[///]-----
2616 Rectangle slider = { 0 };
2617
2618 // Normalize value
2619 if (value > maxValue) value = maxValue;
2620 if (value < minValue) value = minValue;
2621
2622 const int range = maxValue - minValue;
2623 int sliderSize = GuiGetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE);
2624
2625 // Calculate rectangles for all of the components
2626 arrowUpLeft = RAYGUI_CLITERAL(Rectangle){ (float)bounds.x + GuiGetStyle(SCROLLBAR, BORDER_WIDTH), (float)bounds.y + GuiGetStyle(SCROLLBAR, BORDER_WIDTH), (float)spinnerSize, (float)spinnerSize };
2627
2628 if (isVertical)
2629 {
2630 arrowDownRight = RAYGUI_CLITERAL(Rectangle){ (float)bounds.x + GuiGetStyle(SCROLLBAR, BORDER_WIDTH), (float)bounds.y + bounds.height - spinnerSize - GuiGetStyle(SCROLLBAR, BORDER_WIDTH), (float)spinnerSize, (float)spinnerSize};
2631 scrollbar = RAYGUI_CLITERAL(Rectangle){ bounds.x + GuiGetStyle(SCROLLBAR, BORDER_WIDTH) + GuiGetStyle(SCROLLBAR, SCROLL_PADDING), arrowUpLeft.y + arrowUpLeft.height, bounds.width - 2*(GuiGetStyle(SCROLLBAR, BORDER_WIDTH) + GuiGetStyle(SCROLLBAR, SCROLL_PADDING)), bounds.height - arrowUpLeft.height - arrowDownRight.height - 2*GuiGetStyle(SCROLLBAR, BORDER_WIDTH) };
2632 sliderSize = (sliderSize >= scrollbar.height)? ((int)scrollbar.height - 2) : sliderSize; // Make sure the slider won't get outside of the scrollbar
2633 slider = RAYGUI_CLITERAL(Rectangle){ (float)bounds.x + GuiGetStyle(SCROLLBAR, BORDER_WIDTH) + GuiGetStyle(SCROLLBAR, SCROLL_SLIDER_PADDING), (float)scrollbar.y + (int)(((float)(value - minValue)/range)*(scrollbar.height - sliderSize)), (float)bounds.width - 2*(GuiGetStyle(SCROLLBAR, BORDER_WIDTH) + GuiGetStyle(SCROLLBAR, SCROLL_SLIDER_PADDING)), (float)sliderSize };
2634 }
2635 else
2636 {
2637 arrowDownRight = RAYGUI_CLITERAL(Rectangle){ (float)bounds.x + bounds.width - spinnerSize - GuiGetStyle(SCROLLBAR, BORDER_WIDTH), (float)bounds.y + GuiGetStyle(SCROLLBAR, BORDER_WIDTH), (float)spinnerSize, (float)spinnerSize};
2638 scrollbar = RAYGUI_CLITERAL(Rectangle){ arrowUpLeft.x + arrowUpLeft.width, bounds.y + GuiGetStyle(SCROLLBAR, BORDER_WIDTH) + GuiGetStyle(SCROLLBAR, SCROLL_PADDING), bounds.width - arrowUpLeft.width - arrowDownRight.width - 2*GuiGetStyle(SCROLLBAR, BORDER_WIDTH), bounds.height - 2*(GuiGetStyle(SCROLLBAR, BORDER_WIDTH) + GuiGetStyle(SCROLLBAR, SCROLL_PADDING))};
2639 sliderSize = (sliderSize >= scrollbar.width)? ((int)scrollbar.width - 2) : sliderSize; // Make sure the slider won't get outside of the scrollbar
2640 slider = RAYGUI_CLITERAL(Rectangle){ (float)scrollbar.x + (int)(((float)(value - minValue)/range)*(scrollbar.width - sliderSize)), (float)bounds.y + GuiGetStyle(SCROLLBAR, BORDER_WIDTH) + GuiGetStyle(SCROLLBAR, SCROLL_SLIDER_PADDING), (float)sliderSize, (float)bounds.height - 2*(GuiGetStyle(SCROLLBAR, BORDER_WIDTH) + GuiGetStyle(SCROLLBAR, SCROLL_SLIDER_PADDING)) };
2641 }
2642
2643 // Update control
2644 //--------------------------------------------------------------------
2645 if ((state != GUI_STATE_DISABLED) && !guiLocked)
2646 {
2647 Vector2 mousePoint = GetMousePosition();
2648
2649 if (CheckCollisionPointRec(mousePoint, bounds))
2650 {
2651 state = GUI_STATE_FOCUSED;
2652
2653 // Handle mouse wheel
2654 int wheel = (int)GetMouseWheelMove();
2655 if (wheel != 0) value += wheel;
2656
2658 {
2659 if (CheckCollisionPointRec(mousePoint, arrowUpLeft)) value -= range/GuiGetStyle(SCROLLBAR, SCROLL_SPEED);
2660 else if (CheckCollisionPointRec(mousePoint, arrowDownRight)) value += range/GuiGetStyle(SCROLLBAR, SCROLL_SPEED);
2661
2662 state = GUI_STATE_PRESSED;
2663 }
2665 {
2666 if (!isVertical)
2667 {
2668 Rectangle scrollArea = { arrowUpLeft.x + arrowUpLeft.width, arrowUpLeft.y, scrollbar.width, bounds.height - 2*GuiGetStyle(SCROLLBAR, BORDER_WIDTH)};
2669 if (CheckCollisionPointRec(mousePoint, scrollArea)) value = (int)(((float)(mousePoint.x - scrollArea.x - slider.width/2)*range)/(scrollArea.width - slider.width) + minValue);
2670 }
2671 else
2672 {
2673 Rectangle scrollArea = { arrowUpLeft.x, arrowUpLeft.y+arrowUpLeft.height, bounds.width - 2*GuiGetStyle(SCROLLBAR, BORDER_WIDTH), scrollbar.height};
2674 if (CheckCollisionPointRec(mousePoint, scrollArea)) value = (int)(((float)(mousePoint.y - scrollArea.y - slider.height/2)*range)/(scrollArea.height - slider.height) + minValue);
2675 }
2676 }
2677 }
2678
2679 // Normalize value
2680 if (value > maxValue) value = maxValue;
2681 if (value < minValue) value = minValue;
2682 }
2683 //--------------------------------------------------------------------
2684
2685 // Draw control
2686 //--------------------------------------------------------------------
2687 GuiDrawRectangle(bounds, GuiGetStyle(SCROLLBAR, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(LISTVIEW, BORDER + state*3)), guiAlpha), Fade(GetColor(GuiGetStyle(DEFAULT, BORDER_COLOR_DISABLED)), guiAlpha)); // Draw the background
2688
2689 GuiDrawRectangle(scrollbar, 0, BLANK, Fade(GetColor(GuiGetStyle(BUTTON, BASE_COLOR_NORMAL)), guiAlpha)); // Draw the scrollbar active area background
2690 GuiDrawRectangle(slider, 0, BLANK, Fade(GetColor(GuiGetStyle(SLIDER, BORDER + state*3)), guiAlpha)); // Draw the slider bar
2691
2692 // Draw arrows (using icon if available)
2694 {
2695#if defined(RAYGUI_NO_RICONS)
2696 GuiDrawText(isVertical? "^" : "<", RAYGUI_CLITERAL(Rectangle){ arrowUpLeft.x, arrowUpLeft.y, isVertical? bounds.width : bounds.height, isVertical? bounds.width : bounds.height },
2697 GUI_TEXT_ALIGN_CENTER, Fade(GetColor(GuiGetStyle(DROPDOWNBOX, TEXT + (state*3))), guiAlpha));
2698 GuiDrawText(isVertical? "v" : ">", RAYGUI_CLITERAL(Rectangle){ arrowDownRight.x, arrowDownRight.y, isVertical? bounds.width : bounds.height, isVertical? bounds.width : bounds.height },
2699 GUI_TEXT_ALIGN_CENTER, Fade(GetColor(GuiGetStyle(DROPDOWNBOX, TEXT + (state*3))), guiAlpha));
2700#else
2701 GuiDrawText(isVertical? "#121#" : "#118#", RAYGUI_CLITERAL(Rectangle){ arrowUpLeft.x, arrowUpLeft.y, isVertical? bounds.width : bounds.height, isVertical? bounds.width : bounds.height },
2702 GUI_TEXT_ALIGN_CENTER, Fade(GetColor(GuiGetStyle(SCROLLBAR, TEXT + state*3)), guiAlpha)); // RICON_ARROW_UP_FILL / RICON_ARROW_LEFT_FILL
2703 GuiDrawText(isVertical? "#120#" : "#119#", RAYGUI_CLITERAL(Rectangle){ arrowDownRight.x, arrowDownRight.y, isVertical? bounds.width : bounds.height, isVertical? bounds.width : bounds.height },
2704 GUI_TEXT_ALIGN_CENTER, Fade(GetColor(GuiGetStyle(SCROLLBAR, TEXT + state*3)), guiAlpha)); // RICON_ARROW_DOWN_FILL / RICON_ARROW_RIGHT_FILL
2705#endif
2706 }
2707 //--------------------------------------------------------------------
2708
2709 return value;
2710}
2711
2712// List View control
2713int GuiListView(Rectangle bounds, const char *text, int *scrollIndex, int active)
2714{
2715 int itemCount = 0;
2716 const char **items = NULL;
2717
2718 if (text != NULL) items = GuiTextSplit(text, &itemCount, NULL);
2719
2720 return GuiListViewEx(bounds, items, itemCount, NULL, scrollIndex, active);
2721}
2722
2723// List View control with extended parameters
2724int GuiListViewEx(Rectangle bounds, const char **text, int count, int *focus, int *scrollIndex, int active)
2725{
2726 GuiControlState state = guiState;
2727 int itemFocused = (focus == NULL)? -1 : *focus;
2728 int itemSelected = active;
2729
2730 // Check if we need a scroll bar
2731 bool useScrollBar = false;
2732 if ((GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT) + GuiGetStyle(LISTVIEW, LIST_ITEMS_PADDING))*count > bounds.height) useScrollBar = true;
2733
2734 // Define base item rectangle [0]
2735 Rectangle itemBounds = { 0 };
2736 itemBounds.x = bounds.x + GuiGetStyle(LISTVIEW, LIST_ITEMS_PADDING);
2739 itemBounds.height = (float)GuiGetStyle(LISTVIEW, LIST_ITEMS_HEIGHT);
2740 if (useScrollBar) itemBounds.width -= GuiGetStyle(LISTVIEW, SCROLLBAR_WIDTH);
2741
2742 // Get items on the list
2744 if (visibleItems > count) visibleItems = count;
2745
2746 int startIndex = (scrollIndex == NULL)? 0 : *scrollIndex;
2747 if ((startIndex < 0) || (startIndex > (count - visibleItems))) startIndex = 0;
2748 int endIndex = startIndex + visibleItems;
2749
2750 // Update control
2751 //--------------------------------------------------------------------
2752 if ((state != GUI_STATE_DISABLED) && !guiLocked)
2753 {
2754 Vector2 mousePoint = GetMousePosition();
2755
2756 // Check mouse inside list view
2757 if (CheckCollisionPointRec(mousePoint, bounds))
2758 {
2759 state = GUI_STATE_FOCUSED;
2760
2761 // Check focused and selected item
2762 for (int i = 0; i < visibleItems; i++)
2763 {
2764 if (CheckCollisionPointRec(mousePoint, itemBounds))
2765 {
2766 itemFocused = startIndex + i;
2768 {
2769 if (itemSelected == (startIndex + i)) itemSelected = -1;
2770 else itemSelected = startIndex + i;
2771 }
2772 break;
2773 }
2774
2775 // Update item rectangle y position for next item
2777 }
2778
2779 if (useScrollBar)
2780 {
2781 int wheelMove = (int)GetMouseWheelMove();
2782 startIndex -= wheelMove;
2783
2784 if (startIndex < 0) startIndex = 0;
2785 else if (startIndex > (count - visibleItems)) startIndex = count - visibleItems;
2786
2787 endIndex = startIndex + visibleItems;
2788 if (endIndex > count) endIndex = count;
2789 }
2790 }
2791 else itemFocused = -1;
2792
2793 // Reset item rectangle y to [0]
2795 }
2796 //--------------------------------------------------------------------
2797
2798 // Draw control
2799 //--------------------------------------------------------------------
2800 GuiDrawRectangle(bounds, GuiGetStyle(DEFAULT, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(LISTVIEW, BORDER + state*3)), guiAlpha), GetColor(GuiGetStyle(DEFAULT, BACKGROUND_COLOR))); // Draw background
2801
2802 // Draw visible items
2803 for (int i = 0; ((i < visibleItems) && (text != NULL)); i++)
2804 {
2805 if (state == GUI_STATE_DISABLED)
2806 {
2807 if ((startIndex + i) == itemSelected) GuiDrawRectangle(itemBounds, GuiGetStyle(LISTVIEW, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(LISTVIEW, BORDER_COLOR_DISABLED)), guiAlpha), Fade(GetColor(GuiGetStyle(LISTVIEW, BASE_COLOR_DISABLED)), guiAlpha));
2808
2809 GuiDrawText(text[startIndex + i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(LISTVIEW, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(LISTVIEW, TEXT_COLOR_DISABLED)), guiAlpha));
2810 }
2811 else
2812 {
2813 if ((startIndex + i) == itemSelected)
2814 {
2815 // Draw item selected
2817 GuiDrawText(text[startIndex + i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(LISTVIEW, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(LISTVIEW, TEXT_COLOR_PRESSED)), guiAlpha));
2818 }
2819 else if ((startIndex + i) == itemFocused)
2820 {
2821 // Draw item focused
2823 GuiDrawText(text[startIndex + i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(LISTVIEW, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(LISTVIEW, TEXT_COLOR_FOCUSED)), guiAlpha));
2824 }
2825 else
2826 {
2827 // Draw item normal
2828 GuiDrawText(text[startIndex + i], GetTextBounds(DEFAULT, itemBounds), GuiGetStyle(LISTVIEW, TEXT_ALIGNMENT), Fade(GetColor(GuiGetStyle(LISTVIEW, TEXT_COLOR_NORMAL)), guiAlpha));
2829 }
2830 }
2831
2832 // Update item rectangle y position for next item
2834 }
2835
2836 if (useScrollBar)
2837 {
2838 Rectangle scrollBarBounds = {
2842 };
2843
2844 // Calculate percentage of visible items and apply same percentage to scrollbar
2845 float percentVisible = (float)(endIndex - startIndex)/count;
2846 float sliderSize = bounds.height*percentVisible;
2847
2848 int prevSliderSize = GuiGetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE); // Save default slider size
2849 int prevScrollSpeed = GuiGetStyle(SCROLLBAR, SCROLL_SPEED); // Save default scroll speed
2850 GuiSetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE, (int)sliderSize); // Change slider size
2851 GuiSetStyle(SCROLLBAR, SCROLL_SPEED, count - visibleItems); // Change scroll speed
2852
2853 startIndex = GuiScrollBar(scrollBarBounds, startIndex, 0, count - visibleItems);
2854
2855 GuiSetStyle(SCROLLBAR, SCROLL_SPEED, prevScrollSpeed); // Reset scroll speed to default
2856 GuiSetStyle(SCROLLBAR, SCROLL_SLIDER_SIZE, prevSliderSize); // Reset slider size to default
2857 }
2858 //--------------------------------------------------------------------
2859
2860 if (focus != NULL) *focus = itemFocused;
2861 if (scrollIndex != NULL) *scrollIndex = startIndex;
2862
2863 return itemSelected;
2864}
2865
2866// Color Panel control
2867Color GuiColorPanel(Rectangle bounds, Color color)
2868{
2869 const Color colWhite = { 255, 255, 255, 255 };
2870 const Color colBlack = { 0, 0, 0, 255 };
2871
2872 GuiControlState state = guiState;
2873 Vector2 pickerSelector = { 0 };
2874
2875 Vector3 vcolor = { (float)color.r/255.0f, (float)color.g/255.0f, (float)color.b/255.0f };
2876 Vector3 hsv = ConvertRGBtoHSV(vcolor);
2877
2878 pickerSelector.x = bounds.x + (float)hsv.y*bounds.width; // HSV: Saturation
2879 pickerSelector.y = bounds.y + (1.0f - (float)hsv.z)*bounds.height; // HSV: Value
2880
2881 float hue = -1.0f;
2882 Vector3 maxHue = { hue >= 0.0f ? hue : hsv.x, 1.0f, 1.0f };
2883 Vector3 rgbHue = ConvertHSVtoRGB(maxHue);
2884 Color maxHueCol = { (unsigned char)(255.0f*rgbHue.x),
2885 (unsigned char)(255.0f*rgbHue.y),
2886 (unsigned char)(255.0f*rgbHue.z), 255 };
2887
2888 // Update control
2889 //--------------------------------------------------------------------
2890 if ((state != GUI_STATE_DISABLED) && !guiLocked)
2891 {
2892 Vector2 mousePoint = GetMousePosition();
2893
2894 if (CheckCollisionPointRec(mousePoint, bounds))
2895 {
2897 {
2898 state = GUI_STATE_PRESSED;
2899 pickerSelector = mousePoint;
2900
2901 // Calculate color from picker
2902 Vector2 colorPick = { pickerSelector.x - bounds.x, pickerSelector.y - bounds.y };
2903
2904 colorPick.x /= (float)bounds.width; // Get normalized value on x
2905 colorPick.y /= (float)bounds.height; // Get normalized value on y
2906
2907 hsv.y = colorPick.x;
2908 hsv.z = 1.0f - colorPick.y;
2909
2910 Vector3 rgb = ConvertHSVtoRGB(hsv);
2911
2912 // NOTE: Vector3ToColor() only available on raylib 1.8.1
2913 color = RAYGUI_CLITERAL(Color){ (unsigned char)(255.0f*rgb.x),
2914 (unsigned char)(255.0f*rgb.y),
2915 (unsigned char)(255.0f*rgb.z),
2916 (unsigned char)(255.0f*(float)color.a/255.0f) };
2917
2918 }
2919 else state = GUI_STATE_FOCUSED;
2920 }
2921 }
2922 //--------------------------------------------------------------------
2923
2924 // Draw control
2925 //--------------------------------------------------------------------
2926 if (state != GUI_STATE_DISABLED)
2927 {
2928 DrawRectangleGradientEx(bounds, Fade(colWhite, guiAlpha), Fade(colWhite, guiAlpha), Fade(maxHueCol, guiAlpha), Fade(maxHueCol, guiAlpha));
2929 DrawRectangleGradientEx(bounds, Fade(colBlack, 0), Fade(colBlack, guiAlpha), Fade(colBlack, guiAlpha), Fade(colBlack, 0));
2930
2931 // Draw color picker: selector
2933 GuiDrawRectangle(selector, 0, BLANK, Fade(colWhite, guiAlpha));
2934 }
2935 else
2936 {
2937 DrawRectangleGradientEx(bounds, Fade(Fade(GetColor(GuiGetStyle(COLORPICKER, BASE_COLOR_DISABLED)), 0.1f), guiAlpha), Fade(Fade(colBlack, 0.6f), guiAlpha), Fade(Fade(colBlack, 0.6f), guiAlpha), Fade(Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER_COLOR_DISABLED)), 0.6f), guiAlpha));
2938 }
2939
2940 GuiDrawRectangle(bounds, GuiGetStyle(COLORPICKER, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER + state*3)), guiAlpha), BLANK);
2941 //--------------------------------------------------------------------
2942
2943 return color;
2944}
2945
2946// Color Bar Alpha control
2947// NOTE: Returns alpha value normalized [0..1]
2948float GuiColorBarAlpha(Rectangle bounds, float alpha)
2949{
2950 #define COLORBARALPHA_CHECKED_SIZE 10
2951
2952 GuiControlState state = guiState;
2954
2955 // Update control
2956 //--------------------------------------------------------------------
2957 if ((state != GUI_STATE_DISABLED) && !guiLocked)
2958 {
2959 Vector2 mousePoint = GetMousePosition();
2960
2961 if (CheckCollisionPointRec(mousePoint, bounds) ||
2962 CheckCollisionPointRec(mousePoint, selector))
2963 {
2965 {
2966 state = GUI_STATE_PRESSED;
2967
2968 alpha = (mousePoint.x - bounds.x)/bounds.width;
2969 if (alpha <= 0.0f) alpha = 0.0f;
2970 if (alpha >= 1.0f) alpha = 1.0f;
2971 //selector.x = bounds.x + (int)(((alpha - 0)/(100 - 0))*(bounds.width - 2*GuiGetStyle(SLIDER, BORDER_WIDTH))) - selector.width/2;
2972 }
2973 else state = GUI_STATE_FOCUSED;
2974 }
2975 }
2976 //--------------------------------------------------------------------
2977
2978 // Draw control
2979 //--------------------------------------------------------------------
2980
2981 // Draw alpha bar: checked background
2982 if (state != GUI_STATE_DISABLED)
2983 {
2984 int checksX = (int)bounds.width/COLORBARALPHA_CHECKED_SIZE;
2985 int checksY = (int)bounds.height/COLORBARALPHA_CHECKED_SIZE;
2986
2987 for (int x = 0; x < checksX; x++)
2988 {
2989 for (int y = 0; y < checksY; y++)
2990 {
2991 Rectangle check = { bounds.x + x*COLORBARALPHA_CHECKED_SIZE, bounds.y + y*COLORBARALPHA_CHECKED_SIZE, COLORBARALPHA_CHECKED_SIZE, COLORBARALPHA_CHECKED_SIZE };
2992 GuiDrawRectangle(check, 0, BLANK, ((x + y)%2)? Fade(Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER_COLOR_DISABLED)), 0.4f), guiAlpha) : Fade(Fade(GetColor(GuiGetStyle(COLORPICKER, BASE_COLOR_DISABLED)), 0.4f), guiAlpha));
2993 }
2994 }
2995
2996 DrawRectangleGradientEx(bounds, RAYGUI_CLITERAL(Color){ 255, 255, 255, 0 }, RAYGUI_CLITERAL(Color){ 255, 255, 255, 0 }, Fade(RAYGUI_CLITERAL(Color){ 0, 0, 0, 255 }, guiAlpha), Fade(RAYGUI_CLITERAL(Color){ 0, 0, 0, 255 }, guiAlpha));
2997 }
2999
3000 GuiDrawRectangle(bounds, GuiGetStyle(COLORPICKER, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER + state*3)), guiAlpha), BLANK);
3001
3002 // Draw alpha bar: selector
3003 GuiDrawRectangle(selector, 0, BLANK, Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER + state*3)), guiAlpha));
3004 //--------------------------------------------------------------------
3005
3006 return alpha;
3007}
3008
3009// Color Bar Hue control
3010// Returns hue value normalized [0..1]
3011// NOTE: Other similar bars (for reference):
3012// Color GuiColorBarSat() [WHITE->color]
3013// Color GuiColorBarValue() [BLACK->color], HSV/HSL
3014// float GuiColorBarLuminance() [BLACK->WHITE]
3015float GuiColorBarHue(Rectangle bounds, float hue)
3016{
3017 GuiControlState state = guiState;
3019
3020 // Update control
3021 //--------------------------------------------------------------------
3022 if ((state != GUI_STATE_DISABLED) && !guiLocked)
3023 {
3024 Vector2 mousePoint = GetMousePosition();
3025
3026 if (CheckCollisionPointRec(mousePoint, bounds) ||
3027 CheckCollisionPointRec(mousePoint, selector))
3028 {
3030 {
3031 state = GUI_STATE_PRESSED;
3032
3033 hue = (mousePoint.y - bounds.y)*360/bounds.height;
3034 if (hue <= 0.0f) hue = 0.0f;
3035 if (hue >= 359.0f) hue = 359.0f;
3036
3037 }
3038 else state = GUI_STATE_FOCUSED;
3039
3040 /*if (IsKeyDown(KEY_UP))
3041 {
3042 hue -= 2.0f;
3043 if (hue <= 0.0f) hue = 0.0f;
3044 }
3045 else if (IsKeyDown(KEY_DOWN))
3046 {
3047 hue += 2.0f;
3048 if (hue >= 360.0f) hue = 360.0f;
3049 }*/
3050 }
3051 }
3052 //--------------------------------------------------------------------
3053
3054 // Draw control
3055 //--------------------------------------------------------------------
3056 if (state != GUI_STATE_DISABLED)
3057 {
3058 // Draw hue bar:color bars
3059 DrawRectangleGradientV((int)bounds.x, (int)(bounds.y), (int)bounds.width, ceil(bounds.height/6), Fade(RAYGUI_CLITERAL(Color) { 255, 0, 0, 255 }, guiAlpha), Fade(RAYGUI_CLITERAL(Color) { 255, 255, 0, 255 }, guiAlpha));
3060 DrawRectangleGradientV((int)bounds.x, (int)(bounds.y + bounds.height/6), (int)bounds.width, ceil(bounds.height/6), Fade(RAYGUI_CLITERAL(Color) { 255, 255, 0, 255 }, guiAlpha), Fade(RAYGUI_CLITERAL(Color) { 0, 255, 0, 255 }, guiAlpha));
3061 DrawRectangleGradientV((int)bounds.x, (int)(bounds.y + 2*(bounds.height/6)), (int)bounds.width, ceil(bounds.height/6), Fade(RAYGUI_CLITERAL(Color) { 0, 255, 0, 255 }, guiAlpha), Fade(RAYGUI_CLITERAL(Color) { 0, 255, 255, 255 }, guiAlpha));
3062 DrawRectangleGradientV((int)bounds.x, (int)(bounds.y + 3*(bounds.height/6)), (int)bounds.width, ceil(bounds.height/6), Fade(RAYGUI_CLITERAL(Color) { 0, 255, 255, 255 }, guiAlpha), Fade(RAYGUI_CLITERAL(Color) { 0, 0, 255, 255 }, guiAlpha));
3063 DrawRectangleGradientV((int)bounds.x, (int)(bounds.y + 4*(bounds.height/6)), (int)bounds.width, ceil(bounds.height/6), Fade(RAYGUI_CLITERAL(Color) { 0, 0, 255, 255 }, guiAlpha), Fade(RAYGUI_CLITERAL(Color) { 255, 0, 255, 255 }, guiAlpha));
3064 DrawRectangleGradientV((int)bounds.x, (int)(bounds.y + 5*(bounds.height/6)), (int)bounds.width, (int)(bounds.height/6), Fade(RAYGUI_CLITERAL(Color) { 255, 0, 255, 255 }, guiAlpha), Fade(RAYGUI_CLITERAL(Color) { 255, 0, 0, 255 }, guiAlpha));
3065 }
3066 else DrawRectangleGradientV((int)bounds.x, (int)bounds.y, (int)bounds.width, (int)bounds.height, Fade(Fade(GetColor(GuiGetStyle(COLORPICKER, BASE_COLOR_DISABLED)), 0.1f), guiAlpha), Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER_COLOR_DISABLED)), guiAlpha));
3067
3068 GuiDrawRectangle(bounds, GuiGetStyle(COLORPICKER, BORDER_WIDTH), Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER + state*3)), guiAlpha), BLANK);
3069
3070 // Draw hue bar: selector
3071 GuiDrawRectangle(selector, 0, BLANK, Fade(GetColor(GuiGetStyle(COLORPICKER, BORDER + state*3)), guiAlpha));
3072 //--------------------------------------------------------------------
3073
3074 return hue;
3075}
3076
3077// Color Picker control
3078// NOTE: It's divided in multiple controls:
3079// Color GuiColorPanel(Rectangle bounds, Color color)
3080// float GuiColorBarAlpha(Rectangle bounds, float alpha)
3081// float GuiColorBarHue(Rectangle bounds, float value)
3082// NOTE: bounds define GuiColorPanel() size
3083Color GuiColorPicker(Rectangle bounds, Color color)
3084{
3085 color = GuiColorPanel(bounds, color);
3086
3087 Rectangle boundsHue = { (float)bounds.x + bounds.width + GuiGetStyle(COLORPICKER, HUEBAR_PADDING), (float)bounds.y, (float)GuiGetStyle(COLORPICKER, HUEBAR_WIDTH), (float)bounds.height };
3088 //Rectangle boundsAlpha = { bounds.x, bounds.y + bounds.height + GuiGetStyle(COLORPICKER, BARS_PADDING), bounds.width, GuiGetStyle(COLORPICKER, BARS_THICK) };
3089
3090 Vector3 hsv = ConvertRGBtoHSV(RAYGUI_CLITERAL(Vector3){ color.r/255.0f, color.g/255.0f, color.b/255.0f });
3091 hsv.x = GuiColorBarHue(boundsHue, hsv.x);
3092 //color.a = (unsigned char)(GuiColorBarAlpha(boundsAlpha, (float)color.a/255.0f)*255.0f);
3093 Vector3 rgb = ConvertHSVtoRGB(hsv);
3094
3095 color = RAYGUI_CLITERAL(Color){ (unsigned char)roundf(rgb.x*255.0f), (unsigned char)roundf(rgb.y*255.0f), (unsigned char)roundf(rgb.z*255.0f), color.a };
3096
3097 return color;
3098}
3099
3100// Message Box control
3101int GuiMessageBox(Rectangle bounds, const char *title, const char *message, const char *buttons)
3102{
3103 #define MESSAGEBOX_BUTTON_HEIGHT 24
3104 #define MESSAGEBOX_BUTTON_PADDING 10
3105
3106 int clicked = -1; // Returns clicked button from buttons list, 0 refers to closed window button
3107
3108 int buttonCount = 0;
3109 const char **buttonsText = GuiTextSplit(buttons, &buttonCount, NULL);
3110 Rectangle buttonBounds = { 0 };
3111 buttonBounds.x = bounds.x + MESSAGEBOX_BUTTON_PADDING;
3112 buttonBounds.y = bounds.y + bounds.height - MESSAGEBOX_BUTTON_HEIGHT - MESSAGEBOX_BUTTON_PADDING;
3113 buttonBounds.width = (bounds.width - MESSAGEBOX_BUTTON_PADDING*(buttonCount + 1))/buttonCount;
3114 buttonBounds.height = MESSAGEBOX_BUTTON_HEIGHT;
3115
3116 Vector2 textSize = MeasureTextEx(guiFont, message, (float)GuiGetStyle(DEFAULT, TEXT_SIZE), 1);
3117
3118 Rectangle textBounds = { 0 };
3119 textBounds.x = bounds.x + bounds.width/2 - textSize.x/2;
3120 textBounds.y = bounds.y + WINDOW_STATUSBAR_HEIGHT + (bounds.height - WINDOW_STATUSBAR_HEIGHT - MESSAGEBOX_BUTTON_HEIGHT - MESSAGEBOX_BUTTON_PADDING)/2 - textSize.y/2;
3121 textBounds.width = textSize.x;
3122 textBounds.height = textSize.y;
3123
3124 // Draw control
3125 //--------------------------------------------------------------------
3126 if (GuiWindowBox(bounds, title)) clicked = 0;
3127
3128 int prevTextAlignment = GuiGetStyle(LABEL, TEXT_ALIGNMENT);
3130 GuiLabel(textBounds, message);
3131 GuiSetStyle(LABEL, TEXT_ALIGNMENT, prevTextAlignment);
3132
3133 prevTextAlignment = GuiGetStyle(BUTTON, TEXT_ALIGNMENT);
3135
3136 for (int i = 0; i < buttonCount; i++)
3137 {
3138 if (GuiButton(buttonBounds, buttonsText[i])) clicked = i + 1;
3139 buttonBounds.x += (buttonBounds.width + MESSAGEBOX_BUTTON_PADDING);
3140 }
3141
3142 GuiSetStyle(BUTTON, TEXT_ALIGNMENT, prevTextAlignment);
3143 //--------------------------------------------------------------------
3144
3145 return clicked;
3146}
3147
3148// Text Input Box control, ask for text
3149int GuiTextInputBox(Rectangle bounds, const char *title, const char *message, const char *buttons, char *text)
3150{
3151 #define TEXTINPUTBOX_BUTTON_HEIGHT 24
3152 #define TEXTINPUTBOX_BUTTON_PADDING 10
3153 #define TEXTINPUTBOX_HEIGHT 30
3154
3155 #define TEXTINPUTBOX_MAX_TEXT_LENGTH 256
3156
3157 // Used to enable text edit mode
3158 // WARNING: No more than one GuiTextInputBox() should be open at the same time
3159 static bool textEditMode = false;
3160
3161 int btnIndex = -1;
3162
3163 int buttonCount = 0;
3164 const char **buttonsText = GuiTextSplit(buttons, &buttonCount, NULL);
3165 Rectangle buttonBounds = { 0 };
3166 buttonBounds.x = bounds.x + TEXTINPUTBOX_BUTTON_PADDING;
3167 buttonBounds.y = bounds.y + bounds.height - TEXTINPUTBOX_BUTTON_HEIGHT - TEXTINPUTBOX_BUTTON_PADDING;
3168 buttonBounds.width = (bounds.width - TEXTINPUTBOX_BUTTON_PADDING*(buttonCount + 1))/buttonCount;
3169 buttonBounds.height = TEXTINPUTBOX_BUTTON_HEIGHT;
3170
3171 int messageInputHeight = (int)bounds.height - WINDOW_STATUSBAR_HEIGHT - GuiGetStyle(STATUSBAR, BORDER_WIDTH) - TEXTINPUTBOX_BUTTON_HEIGHT - 2*TEXTINPUTBOX_BUTTON_PADDING;
3172
3173 Rectangle textBounds = { 0 };
3174 if (message != NULL)
3175 {
3176 Vector2 textSize = MeasureTextEx(guiFont, message, (float)GuiGetStyle(DEFAULT, TEXT_SIZE), 1);
3177
3178 textBounds.x = bounds.x + bounds.width/2 - textSize.x/2;
3179 textBounds.y = bounds.y + WINDOW_STATUSBAR_HEIGHT + messageInputHeight/4 - textSize.y/2;
3180 textBounds.width = textSize.x;
3181 textBounds.height = textSize.y;
3182 }
3183
3184 Rectangle textBoxBounds = { 0 };
3185 textBoxBounds.x = bounds.x + TEXTINPUTBOX_BUTTON_PADDING;
3186 textBoxBounds.y = bounds.y + WINDOW_STATUSBAR_HEIGHT - TEXTINPUTBOX_HEIGHT/2;
3187 if (message == NULL) textBoxBounds.y += messageInputHeight/2;
3188 else textBoxBounds.y += (messageInputHeight/2 + messageInputHeight/4);
3189 textBoxBounds.width = bounds.width - TEXTINPUTBOX_BUTTON_PADDING*2;
3190 textBoxBounds.height = TEXTINPUTBOX_HEIGHT;
3191
3192 // Draw control
3193 //--------------------------------------------------------------------
3194 if (GuiWindowBox(bounds, title)) btnIndex = 0;
3195
3196 // Draw message if available
3197 if (message != NULL)
3198 {
3199 int prevTextAlignment = GuiGetStyle(LABEL, TEXT_ALIGNMENT);
3201 GuiLabel(textBounds, message);
3202 GuiSetStyle(LABEL, TEXT_ALIGNMENT, prevTextAlignment);
3203 }
3204
3205 if (GuiTextBox(textBoxBounds, text, TEXTINPUTBOX_MAX_TEXT_LENGTH, textEditMode)) textEditMode = !textEditMode;
3206
3207 int prevBtnTextAlignment = GuiGetStyle(BUTTON, TEXT_ALIGNMENT);
3209
3210 for (int i = 0; i < buttonCount; i++)
3211 {
3212 if (GuiButton(buttonBounds, buttonsText[i])) btnIndex = i + 1;
3213 buttonBounds.x += (buttonBounds.width + MESSAGEBOX_BUTTON_PADDING);
3214 }
3215
3216 GuiSetStyle(BUTTON, TEXT_ALIGNMENT, prevBtnTextAlignment);
3217 //--------------------------------------------------------------------
3218
3219 return btnIndex;
3220}
3221
3222// Grid control
3223// NOTE: Returns grid mouse-hover selected cell
3224// About drawing lines at subpixel spacing, simple put, not easy solution:
3225// https://stackoverflow.com/questions/4435450/2d-opengl-drawing-lines-that-dont-exactly-fit-pixel-raster
3226Vector2 GuiGrid(Rectangle bounds, float spacing, int subdivs)
3227{
3228 #if !defined(GRID_COLOR_ALPHA)
3229 #define GRID_COLOR_ALPHA 0.15f // Grid lines alpha amount
3230 #endif
3231
3232 GuiControlState state = guiState;
3233 Vector2 mousePoint = GetMousePosition();
3234 Vector2 currentCell = { -1, -1 };
3235
3236 int linesV = ((int)(bounds.width/spacing))*subdivs + 1;
3237 int linesH = ((int)(bounds.height/spacing))*subdivs + 1;
3238
3239 // Update control
3240 //--------------------------------------------------------------------
3241 if ((state != GUI_STATE_DISABLED) && !guiLocked)
3242 {
3243 if (CheckCollisionPointRec(mousePoint, bounds))
3244 {
3245 currentCell.x = (mousePoint.x - bounds.x)/spacing;
3246 currentCell.y = (mousePoint.y - bounds.y)/spacing;
3247 }
3248 }
3249 //--------------------------------------------------------------------
3250
3251 // Draw control
3252 //--------------------------------------------------------------------
3253 switch (state)
3254 {
3255 case GUI_STATE_NORMAL:
3256 {
3257 if (subdivs > 0)
3258 {
3259 // Draw vertical grid lines
3260 for (int i = 0; i < linesV; i++)
3261 {
3262 Rectangle lineV = { bounds.x + spacing*i/subdivs, bounds.y, 1, bounds.height };
3263 GuiDrawRectangle(lineV, 0, BLANK, ((i%subdivs) == 0) ? Fade(GetColor(GuiGetStyle(DEFAULT, LINE_COLOR)), GRID_COLOR_ALPHA*4) : Fade(GetColor(GuiGetStyle(DEFAULT, LINE_COLOR)), GRID_COLOR_ALPHA));
3264 }
3265
3266 // Draw horizontal grid lines
3267 for (int i = 0; i < linesH; i++)
3268 {
3269 Rectangle lineH = { bounds.x, bounds.y + spacing*i/subdivs, bounds.width, 1 };
3270 GuiDrawRectangle(lineH, 0, BLANK, ((i%subdivs) == 0) ? Fade(GetColor(GuiGetStyle(DEFAULT, LINE_COLOR)), GRID_COLOR_ALPHA*4) : Fade(GetColor(GuiGetStyle(DEFAULT, LINE_COLOR)), GRID_COLOR_ALPHA));
3271 }
3272 }
3273 } break;
3274 default: break;
3275 }
3276
3277 return currentCell;
3278}
3279
3280//----------------------------------------------------------------------------------
3281// Styles loading functions
3282//----------------------------------------------------------------------------------
3283
3284// Load raygui style file (.rgs)
3285void GuiLoadStyle(const char *fileName)
3286{
3287 bool tryBinary = false;
3288
3289 // Try reading the files as text file first
3290 FILE *rgsFile = fopen(fileName, "rt");
3291
3292 if (rgsFile != NULL)
3293 {
3294 char buffer[256] = { 0 };
3295 fgets(buffer, 256, rgsFile);
3296
3297 if (buffer[0] == '#')
3298 {
3299 int controlId = 0;
3300 int propertyId = 0;
3301 unsigned int propertyValue = 0;
3302
3303 while (!feof(rgsFile))
3304 {
3305 switch (buffer[0])
3306 {
3307 case 'p':
3308 {
3309 // Style property: p <control_id> <property_id> <property_value> <property_name>
3310
3311 sscanf(buffer, "p %d %d 0x%x", &controlId, &propertyId, &propertyValue);
3312
3313 GuiSetStyle(controlId, propertyId, (int)propertyValue);
3314
3315 } break;
3316 case 'f':
3317 {
3318 // Style font: f <gen_font_size> <charmap_file> <font_file>
3319
3320 int fontSize = 0;
3321 char charmapFileName[256] = { 0 };
3322 char fontFileName[256] = { 0 };
3323 sscanf(buffer, "f %d %s %[^\r\n]s", &fontSize, charmapFileName, fontFileName);
3324
3325 Font font = { 0 };
3326
3327 if (charmapFileName[0] != '0')
3328 {
3329 // Load characters from charmap file,
3330 // expected '\n' separated list of integer values
3331 char *charValues = LoadFileText(charmapFileName);
3332 if (charValues != NULL)
3333 {
3334 int glyphCount = 0;
3335 const char **chars = TextSplit(charValues, '\n', &glyphCount);
3336
3337 int *values = (int *)RAYGUI_MALLOC(glyphCount*sizeof(int));
3338 for (int i = 0; i < glyphCount; i++) values[i] = TextToInteger(chars[i]);
3339
3340 font = LoadFontEx(TextFormat("%s/%s", GetDirectoryPath(fileName), fontFileName), fontSize, values, glyphCount);
3341
3342 RAYGUI_FREE(values);
3343 }
3344 }
3345 else font = LoadFontEx(TextFormat("%s/%s", GetDirectoryPath(fileName), fontFileName), fontSize, NULL, 0);
3346
3347 if ((font.texture.id > 0) && (font.glyphCount > 0)) GuiSetFont(font);
3348
3349 } break;
3350 default: break;
3351 }
3352
3353 fgets(buffer, 256, rgsFile);
3354 }
3355 }
3356 else tryBinary = true;
3357
3358 fclose(rgsFile);
3359 }
3360
3361 if (tryBinary)
3362 {
3363 rgsFile = fopen(fileName, "rb");
3364
3365 if (rgsFile == NULL) return;
3366
3367 char signature[5] = "";
3368 short version = 0;
3369 short reserved = 0;
3370 int propertyCount = 0;
3371
3372 fread(signature, 1, 4, rgsFile);
3373 fread(&version, 1, sizeof(short), rgsFile);
3374 fread(&reserved, 1, sizeof(short), rgsFile);
3375 fread(&propertyCount, 1, sizeof(int), rgsFile);
3376
3377 if ((signature[0] == 'r') &&
3378 (signature[1] == 'G') &&
3379 (signature[2] == 'S') &&
3380 (signature[3] == ' '))
3381 {
3382 short controlId = 0;
3383 short propertyId = 0;
3384 int propertyValue = 0;
3385
3386 for (int i = 0; i < propertyCount; i++)
3387 {
3388 fread(&controlId, 1, sizeof(short), rgsFile);
3389 fread(&propertyId, 1, sizeof(short), rgsFile);
3390 fread(&propertyValue, 1, sizeof(int), rgsFile);
3391
3392 if (controlId == 0) // DEFAULT control
3393 {
3394 // If a DEFAULT property is loaded, it is propagated to all controls
3395 // NOTE: All DEFAULT properties should be defined first in the file
3396 GuiSetStyle(0, (int)propertyId, propertyValue);
3397
3398 if (propertyId < RAYGUI_MAX_PROPS_BASE) for (int i = 1; i < RAYGUI_MAX_CONTROLS; i++) GuiSetStyle(i, (int)propertyId, propertyValue);
3399 }
3400 else GuiSetStyle((int)controlId, (int)propertyId, propertyValue);
3401 }
3402
3403 // Font loading is highly dependant on raylib API to load font data and image
3404#if !defined(RAYGUI_STANDALONE)
3405 // Load custom font if available
3406 int fontDataSize = 0;
3407 fread(&fontDataSize, 1, sizeof(int), rgsFile);
3408
3409 if (fontDataSize > 0)
3410 {
3411 Font font = { 0 };
3412 int fontType = 0; // 0-Normal, 1-SDF
3413 Rectangle whiteRec = { 0 };
3414
3415 fread(&font.baseSize, 1, sizeof(int), rgsFile);
3416 fread(&font.glyphCount, 1, sizeof(int), rgsFile);
3417 fread(&fontType, 1, sizeof(int), rgsFile);
3418
3419 // Load font white rectangle
3420 fread(&whiteRec, 1, sizeof(Rectangle), rgsFile);
3421
3422 // Load font image parameters
3423 int fontImageSize = 0;
3424 fread(&fontImageSize, 1, sizeof(int), rgsFile);
3425
3426 if (fontImageSize > 0)
3427 {
3428 Image imFont = { 0 };
3429 imFont.mipmaps = 1;
3430 fread(&imFont.width, 1, sizeof(int), rgsFile);
3431 fread(&imFont.height, 1, sizeof(int), rgsFile);
3432 fread(&imFont.format, 1, sizeof(int), rgsFile);
3433
3434 imFont.data = (unsigned char *)RAYGUI_MALLOC(fontImageSize);
3435 fread(imFont.data, 1, fontImageSize, rgsFile);
3436
3437 font.texture = LoadTextureFromImage(imFont);
3438
3439 RAYGUI_FREE(imFont.data);
3440 }
3441
3442 // Load font recs data
3443 font.recs = (Rectangle *)RAYGUI_CALLOC(font.glyphCount, sizeof(Rectangle));
3444 for (int i = 0; i < font.glyphCount; i++) fread(&font.recs[i], 1, sizeof(Rectangle), rgsFile);
3445
3446 // Load font chars info data
3447 font.glyphs = (GlyphInfo *)RAYGUI_CALLOC(font.glyphCount, sizeof(GlyphInfo));
3448 for (int i = 0; i < font.glyphCount; i++)
3449 {
3450 fread(&font.glyphs[i].value, 1, sizeof(int), rgsFile);
3451 fread(&font.glyphs[i].offsetX, 1, sizeof(int), rgsFile);
3452 fread(&font.glyphs[i].offsetY, 1, sizeof(int), rgsFile);
3453 fread(&font.glyphs[i].advanceX, 1, sizeof(int), rgsFile);
3454 }
3455
3456 GuiSetFont(font);
3457
3458 // Set font texture source rectangle to be used as white texture to draw shapes
3459 // NOTE: This way, all gui can be draw using a single draw call
3460 if ((whiteRec.width != 0) && (whiteRec.height != 0)) SetShapesTexture(font.texture, whiteRec);
3461 }
3462#endif
3463 }
3464
3465 fclose(rgsFile);
3466 }
3467}
3468
3469// Load style default over global style
3470void GuiLoadStyleDefault(void)
3471{
3472 // We set this variable first to avoid cyclic function calls
3473 // when calling GuiSetStyle() and GuiGetStyle()
3474 guiStyleLoaded = true;
3475
3476 // Initialize default LIGHT style property values
3489 GuiSetStyle(DEFAULT, BORDER_WIDTH, 1); // WARNING: Some controls use other values
3490 GuiSetStyle(DEFAULT, TEXT_PADDING, 0); // WARNING: Some controls use other values
3491 GuiSetStyle(DEFAULT, TEXT_ALIGNMENT, GUI_TEXT_ALIGN_CENTER); // WARNING: Some controls use other values
3492
3493 // Initialize control-specific property values
3494 // NOTE: Those properties are in default list but require specific values by control type
3508
3509 // Initialize extended property values
3510 // NOTE: By default, extended property values are initialized to 0
3511 GuiSetStyle(DEFAULT, TEXT_SIZE, 10); // DEFAULT, shared by all controls
3512 GuiSetStyle(DEFAULT, TEXT_SPACING, 1); // DEFAULT, shared by all controls
3513 GuiSetStyle(DEFAULT, LINE_COLOR, 0x90abb5ff); // DEFAULT specific property
3514 GuiSetStyle(DEFAULT, BACKGROUND_COLOR, 0xf5f5f5ff); // DEFAULT specific property
3546
3547 guiFont = GetFontDefault(); // Initialize default font
3548}
3549
3550// Get text with icon id prepended
3551// NOTE: Useful to add icons by name id (enum) instead of
3552// a number that can change between ricon versions
3553const char *GuiIconText(int iconId, const char *text)
3554{
3555#if defined(RAYGUI_NO_RICONS)
3556 return NULL;
3557#else
3558 static char buffer[1024] = { 0 };
3559 memset(buffer, 0, 1024);
3560
3561 sprintf(buffer, "#%03i#", iconId);
3562
3563 if (text != NULL)
3564 {
3565 for (int i = 5; i < 1024; i++)
3566 {
3567 buffer[i] = text[i - 5];
3568 if (text[i - 5] == '\0') break;
3569 }
3570 }
3571
3572 return buffer;
3573#endif
3574}
3575
3576#if !defined(RAYGUI_NO_RICONS)
3577
3578// Get full icons data pointer
3579unsigned int *GuiGetIcons(void) { return guiIcons; }
3580
3581// Load raygui icons file (.rgi)
3582// NOTE: In case nameIds are required, they can be requested with loadIconsName,
3583// they are returned as a guiIconsName[iconCount][RICON_MAX_NAME_LENGTH],
3584// WARNING: guiIconsName[]][] memory should be manually freed!
3585char **GuiLoadIcons(const char *fileName, bool loadIconsName)
3586{
3587 // Style File Structure (.rgi)
3588 // ------------------------------------------------------
3589 // Offset | Size | Type | Description
3590 // ------------------------------------------------------
3591 // 0 | 4 | char | Signature: "rGI "
3592 // 4 | 2 | short | Version: 100
3593 // 6 | 2 | short | reserved
3594
3595 // 8 | 2 | short | Num icons (N)
3596 // 10 | 2 | short | Icons size (Options: 16, 32, 64) (S)
3597
3598 // Icons name id (32 bytes per name id)
3599 // foreach (icon)
3600 // {
3601 // 12+32*i | 32 | char | Icon NameId
3602 // }
3603
3604 // Icons data: One bit per pixel, stored as unsigned int array (depends on icon size)
3605 // S*S pixels/32bit per unsigned int = K unsigned int per icon
3606 // foreach (icon)
3607 // {
3608 // ... | K | unsigned int | Icon Data
3609 // }
3610
3611 FILE *rgiFile = fopen(fileName, "rb");
3612
3613 char **guiIconsName = NULL;
3614
3615 if (rgiFile != NULL)
3616 {
3617 char signature[5] = "";
3618 short version = 0;
3619 short reserved = 0;
3620 short iconCount = 0;
3621 short iconSize = 0;
3622
3623 fread(signature, 1, 4, rgiFile);
3624 fread(&version, 1, sizeof(short), rgiFile);
3625 fread(&reserved, 1, sizeof(short), rgiFile);
3626 fread(&iconCount, 1, sizeof(short), rgiFile);
3627 fread(&iconSize, 1, sizeof(short), rgiFile);
3628
3629 if ((signature[0] == 'r') &&
3630 (signature[1] == 'G') &&
3631 (signature[2] == 'I') &&
3632 (signature[3] == ' '))
3633 {
3634 if (loadIconsName)
3635 {
3636 guiIconsName = (char **)RAYGUI_MALLOC(iconCount*sizeof(char **));
3637 for (int i = 0; i < iconCount; i++)
3638 {
3639 guiIconsName[i] = (char *)RAYGUI_MALLOC(RICON_MAX_NAME_LENGTH);
3640 fread(guiIconsName[i], RICON_MAX_NAME_LENGTH, 1, rgiFile);
3641 }
3642 }
3643 else fseek(rgiFile, iconCount*RICON_MAX_NAME_LENGTH, SEEK_CUR);
3644
3645 // Read icons data directly over guiIcons data array
3646 fread(guiIcons, iconCount*(iconSize*iconSize/32), sizeof(unsigned int), rgiFile);
3647 }
3648
3649 fclose(rgiFile);
3650 }
3651
3652 return guiIconsName;
3653}
3654
3655// Draw selected icon using rectangles pixel-by-pixel
3656void GuiDrawIcon(int iconId, int posX, int posY, int pixelSize, Color color)
3657{
3658 #define BIT_CHECK(a,b) ((a) & (1<<(b)))
3659
3660 for (int i = 0, y = 0; i < RICON_SIZE*RICON_SIZE/32; i++)
3661 {
3662 for (int k = 0; k < 32; k++)
3663 {
3664 if (BIT_CHECK(guiIcons[iconId*RICON_DATA_ELEMENTS + i], k))
3665 {
3666 #if !defined(RAYGUI_STANDALONE)
3667 DrawRectangle(posX + (k%RICON_SIZE)*pixelSize, posY + y*pixelSize, pixelSize, pixelSize, color);
3668 #endif
3669 }
3670
3671 if ((k == 15) || (k == 31)) y++;
3672 }
3673 }
3674}
3675
3676// Get icon bit data
3677// NOTE: Bit data array grouped as unsigned int (ICON_SIZE*ICON_SIZE/32 elements)
3678unsigned int *GuiGetIconData(int iconId)
3679{
3680 static unsigned int iconData[RICON_DATA_ELEMENTS] = { 0 };
3681 memset(iconData, 0, RICON_DATA_ELEMENTS*sizeof(unsigned int));
3682
3683 if (iconId < RICON_MAX_ICONS) memcpy(iconData, &guiIcons[iconId*RICON_DATA_ELEMENTS], RICON_DATA_ELEMENTS*sizeof(unsigned int));
3684
3685 return iconData;
3686}
3687
3688// Set icon bit data
3689// NOTE: Data must be provided as unsigned int array (ICON_SIZE*ICON_SIZE/32 elements)
3690void GuiSetIconData(int iconId, unsigned int *data)
3691{
3692 if (iconId < RICON_MAX_ICONS) memcpy(&guiIcons[iconId*RICON_DATA_ELEMENTS], data, RICON_DATA_ELEMENTS*sizeof(unsigned int));
3693}
3694
3695// Set icon pixel value
3696void GuiSetIconPixel(int iconId, int x, int y)
3697{
3698 #define BIT_SET(a,b) ((a) |= (1<<(b)))
3699
3700 // This logic works for any RICON_SIZE pixels icons,
3701 // For example, in case of 16x16 pixels, every 2 lines fit in one unsigned int data element
3702 BIT_SET(guiIcons[iconId*RICON_DATA_ELEMENTS + y/(sizeof(unsigned int)*8/RICON_SIZE)], x + (y%(sizeof(unsigned int)*8/RICON_SIZE)*RICON_SIZE));
3703}
3704
3705// Clear icon pixel value
3706void GuiClearIconPixel(int iconId, int x, int y)
3707{
3708 #define BIT_CLEAR(a,b) ((a) &= ~((1)<<(b)))
3709
3710 // This logic works for any RICON_SIZE pixels icons,
3711 // For example, in case of 16x16 pixels, every 2 lines fit in one unsigned int data element
3712 BIT_CLEAR(guiIcons[iconId*RICON_DATA_ELEMENTS + y/(sizeof(unsigned int)*8/RICON_SIZE)], x + (y%(sizeof(unsigned int)*8/RICON_SIZE)*RICON_SIZE));
3713}
3714
3715// Check icon pixel value
3716bool GuiCheckIconPixel(int iconId, int x, int y)
3717{
3718 #define BIT_CHECK(a,b) ((a) & (1<<(b)))
3719
3720 return (BIT_CHECK(guiIcons[iconId*8 + y/2], x + (y%2*16)));
3721}
3722#endif // !RAYGUI_NO_RICONS
3723
3724//----------------------------------------------------------------------------------
3725// Module specific Functions Definition
3726//----------------------------------------------------------------------------------
3727// Gui get text width using default font
3728// NOTE: Icon is not considered here
3729static int GetTextWidth(const char *text)
3730{
3731 Vector2 size = { 0 };
3732
3733 if ((text != NULL) && (text[0] != '\0'))
3734 {
3735 size = MeasureTextEx(guiFont, text, (float)GuiGetStyle(DEFAULT, TEXT_SIZE), (float)GuiGetStyle(DEFAULT, TEXT_SPACING));
3736 }
3737
3738 return (int)size.x;
3739}
3740
3741// Get text bounds considering control bounds
3742static Rectangle GetTextBounds(int control, Rectangle bounds)
3743{
3744 Rectangle textBounds = bounds;
3745
3746 textBounds.x = bounds.x + GuiGetStyle(control, BORDER_WIDTH);
3747 textBounds.y = bounds.y + GuiGetStyle(control, BORDER_WIDTH);
3748 textBounds.width = bounds.width - 2*GuiGetStyle(control, BORDER_WIDTH);
3749 textBounds.height = bounds.height - 2*GuiGetStyle(control, BORDER_WIDTH);
3750
3751 // Consider TEXT_PADDING properly, depends on control type and TEXT_ALIGNMENT
3752 switch (control)
3753 {
3754 case COMBOBOX: bounds.width -= (GuiGetStyle(control, COMBO_BUTTON_WIDTH) + GuiGetStyle(control, COMBO_BUTTON_PADDING)); break;
3755 case VALUEBOX: break; // NOTE: ValueBox text value always centered, text padding applies to label
3756 default:
3757 {
3758 if (GuiGetStyle(control, TEXT_ALIGNMENT) == GUI_TEXT_ALIGN_RIGHT) textBounds.x -= GuiGetStyle(control, TEXT_PADDING);
3759 else textBounds.x += GuiGetStyle(control, TEXT_PADDING);
3760 } break;
3761 }
3762
3763 // TODO: Special cases (no label): COMBOBOX, DROPDOWNBOX, LISTVIEW (scrollbar?)
3764 // More special cases (label on side): CHECKBOX, SLIDER, VALUEBOX, SPINNER
3765
3766 return textBounds;
3767}
3768
3769// Get text icon if provided and move text cursor
3770// NOTE: We support up to 999 values for iconId
3771static const char *GetTextIcon(const char *text, int *iconId)
3772{
3773#if !defined(RAYGUI_NO_RICONS)
3774 *iconId = -1;
3775 if (text[0] == '#') // Maybe we have an icon!
3776 {
3777 char iconValue[4] = { 0 }; // Maximum length for icon value: 3 digits + '\0'
3778
3779 int pos = 1;
3780 while ((pos < 4) && (text[pos] >= '0') && (text[pos] <= '9'))
3781 {
3782 iconValue[pos - 1] = text[pos];
3783 pos++;
3784 }
3785
3786 if (text[pos] == '#')
3787 {
3788 *iconId = TextToInteger(iconValue);
3789
3790 // Move text pointer after icon
3791 // WARNING: If only icon provided, it could point to EOL character: '\0'
3792 if (*iconId >= 0) text += (pos + 1);
3793 }
3794 }
3795#endif
3796
3797 return text;
3798}
3799
3800// Gui draw text using default font
3801static void GuiDrawText(const char *text, Rectangle bounds, int alignment, Color tint)
3802{
3803 #define TEXT_VALIGN_PIXEL_OFFSET(h) ((int)h%2) // Vertical alignment for pixel perfect
3804
3805 if ((text != NULL) && (text[0] != '\0'))
3806 {
3807 int iconId = 0;
3808 text = GetTextIcon(text, &iconId); // Check text for icon and move cursor
3809
3810 // Get text position depending on alignment and iconId
3811 //---------------------------------------------------------------------------------
3812 #define RICON_TEXT_PADDING 4
3813
3814 Vector2 position = { bounds.x, bounds.y };
3815
3816 // NOTE: We get text size after icon has been processed
3817 int textWidth = GetTextWidth(text);
3818 int textHeight = GuiGetStyle(DEFAULT, TEXT_SIZE);
3819
3820 // If text requires an icon, add size to measure
3821 if (iconId >= 0)
3822 {
3823 textWidth += RICON_SIZE;
3824
3825 // WARNING: If only icon provided, text could be pointing to EOF character: '\0'
3826 if ((text != NULL) && (text[0] != '\0')) textWidth += RICON_TEXT_PADDING;
3827 }
3828
3829 // Check guiTextAlign global variables
3830 switch (alignment)
3831 {
3833 {
3834 position.x = bounds.x;
3835 position.y = bounds.y + bounds.height/2 - textHeight/2 + TEXT_VALIGN_PIXEL_OFFSET(bounds.height);
3836 } break;
3838 {
3839 position.x = bounds.x + bounds.width/2 - textWidth/2;
3840 position.y = bounds.y + bounds.height/2 - textHeight/2 + TEXT_VALIGN_PIXEL_OFFSET(bounds.height);
3841 } break;
3843 {
3844 position.x = bounds.x + bounds.width - textWidth;
3845 position.y = bounds.y + bounds.height/2 - textHeight/2 + TEXT_VALIGN_PIXEL_OFFSET(bounds.height);
3846 } break;
3847 default: break;
3848 }
3849
3850 // NOTE: Make sure we get pixel-perfect coordinates,
3851 // In case of decimals we got weird text positioning
3852 position.x = (float)((int)position.x);
3853 position.y = (float)((int)position.y);
3854 //---------------------------------------------------------------------------------
3855
3856 // Draw text (with icon if available)
3857 //---------------------------------------------------------------------------------
3858#if !defined(RAYGUI_NO_RICONS)
3859 if (iconId >= 0)
3860 {
3861 // NOTE: We consider icon height, probably different than text size
3862 GuiDrawIcon(iconId, (int)position.x, (int)(bounds.y + bounds.height/2 - RICON_SIZE/2 + TEXT_VALIGN_PIXEL_OFFSET(bounds.height)), 1, tint);
3863 position.x += (RICON_SIZE + RICON_TEXT_PADDING);
3864 }
3865#endif
3866 DrawTextEx(guiFont, text, position, (float)GuiGetStyle(DEFAULT, TEXT_SIZE), (float)GuiGetStyle(DEFAULT, TEXT_SPACING), tint);
3867 //---------------------------------------------------------------------------------
3868 }
3869}
3870
3871// Gui draw rectangle using default raygui plain style with borders
3872static void GuiDrawRectangle(Rectangle rec, int borderWidth, Color borderColor, Color color)
3873{
3874 if (color.a > 0)
3875 {
3876 // Draw rectangle filled with color
3877 DrawRectangle((int)rec.x, (int)rec.y, (int)rec.width, (int)rec.height, color);
3878 }
3879
3880 if (borderWidth > 0)
3881 {
3882 // Draw rectangle border lines with color
3883 DrawRectangle((int)rec.x, (int)rec.y, (int)rec.width, borderWidth, borderColor);
3884 DrawRectangle((int)rec.x, (int)rec.y + borderWidth, borderWidth, (int)rec.height - 2*borderWidth, borderColor);
3885 DrawRectangle((int)rec.x + (int)rec.width - borderWidth, (int)rec.y + borderWidth, borderWidth, (int)rec.height - 2*borderWidth, borderColor);
3886 DrawRectangle((int)rec.x, (int)rec.y + (int)rec.height - borderWidth, (int)rec.width, borderWidth, borderColor);
3887 }
3888}
3889
3890// Split controls text into multiple strings
3891// Also check for multiple columns (required by GuiToggleGroup())
3892static const char **GuiTextSplit(const char *text, int *count, int *textRow)
3893{
3894 // NOTE: Current implementation returns a copy of the provided string with '\0' (string end delimiter)
3895 // inserted between strings defined by "delimiter" parameter. No memory is dynamically allocated,
3896 // all used memory is static... it has some limitations:
3897 // 1. Maximum number of possible split strings is set by TEXTSPLIT_MAX_TEXT_ELEMENTS
3898 // 2. Maximum size of text to split is TEXTSPLIT_MAX_TEXT_LENGTH
3899 // NOTE: Those definitions could be externally provided if required
3900
3901 #if !defined(TEXTSPLIT_MAX_TEXT_LENGTH)
3902 #define TEXTSPLIT_MAX_TEXT_LENGTH 1024
3903 #endif
3904
3905 #if !defined(TEXTSPLIT_MAX_TEXT_ELEMENTS)
3906 #define TEXTSPLIT_MAX_TEXT_ELEMENTS 128
3907 #endif
3908
3909 static const char *result[TEXTSPLIT_MAX_TEXT_ELEMENTS] = { NULL };
3910 static char buffer[TEXTSPLIT_MAX_TEXT_LENGTH] = { 0 };
3911 memset(buffer, 0, TEXTSPLIT_MAX_TEXT_LENGTH);
3912
3913 result[0] = buffer;
3914 int counter = 1;
3915
3916 if (textRow != NULL) textRow[0] = 0;
3917
3918 // Count how many substrings we have on text and point to every one
3919 for (int i = 0; i < TEXTSPLIT_MAX_TEXT_LENGTH; i++)
3920 {
3921 buffer[i] = text[i];
3922 if (buffer[i] == '\0') break;
3923 else if ((buffer[i] == ';') || (buffer[i] == '\n'))
3924 {
3925 result[counter] = buffer + i + 1;
3926
3927 if (textRow != NULL)
3928 {
3929 if (buffer[i] == '\n') textRow[counter] = textRow[counter - 1] + 1;
3930 else textRow[counter] = textRow[counter - 1];
3931 }
3932
3933 buffer[i] = '\0'; // Set an end of string at this point
3934
3935 counter++;
3936 if (counter == TEXTSPLIT_MAX_TEXT_ELEMENTS) break;
3937 }
3938 }
3939
3940 *count = counter;
3941
3942 return result;
3943}
3944
3945// Convert color data from RGB to HSV
3946// NOTE: Color data should be passed normalized
3947static Vector3 ConvertRGBtoHSV(Vector3 rgb)
3948{
3949 Vector3 hsv = { 0 };
3950 float min = 0.0f;
3951 float max = 0.0f;
3952 float delta = 0.0f;
3953
3954 min = (rgb.x < rgb.y)? rgb.x : rgb.y;
3955 min = (min < rgb.z)? min : rgb.z;
3956
3957 max = (rgb.x > rgb.y)? rgb.x : rgb.y;
3958 max = (max > rgb.z)? max : rgb.z;
3959
3960 hsv.z = max; // Value
3961 delta = max - min;
3962
3963 if (delta < 0.00001f)
3964 {
3965 hsv.y = 0.0f;
3966 hsv.x = 0.0f; // Undefined, maybe NAN?
3967 return hsv;
3968 }
3969
3970 if (max > 0.0f)
3971 {
3972 // NOTE: If max is 0, this divide would cause a crash
3973 hsv.y = (delta/max); // Saturation
3974 }
3975 else
3976 {
3977 // NOTE: If max is 0, then r = g = b = 0, s = 0, h is undefined
3978 hsv.y = 0.0f;
3979 hsv.x = 0.0f; // Undefined, maybe NAN?
3980 return hsv;
3981 }
3982
3983 // NOTE: Comparing float values could not work properly
3984 if (rgb.x >= max) hsv.x = (rgb.y - rgb.z)/delta; // Between yellow & magenta
3985 else
3986 {
3987 if (rgb.y >= max) hsv.x = 2.0f + (rgb.z - rgb.x)/delta; // Between cyan & yellow
3988 else hsv.x = 4.0f + (rgb.x - rgb.y)/delta; // Between magenta & cyan
3989 }
3990
3991 hsv.x *= 60.0f; // Convert to degrees
3992
3993 if (hsv.x < 0.0f) hsv.x += 360.0f;
3994
3995 return hsv;
3996}
3997
3998// Convert color data from HSV to RGB
3999// NOTE: Color data should be passed normalized
4000static Vector3 ConvertHSVtoRGB(Vector3 hsv)
4001{
4002 Vector3 rgb = { 0 };
4003 float hh = 0.0f, p = 0.0f, q = 0.0f, t = 0.0f, ff = 0.0f;
4004 long i = 0;
4005
4006 // NOTE: Comparing float values could not work properly
4007 if (hsv.y <= 0.0f)
4008 {
4009 rgb.x = hsv.z;
4010 rgb.y = hsv.z;
4011 rgb.z = hsv.z;
4012 return rgb;
4013 }
4014
4015 hh = hsv.x;
4016 if (hh >= 360.0f) hh = 0.0f;
4017 hh /= 60.0f;
4018
4019 i = (long)hh;
4020 ff = hh - i;
4021 p = hsv.z*(1.0f - hsv.y);
4022 q = hsv.z*(1.0f - (hsv.y*ff));
4023 t = hsv.z*(1.0f - (hsv.y*(1.0f - ff)));
4024
4025 switch (i)
4026 {
4027 case 0:
4028 {
4029 rgb.x = hsv.z;
4030 rgb.y = t;
4031 rgb.z = p;
4032 } break;
4033 case 1:
4034 {
4035 rgb.x = q;
4036 rgb.y = hsv.z;
4037 rgb.z = p;
4038 } break;
4039 case 2:
4040 {
4041 rgb.x = p;
4042 rgb.y = hsv.z;
4043 rgb.z = t;
4044 } break;
4045 case 3:
4046 {
4047 rgb.x = p;
4048 rgb.y = q;
4049 rgb.z = hsv.z;
4050 } break;
4051 case 4:
4052 {
4053 rgb.x = t;
4054 rgb.y = p;
4055 rgb.z = hsv.z;
4056 } break;
4057 case 5:
4058 default:
4059 {
4060 rgb.x = hsv.z;
4061 rgb.y = p;
4062 rgb.z = q;
4063 } break;
4064 }
4065
4066 return rgb;
4067}
4068
4069#if defined(RAYGUI_STANDALONE)
4070// Returns a Color struct from hexadecimal value
4071static Color GetColor(int hexValue)
4072{
4073 Color color;
4074
4075 color.r = (unsigned char)(hexValue >> 24) & 0xFF;
4076 color.g = (unsigned char)(hexValue >> 16) & 0xFF;
4077 color.b = (unsigned char)(hexValue >> 8) & 0xFF;
4078 color.a = (unsigned char)hexValue & 0xFF;
4079
4080 return color;
4081}
4082
4083// Returns hexadecimal value for a Color
4084static int ColorToInt(Color color)
4085{
4086 return (((int)color.r << 24) | ((int)color.g << 16) | ((int)color.b << 8) | (int)color.a);
4087}
4088
4089// Check if point is inside rectangle
4090static bool CheckCollisionPointRec(Vector2 point, Rectangle rec)
4091{
4092 bool collision = false;
4093
4094 if ((point.x >= rec.x) && (point.x <= (rec.x + rec.width)) &&
4095 (point.y >= rec.y) && (point.y <= (rec.y + rec.height))) collision = true;
4096
4097 return collision;
4098}
4099
4100// Color fade-in or fade-out, alpha goes from 0.0f to 1.0f
4101static Color Fade(Color color, float alpha)
4102{
4103 if (alpha < 0.0f) alpha = 0.0f;
4104 else if (alpha > 1.0f) alpha = 1.0f;
4105
4106 Color result = { color.r, color.g, color.b, (unsigned char)(255.0f*alpha) };
4107
4108 return result;
4109}
4110
4111// Formatting of text with variables to 'embed'
4112static const char *TextFormat(const char *text, ...)
4113{
4114 #define MAX_FORMATTEXT_LENGTH 64
4115
4116 static char buffer[MAX_FORMATTEXT_LENGTH];
4117
4118 va_list args;
4119 va_start(args, text);
4120 vsprintf(buffer, text, args);
4121 va_end(args);
4122
4123 return buffer;
4124}
4125
4126// Draw rectangle with vertical gradient fill color
4127// NOTE: This function is only used by GuiColorPicker()
4128static void DrawRectangleGradientV(int posX, int posY, int width, int height, Color color1, Color color2)
4129{
4130 Rectangle bounds = { (float)posX, (float)posY, (float)width, (float)height };
4131 DrawRectangleGradientEx(bounds, color1, color2, color2, color1);
4132}
4133
4134#define TEXTSPLIT_MAX_TEXT_BUFFER_LENGTH 1024 // Size of static buffer: TextSplit()
4135#define TEXTSPLIT_MAX_SUBSTRINGS_COUNT 128 // Size of static pointers array: TextSplit()
4136
4137// Split string into multiple strings
4138const char **TextSplit(const char *text, char delimiter, int *count)
4139{
4140 // NOTE: Current implementation returns a copy of the provided string with '\0' (string end delimiter)
4141 // inserted between strings defined by "delimiter" parameter. No memory is dynamically allocated,
4142 // all used memory is static... it has some limitations:
4143 // 1. Maximum number of possible split strings is set by TEXTSPLIT_MAX_SUBSTRINGS_COUNT
4144 // 2. Maximum size of text to split is TEXTSPLIT_MAX_TEXT_BUFFER_LENGTH
4145
4146 static const char *result[TEXTSPLIT_MAX_SUBSTRINGS_COUNT] = { NULL };
4147 static char buffer[TEXTSPLIT_MAX_TEXT_BUFFER_LENGTH] = { 0 };
4148 memset(buffer, 0, TEXTSPLIT_MAX_TEXT_BUFFER_LENGTH);
4149
4150 result[0] = buffer;
4151 int counter = 0;
4152
4153 if (text != NULL)
4154 {
4155 counter = 1;
4156
4157 // Count how many substrings we have on text and point to every one
4158 for (int i = 0; i < TEXTSPLIT_MAX_TEXT_BUFFER_LENGTH; i++)
4159 {
4160 buffer[i] = text[i];
4161 if (buffer[i] == '\0') break;
4162 else if (buffer[i] == delimiter)
4163 {
4164 buffer[i] = '\0'; // Set an end of string at this point
4165 result[counter] = buffer + i + 1;
4166 counter++;
4167
4168 if (counter == TEXTSPLIT_MAX_SUBSTRINGS_COUNT) break;
4169 }
4170 }
4171 }
4172
4173 *count = counter;
4174 return result;
4175}
4176
4177// Get integer value from text
4178// NOTE: This function replaces atoi() [stdlib.h]
4179static int TextToInteger(const char *text)
4180{
4181 int value = 0;
4182 int sign = 1;
4183
4184 if ((text[0] == '+') || (text[0] == '-'))
4185 {
4186 if (text[0] == '-') sign = -1;
4187 text++;
4188 }
4189
4190 for (int i = 0; ((text[i] >= '0') && (text[i] <= '9')); ++i) value = value*10 + (int)(text[i] - '0');
4191
4192 return value*sign;
4193}
4194
4195// Encode codepoint into UTF-8 text (char array size returned as parameter)
4196static const char *CodepointToUTF8(int codepoint, int *byteSize)
4197{
4198 static char utf8[6] = { 0 };
4199 int size = 0;
4200
4201 if (codepoint <= 0x7f)
4202 {
4203 utf8[0] = (char)codepoint;
4204 size = 1;
4205 }
4206 else if (codepoint <= 0x7ff)
4207 {
4208 utf8[0] = (char)(((codepoint >> 6) & 0x1f) | 0xc0);
4209 utf8[1] = (char)((codepoint & 0x3f) | 0x80);
4210 size = 2;
4211 }
4212 else if (codepoint <= 0xffff)
4213 {
4214 utf8[0] = (char)(((codepoint >> 12) & 0x0f) | 0xe0);
4215 utf8[1] = (char)(((codepoint >> 6) & 0x3f) | 0x80);
4216 utf8[2] = (char)((codepoint & 0x3f) | 0x80);
4217 size = 3;
4218 }
4219 else if (codepoint <= 0x10ffff)
4220 {
4221 utf8[0] = (char)(((codepoint >> 18) & 0x07) | 0xf0);
4222 utf8[1] = (char)(((codepoint >> 12) & 0x3f) | 0x80);
4223 utf8[2] = (char)(((codepoint >> 6) & 0x3f) | 0x80);
4224 utf8[3] = (char)((codepoint & 0x3f) | 0x80);
4225 size = 4;
4226 }
4227
4228 *byteSize = size;
4229
4230 return utf8;
4231}
4232
4233// Get next codepoint in a UTF-8 encoded text, scanning until '\0' is found
4234// When a invalid UTF-8 byte is encountered we exit as soon as possible and a '?'(0x3f) codepoint is returned
4235// Total number of bytes processed are returned as a parameter
4236// NOTE: the standard says U+FFFD should be returned in case of errors
4237// but that character is not supported by the default font in raylib
4238static int GetCodepoint(const char *text, int *bytesProcessed)
4239{
4240/*
4241 UTF-8 specs from https://www.ietf.org/rfc/rfc3629.txt
4242
4243 Char. number range | UTF-8 octet sequence
4244 (hexadecimal) | (binary)
4245 --------------------+---------------------------------------------
4246 0000 0000-0000 007F | 0xxxxxxx
4247 0000 0080-0000 07FF | 110xxxxx 10xxxxxx
4248 0000 0800-0000 FFFF | 1110xxxx 10xxxxxx 10xxxxxx
4249 0001 0000-0010 FFFF | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
4250*/
4251 // NOTE: on decode errors we return as soon as possible
4252
4253 int code = 0x3f; // Codepoint (defaults to '?')
4254 int octet = (unsigned char)(text[0]); // The first UTF8 octet
4255 *bytesProcessed = 1;
4256
4257 if (octet <= 0x7f)
4258 {
4259 // Only one octet (ASCII range x00-7F)
4260 code = text[0];
4261 }
4262 else if ((octet & 0xe0) == 0xc0)
4263 {
4264 // Two octets
4265
4266 // [0]xC2-DF [1]UTF8-tail(x80-BF)
4267 unsigned char octet1 = text[1];
4268
4269 if ((octet1 == '\0') || ((octet1 >> 6) != 2)) { *bytesProcessed = 2; return code; } // Unexpected sequence
4270
4271 if ((octet >= 0xc2) && (octet <= 0xdf))
4272 {
4273 code = ((octet & 0x1f) << 6) | (octet1 & 0x3f);
4274 *bytesProcessed = 2;
4275 }
4276 }
4277 else if ((octet & 0xf0) == 0xe0)
4278 {
4279 // Three octets
4280 unsigned char octet1 = text[1];
4281 unsigned char octet2 = '\0';
4282
4283 if ((octet1 == '\0') || ((octet1 >> 6) != 2)) { *bytesProcessed = 2; return code; } // Unexpected sequence
4284
4285 octet2 = text[2];
4286
4287 if ((octet2 == '\0') || ((octet2 >> 6) != 2)) { *bytesProcessed = 3; return code; } // Unexpected sequence
4288
4289 // [0]xE0 [1]xA0-BF [2]UTF8-tail(x80-BF)
4290 // [0]xE1-EC [1]UTF8-tail [2]UTF8-tail(x80-BF)
4291 // [0]xED [1]x80-9F [2]UTF8-tail(x80-BF)
4292 // [0]xEE-EF [1]UTF8-tail [2]UTF8-tail(x80-BF)
4293
4294 if (((octet == 0xe0) && !((octet1 >= 0xa0) && (octet1 <= 0xbf))) ||
4295 ((octet == 0xed) && !((octet1 >= 0x80) && (octet1 <= 0x9f)))) { *bytesProcessed = 2; return code; }
4296
4297 if ((octet >= 0xe0) && (0 <= 0xef))
4298 {
4299 code = ((octet & 0xf) << 12) | ((octet1 & 0x3f) << 6) | (octet2 & 0x3f);
4300 *bytesProcessed = 3;
4301 }
4302 }
4303 else if ((octet & 0xf8) == 0xf0)
4304 {
4305 // Four octets
4306 if (octet > 0xf4) return code;
4307
4308 unsigned char octet1 = text[1];
4309 unsigned char octet2 = '\0';
4310 unsigned char octet3 = '\0';
4311
4312 if ((octet1 == '\0') || ((octet1 >> 6) != 2)) { *bytesProcessed = 2; return code; } // Unexpected sequence
4313
4314 octet2 = text[2];
4315
4316 if ((octet2 == '\0') || ((octet2 >> 6) != 2)) { *bytesProcessed = 3; return code; } // Unexpected sequence
4317
4318 octet3 = text[3];
4319
4320 if ((octet3 == '\0') || ((octet3 >> 6) != 2)) { *bytesProcessed = 4; return code; } // Unexpected sequence
4321
4322 // [0]xF0 [1]x90-BF [2]UTF8-tail [3]UTF8-tail
4323 // [0]xF1-F3 [1]UTF8-tail [2]UTF8-tail [3]UTF8-tail
4324 // [0]xF4 [1]x80-8F [2]UTF8-tail [3]UTF8-tail
4325
4326 if (((octet == 0xf0) && !((octet1 >= 0x90) && (octet1 <= 0xbf))) ||
4327 ((octet == 0xf4) && !((octet1 >= 0x80) && (octet1 <= 0x8f)))) { *bytesProcessed = 2; return code; } // Unexpected sequence
4328
4329 if (octet >= 0xf0)
4330 {
4331 code = ((octet & 0x7) << 18) | ((octet1 & 0x3f) << 12) | ((octet2 & 0x3f) << 6) | (octet3 & 0x3f);
4332 *bytesProcessed = 4;
4333 }
4334 }
4335
4336 if (code > 0x10ffff) code = 0x3f; // Codepoints after U+10ffff are invalid
4337
4338 return code;
4339}
4340#endif // RAYGUI_STANDALONE
4341
4342#endif // RAYGUI_IMPLEMENTATION
void * id
#define NULL
Definition: miniaudio.h:3718
bool
Definition: raudio.h:76
RAYGUIAPI unsigned int * GuiGetIcons(void)
RAYGUIAPI void GuiPanel(Rectangle bounds)
GuiTextAlignment
Definition: raygui.h:311
@ GUI_TEXT_ALIGN_CENTER
Definition: raygui.h:313
@ GUI_TEXT_ALIGN_RIGHT
Definition: raygui.h:314
@ GUI_TEXT_ALIGN_LEFT
Definition: raygui.h:312
RAYGUIAPI bool GuiDropdownBox(Rectangle bounds, const char *text, int *active, bool editMode)
RAYGUIAPI Rectangle GuiScrollPanel(Rectangle bounds, Rectangle content, Vector2 *scroll)
GuiDefaultProperty
Definition: raygui.h:363
@ BACKGROUND_COLOR
Definition: raygui.h:367
@ LINE_COLOR
Definition: raygui.h:366
@ TEXT_SPACING
Definition: raygui.h:365
@ TEXT_SIZE
Definition: raygui.h:364
RAYGUIAPI void GuiLine(Rectangle bounds, const char *text)
RAYGUIAPI Vector2 GuiGrid(Rectangle bounds, float spacing, int subdivs)
GuiScrollBarProperty
Definition: raygui.h:424
@ ARROWS_SIZE
Definition: raygui.h:425
@ SCROLL_SPEED
Definition: raygui.h:430
@ SCROLL_PADDING
Definition: raygui.h:429
@ SCROLL_SLIDER_PADDING
Definition: raygui.h:427
@ ARROWS_VISIBLE
Definition: raygui.h:426
@ SCROLL_SLIDER_SIZE
Definition: raygui.h:428
RAYGUIAPI void GuiDisable(void)
RAYGUIAPI int GuiListView(Rectangle bounds, const char *text, int *scrollIndex, int active)
GuiProgressBarProperty
Definition: raygui.h:388
@ PROGRESS_PADDING
Definition: raygui.h:389
RAYGUIAPI int GuiScrollBar(Rectangle bounds, int value, int minValue, int maxValue)
RAYGUIAPI float GuiProgressBar(Rectangle bounds, const char *textLeft, const char *textRight, float value, float minValue, float maxValue)
GuiColorPickerProperty
Definition: raygui.h:448
@ HUEBAR_SELECTOR_OVERFLOW
Definition: raygui.h:453
@ HUEBAR_WIDTH
Definition: raygui.h:450
@ HUEBAR_PADDING
Definition: raygui.h:451
@ HUEBAR_SELECTOR_HEIGHT
Definition: raygui.h:452
@ COLOR_SELECTOR_SIZE
Definition: raygui.h:449
RAYGUIAPI float GuiSlider(Rectangle bounds, const char *textLeft, const char *textRight, float value, float minValue, float maxValue)
RAYGUIAPI unsigned int * GuiGetIconData(int iconId)
GuiSliderProperty
Definition: raygui.h:382
@ SLIDER_PADDING
Definition: raygui.h:384
@ SLIDER_WIDTH
Definition: raygui.h:383
RAYGUIAPI int GuiMessageBox(Rectangle bounds, const char *title, const char *message, const char *buttons)
RAYGUIAPI void GuiUnlock(void)
RAYGUIAPI Color GuiColorPicker(Rectangle bounds, Color color)
#define RAYGUI_MALLOC(sz)
Definition: raygui.h:212
RAYGUIAPI bool GuiCheckIconPixel(int iconId, int x, int y)
RAYGUIAPI bool GuiWindowBox(Rectangle bounds, const char *title)
GuiComboBoxProperty
Definition: raygui.h:398
@ COMBO_BUTTON_WIDTH
Definition: raygui.h:399
@ COMBO_BUTTON_PADDING
Definition: raygui.h:400
RAYGUIAPI void GuiLoadStyleDefault(void)
RAYGUIAPI void GuiDummyRec(Rectangle bounds, const char *text)
RAYGUIAPI void GuiStatusBar(Rectangle bounds, const char *text)
RAYGUIAPI bool GuiSpinner(Rectangle bounds, const char *text, int *value, int minValue, int maxValue, bool editMode)
RAYGUIAPI bool GuiTextBox(Rectangle bounds, char *text, int textSize, bool editMode)
RAYGUIAPI int GuiToggleGroup(Rectangle bounds, const char *text, int active)
GuiCheckBoxProperty
Definition: raygui.h:393
@ CHECK_PADDING
Definition: raygui.h:394
RAYGUIAPI void GuiSetIconPixel(int iconId, int x, int y)
GuiToggleProperty
Definition: raygui.h:377
@ GROUP_PADDING
Definition: raygui.h:378
#define RAYGUI_FREE(p)
Definition: raygui.h:218
RAYGUIAPI bool GuiTextBoxMulti(Rectangle bounds, char *text, int textSize, bool editMode)
RAYGUIAPI bool GuiLabelButton(Rectangle bounds, const char *text)
GuiTextBoxProperty
Definition: raygui.h:410
@ COLOR_SELECTED_BG
Definition: raygui.h:414
@ TEXT_LINES_PADDING
Definition: raygui.h:412
@ TEXT_INNER_PADDING
Definition: raygui.h:411
@ COLOR_SELECTED_FG
Definition: raygui.h:413
#define RAYGUI_CALLOC(n, sz)
Definition: raygui.h:215
RAYGUIAPI bool GuiButton(Rectangle bounds, const char *text)
GuiControlProperty
Definition: raygui.h:339
@ BORDER_COLOR_FOCUSED
Definition: raygui.h:343
@ BORDER_COLOR_DISABLED
Definition: raygui.h:349
@ BASE_COLOR_DISABLED
Definition: raygui.h:350
@ TEXT_ALIGNMENT
Definition: raygui.h:354
@ TEXT_COLOR_PRESSED
Definition: raygui.h:348
@ BASE_COLOR_PRESSED
Definition: raygui.h:347
@ BASE_COLOR_FOCUSED
Definition: raygui.h:344
@ TEXT_COLOR_NORMAL
Definition: raygui.h:342
@ TEXT_COLOR_FOCUSED
Definition: raygui.h:345
@ BORDER_COLOR_PRESSED
Definition: raygui.h:346
@ TEXT_COLOR_DISABLED
Definition: raygui.h:351
@ TEXT_PADDING
Definition: raygui.h:353
@ BASE_COLOR_NORMAL
Definition: raygui.h:341
@ BORDER_WIDTH
Definition: raygui.h:352
@ BORDER_COLOR_NORMAL
Definition: raygui.h:340
@ RESERVED
Definition: raygui.h:355
GuiListViewProperty
Definition: raygui.h:440
@ SCROLLBAR_WIDTH
Definition: raygui.h:443
@ LIST_ITEMS_PADDING
Definition: raygui.h:442
@ SCROLLBAR_SIDE
Definition: raygui.h:444
@ LIST_ITEMS_HEIGHT
Definition: raygui.h:441
RAYGUIAPI Color GuiColorPanel(Rectangle bounds, Color color)
RAYGUIAPI float GuiColorBarHue(Rectangle bounds, float value)
RAYGUIAPI const char * GuiIconText(int iconId, const char *text)
RAYGUIAPI void GuiLock(void)
RAYGUIAPI void GuiLabel(Rectangle bounds, const char *text)
RAYGUIAPI int GuiGetStyle(int control, int property)
RAYGUIAPI void GuiSetFont(Font font)
GuiControl
Definition: raygui.h:318
@ STATUSBAR
Definition: raygui.h:334
@ LABEL
Definition: raygui.h:320
@ DROPDOWNBOX
Definition: raygui.h:327
@ VALUEBOX
Definition: raygui.h:329
@ SLIDER
Definition: raygui.h:323
@ TOGGLE
Definition: raygui.h:322
@ SPINNER
Definition: raygui.h:330
@ LISTVIEW
Definition: raygui.h:331
@ COLORPICKER
Definition: raygui.h:332
@ BUTTON
Definition: raygui.h:321
@ DEFAULT
Definition: raygui.h:319
@ SCROLLBAR
Definition: raygui.h:333
@ TEXTBOX
Definition: raygui.h:328
@ CHECKBOX
Definition: raygui.h:325
@ PROGRESSBAR
Definition: raygui.h:324
@ COMBOBOX
Definition: raygui.h:326
RAYGUIAPI void GuiLoadStyle(const char *fileName)
RAYGUIAPI bool GuiValueBox(Rectangle bounds, const char *text, int *value, int minValue, int maxValue, bool editMode)
RAYGUIAPI void GuiSetStyle(int control, int property, int value)
RAYGUIAPI void GuiFade(float alpha)
RAYGUIAPI void GuiEnable(void)
RAYGUIAPI void GuiDrawIcon(int iconId, int posX, int posY, int pixelSize, Color color)
RAYGUIAPI int GuiComboBox(Rectangle bounds, const char *text, int active)
RAYGUIAPI float GuiColorBarAlpha(Rectangle bounds, float alpha)
RAYGUIAPI bool GuiToggle(Rectangle bounds, const char *text, bool active)
RAYGUIAPI void GuiSetIconData(int iconId, unsigned int *data)
GuiSpinnerProperty
Definition: raygui.h:418
@ SPIN_BUTTON_PADDING
Definition: raygui.h:420
@ SPIN_BUTTON_WIDTH
Definition: raygui.h:419
GuiDropdownBoxProperty
Definition: raygui.h:404
@ ARROW_PADDING
Definition: raygui.h:405
@ DROPDOWN_ITEMS_PADDING
Definition: raygui.h:406
RAYGUIAPI void GuiClearIconPixel(int iconId, int x, int y)
RAYGUIAPI void GuiGroupBox(Rectangle bounds, const char *text)
RAYGUIAPI void GuiSetState(int state)
RAYGUIAPI int GuiListViewEx(Rectangle bounds, const char **text, int count, int *focus, int *scrollIndex, int active)
RAYGUIAPI float GuiSliderBar(Rectangle bounds, const char *textLeft, const char *textRight, float value, float minValue, float maxValue)
GuiControlState
Definition: raygui.h:303
@ GUI_STATE_DISABLED
Definition: raygui.h:307
@ GUI_STATE_NORMAL
Definition: raygui.h:304
@ GUI_STATE_FOCUSED
Definition: raygui.h:305
@ GUI_STATE_PRESSED
Definition: raygui.h:306
RAYGUIAPI bool GuiCheckBox(Rectangle bounds, const char *text, bool checked)
#define RAYGUIAPI
Definition: raygui.h:203
GuiScrollBarSide
Definition: raygui.h:434
@ SCROLLBAR_RIGHT_SIDE
Definition: raygui.h:436
@ SCROLLBAR_LEFT_SIDE
Definition: raygui.h:435
RAYGUIAPI int GuiTextInputBox(Rectangle bounds, const char *title, const char *message, const char *buttons, char *text)
RAYGUIAPI bool GuiIsLocked(void)
RAYGUIAPI int GuiGetState(void)
RAYGUIAPI Font GuiGetFont(void)
RLAPI const char * TextFormat(const char *text,...)
Definition: rtext.c:1278
RLAPI bool IsKeyPressed(int key)
Definition: rcore.c:3495
Texture Texture2D
Definition: raylib.h:254
RLAPI Vector2 MeasureTextEx(Font font, const char *text, float fontSize, float spacing)
Definition: rtext.c:1157
RLAPI Font LoadFontEx(const char *fileName, int fontSize, int *fontChars, int glyphCount)
Definition: rtext.c:345
RLAPI void SetShapesTexture(Texture2D texture, Rectangle source)
Definition: rshapes.c:98
RLAPI Color Fade(Color color, float alpha)
Definition: rtextures.c:3669
RLAPI int GetCharPressed(void)
Definition: rcore.c:3551
RLAPI bool IsMouseButtonReleased(int button)
Definition: rcore.c:3722
#define BLANK
Definition: raylib.h:172
RLAPI int TextToInteger(const char *text)
Definition: rtext.c:1304
RLAPI void DrawTextCodepoint(Font font, int codepoint, Vector2 position, float fontSize, Color tint)
Definition: rtext.c:1083
RLAPI float GetMouseWheelMove(void)
Definition: rcore.c:3811
RLAPI Font GetFontDefault(void)
Definition: rtext.c:289
RLAPI int ColorToInt(Color color)
Definition: rtextures.c:3678
RLAPI void DrawRectangle(int posX, int posY, int width, int height, Color color)
Definition: rshapes.c:664
RLAPI const char * CodepointToUTF8(int codepoint, int *byteSize)
Definition: rtext.c:1645
RLAPI bool IsMouseButtonDown(int button)
Definition: rcore.c:3709
@ KEY_UP
Definition: raylib.h:585
@ KEY_RIGHT_SHIFT
Definition: raylib.h:611
@ KEY_ENTER
Definition: raylib.h:577
@ KEY_LEFT_SHIFT
Definition: raylib.h:607
@ KEY_LEFT
Definition: raylib.h:583
@ KEY_RIGHT
Definition: raylib.h:582
@ KEY_BACKSPACE
Definition: raylib.h:579
@ KEY_DOWN
Definition: raylib.h:584
RLAPI bool IsKeyDown(int key)
Definition: rcore.c:3505
RLAPI void DrawRectangleGradientEx(Rectangle rec, Color col1, Color col2, Color col3, Color col4)
Definition: rshapes.c:782
RLAPI bool CheckCollisionPointRec(Vector2 point, Rectangle rec)
Definition: rshapes.c:1599
RLAPI Vector2 GetMousePosition(void)
Definition: rcore.c:3761
RLAPI void DrawRectangleGradientV(int posX, int posY, int width, int height, Color color1, Color color2)
Definition: rshapes.c:768
RLAPI const char * GetDirectoryPath(const char *filePath)
Definition: rcore.c:2936
RLAPI int GetCodepoint(const char *text, int *bytesProcessed)
Definition: rtext.c:1741
RLAPI bool IsMouseButtonPressed(int button)
Definition: rcore.c:3696
RLAPI int GetGlyphIndex(Font font, int codepoint)
Definition: rtext.c:1212
RLAPI const char ** TextSplit(const char *text, char delimiter, int *count)
Definition: rtext.c:1488
RLAPI void DrawTextEx(Font font, const char *text, Vector2 position, float fontSize, float spacing, Color tint)
Definition: rtext.c:1024
RLAPI Texture2D LoadTextureFromImage(Image image)
Definition: rtextures.c:2891
RLAPI char * LoadFileText(const char *fileName)
Definition: utils.c:318
RLAPI Color GetColor(unsigned int hexValue)
Definition: rtextures.c:3862
#define MOUSE_LEFT_BUTTON
Definition: raylib.h:642
#define BIT_CHECK(a, b)
Definition: raylib.h:220
unsigned char a
Definition: raylib.h:224
unsigned char b
Definition: raylib.h:223
unsigned char r
Definition: raylib.h:221
unsigned char g
Definition: raylib.h:222
Definition: raylib.h:289
Rectangle * recs
Definition: raylib.h:294
Texture2D texture
Definition: raylib.h:293
int glyphCount
Definition: raylib.h:291
int baseSize
Definition: raylib.h:290
GlyphInfo * glyphs
Definition: raylib.h:295
Image image
Definition: raylib.h:285
int offsetY
Definition: raylib.h:283
int offsetX
Definition: raylib.h:282
int value
Definition: raylib.h:281
int advanceX
Definition: raylib.h:284
int propertyValue
Definition: raygui.h:299
unsigned short controlId
Definition: raygui.h:297
unsigned short propertyId
Definition: raygui.h:298
Definition: raylib.h:236
void * data
Definition: raylib.h:237
int format
Definition: raylib.h:241
int height
Definition: raylib.h:239
int width
Definition: raylib.h:238
int mipmaps
Definition: raylib.h:240
float height
Definition: raylib.h:232
float x
Definition: raylib.h:229
float y
Definition: raylib.h:230
float width
Definition: raylib.h:231
unsigned int id
Definition: raylib.h:246
float x
Definition: physac.h:130
float y
Definition: physac.h:131
float x
Definition: raylib.h:195
float y
Definition: raylib.h:196
float z
Definition: raylib.h:197