diff --git a/src/libraries/raylib/raygui.odin b/src/libraries/raylib/raygui.odin index fba81e1..fc63ad6 100644 --- a/src/libraries/raylib/raygui.odin +++ b/src/libraries/raylib/raygui.odin @@ -1,7 +1,355 @@ +/******************************************************************************************* +* +* raygui v5.0 - A simple and easy-to-use immediate-mode gui library +* +* DESCRIPTION: +* raygui is a tools-dev-focused immediate-mode-gui library based on raylib but also +* available as a standalone library, as long as input and drawing functions are provided +* +* FEATURES: +* - Immediate-mode gui, minimal retained data +* - +25 controls provided (basic and advanced) +* - Styling system for colors, font and metrics +* - Icons supported, embedded as a 1-bit icons pack +* - Standalone mode option (custom input/graphics backend) +* - Multiple support tools provided for raygui development +* +* POSSIBLE IMPROVEMENTS: +* - Better standalone mode API for easy plug of custom backends +* - Externalize required inputs, allow user easier customization +* +* LIMITATIONS: +* - No editable multi-line word-wraped text box supported +* - No auto-layout mechanism, up to the user to define controls position and size +* - Standalone mode requires library modification and some user work to plug another backend +* +* NOTES: +* - WARNING: GuiLoadStyle() and GuiLoadStyle{Custom}() functions, allocate memory for +* font atlas recs and glyphs, freeing that memory is (usually) up to the user, +* no unload function is explicitly provided... but note that GuiLoadStyleDefault() unloads +* by default any previously loaded font (texture, recs, glyphs) +* - Global UI alpha (guiAlpha) is applied inside GuiDrawRectangle() and GuiDrawText() functions +* +* CONTROLS PROVIDED: +* # Container/separators Controls +* - WindowBox --> StatusBar, Panel +* - GroupBox --> Line +* - Line +* - Panel --> StatusBar +* - ScrollPanel --> StatusBar +* - TabBar --> Toggle, Button +* +* # Basic Controls +* - Label +* - LabelButton --> Label +* - Button +* - Toggle +* - ToggleGroup --> Toggle +* - ToggleSlider +* - CheckBox +* - ComboBox +* - DropdownBox +* - TextBox +* - ValueBox --> TextBox +* - Spinner --> Button, ValueBox +* - Slider +* - SliderBar --> Slider +* - ProgressBar +* - StatusBar +* - DummyRec +* - Grid +* +* # Advance Controls +* - ListView +* - ColorPicker --> ColorPanel, ColorBarHue +* - MessageBox --> Window, Label, Button +* - TextInputBox --> Window, Label, TextBox, Button +* +* It also provides a set of functions for styling the controls based on its properties (size, color) +* +* +* RAYGUI STYLE (guiStyle): +* raygui uses a global data array for all gui style properties (allocated on data segment by default), +* when a new style is loaded, it is loaded over the global style... but a default gui style could always be +* recovered with GuiLoadStyleDefault() function, that overwrites the current style to the default one +* +* The global style array size is fixed and depends on the number of controls and properties: +* +* static unsigned int guiStyle[RAYGUI_MAX_CONTROLS*(RAYGUI_MAX_PROPS_BASE + RAYGUI_MAX_PROPS_EXTENDED)]; +* +* guiStyle size is by default: 16*(16 + 8) = 384 int = 384*4 bytes = 1536 bytes = 1.5 KB +* +* Note that the first set of BASE properties (by default guiStyle[0..15]) belong to the generic style +* used for all controls, when any of those base values is set, it is automatically populated to all +* controls, so, specific control values overwriting generic style should be set after base values +* +* After the first BASE properties set, the EXTENDED properties set is defined (by default guiStyle[16..23]), +* those properties are actually common to all controls and can not be overwritten individually (like BASE ones) +* Some of those properties are: TEXT_SIZE, TEXT_SPACING, LINE_COLOR, BACKGROUND_COLOR +* +* Custom control properties can be defined using the EXTENDED properties for each independent control. +* +* TOOL: rGuiStyler is a visual tool to customize raygui style: github.com/raysan5/rguistyler +* +* +* RAYGUI ICONS (guiIcons): +* raygui could use a global array containing icons data (allocated on data segment by default), +* a custom icons set could be loaded over this array using GuiLoadIcons(), but loaded icons set +* must be same RAYGUI_ICON_SIZE and no more than RAYGUI_ICON_MAX_ICONS will be loaded +* +* Every icon is codified in binary form, using 1 bit per pixel, so, every 16x16 icon +* requires 8 integers (16*16/32) to be stored in memory. +* +* When the icon is draw, actually one quad per pixel is drawn if the bit for that pixel is set +* +* The global icons array size is fixed and depends on the number of icons and size: +* +* static unsigned int guiIcons[RAYGUI_ICON_MAX_ICONS*RAYGUI_ICON_DATA_ELEMENTS]; +* +* guiIcons size is by default: 256*(16*16/32) = 2048*4 = 8192 bytes = 8 KB +* +* TOOL: rGuiIcons is a visual tool to customize/create raygui icons: github.com/raysan5/rguiicons +* +* RAYGUI LAYOUT: +* raygui currently does not provide an auto-layout mechanism like other libraries, +* layouts must be defined manually on controls drawing, providing the right bounds Rectangle for it +* +* TOOL: rGuiLayout is a visual tool to create raygui layouts: github.com/raysan5/rguilayout +* +* CONFIGURATION: +* #define RAYGUI_IMPLEMENTATION +* Generates the implementation of the library into the included file +* If not defined, the library is in header only mode and can be included in other headers +* or source files without problems. But only ONE file should hold the implementation +* +* #define RAYGUI_STANDALONE +* Avoid raylib.h header inclusion in this file. Data types defined on raylib are defined +* internally in the library and input management and drawing functions must be provided by +* the user (check library implementation for further details) +* +* #define RAYGUI_NO_ICONS +* Avoid including embedded ricons data (256 icons, 16x16 pixels, 1-bit per pixel, 2KB) +* +* #define RAYGUI_CUSTOM_ICONS +* Includes custom ricons.h header defining a set of custom icons, +* this file can be generated using rGuiIcons tool +* +* #define RAYGUI_FONT_ICONS_BAKING +* On gui font loading from style file, append the icons to font atlas image, so, +* icons can be drawn along the text as a texture, instead of using shapes to draw them +* +* #define RAYGUI_DEBUG_RECS_BOUNDS +* Draw control bounds rectangles for debug +* +* #define RAYGUI_DEBUG_TEXT_BOUNDS +* Draw text bounds rectangles for debug +* +* VERSIONS HISTORY: +* 5.0 (20-Jul-2026) ADDED: NEW control: GuiTabBar() +* ADDED: Support up to 512 icons (v500) +* ADDED: Support icons baking into font atlas image +* ADDED: guiControlExclusiveMode and guiControlExclusiveRec for exclusive modes +* ADDED: GuiValueBoxFloat(), with floats support +* ADDED: GuiDropdonwBox() properties: DROPDOWN_ARROW_HIDDEN, DROPDOWN_ROLL_UP +* ADDED: GuiListView() property: LIST_ITEMS_BORDER_WIDTH +* ADDED: GuiLoadIconsFromMemory(), used by GuiLoadIcons() +* ADDED: Macros for inputs customization, raylib decoupling +* ADDED: Control result return values: 1-RESULT_PRESSED, 2-RESULT_CHANGED, >2-Control_custom +* REMOVED: GuiSpinner() from controls list, using BUTTON + VALUEBOX properties +* REMOVED: GuiSliderPro(), functionality was redundant +* REMOVED: TextSplit() raylib function requirement on RAYGUI_STANDALONE +* REDESIGNED: WARNING: GuiLoadStyleFromMemory() to support icons baking into font atlas +* REDESIGNED: GuiToggleGroup() to process rows/cols with no need for GuiTextSplit() +* REDESIGNED: GuiColorPanel(), improved HSV <-> RGBA convertion +* REDESIGNED: WARNING: TEXT_LINE_SPACING does not consider text height, only lines spacing +* REDESIGNED: WARNING: GuiMessageBox(), added parameter for btn return, unify result +* REDESIGNED: WARNING: GuiTextInputBox(), added parameter for btn return, unify result +* REVIEWED: GuiLoadIconsFromMemory(), fixed memory issues +* REVIEWED: Controls using text labels to use LABEL properties +* REVIEWED: Replaced sprintf() by snprintf() for more safety +* REVIEWED: GuiTabBar(), close tab with mouse middle button +* REVIEWED: GuiScrollPanel(), scroll speed proportional to content +* REVIEWED: GuiDropdownBox(), support roll up and hidden arrow +* REVIEWED: GuiTextBox(), cursor position initialization +* REVIEWED: GuiSliderPro(), control value change check +* REVIEWED: GuiGrid(), simplified implementation +* REVIEWED: GuiIconText(), increase buffer size and reviewed padding +* REVIEWED: GuiDrawText(), improved wrap mode drawing +* REVIEWED: GuiScrollBar(), minor tweaks +* REVIEWED: GuiProgressBar(), improved borders computing +* REVIEWED: GuiTextBox(), multiple improvements: autocursor and more +* REVIEWED: Functions descriptions, removed wrong return value reference +* +* 4.0 (12-Sep-2023) ADDED: GuiToggleSlider() +* ADDED: GuiColorPickerHSV() and GuiColorPanelHSV() +* ADDED: Multiple new icons, mostly compiler related +* ADDED: New DEFAULT properties: TEXT_LINE_SPACING, TEXT_ALIGNMENT_VERTICAL, TEXT_WRAP_MODE +* ADDED: New enum values: GuiTextAlignment, GuiTextAlignmentVertical, GuiTextWrapMode +* ADDED: Support loading styles with custom font charset from external file +* REDESIGNED: GuiTextBox(), support mouse cursor positioning +* REDESIGNED: GuiDrawText(), support multiline and word-wrap modes (read only) +* REDESIGNED: GuiProgressBar() to be more visual, progress affects border color +* REDESIGNED: Global alpha consideration moved to GuiDrawRectangle() and GuiDrawText() +* REDESIGNED: GuiScrollPanel(), get parameters by reference and return result value +* REDESIGNED: GuiToggleGroup(), get parameters by reference and return result value +* REDESIGNED: GuiComboBox(), get parameters by reference and return result value +* REDESIGNED: GuiCheckBox(), get parameters by reference and return result value +* REDESIGNED: GuiSlider(), get parameters by reference and return result value +* REDESIGNED: GuiSliderBar(), get parameters by reference and return result value +* REDESIGNED: GuiProgressBar(), get parameters by reference and return result value +* REDESIGNED: GuiListView(), get parameters by reference and return result value +* REDESIGNED: GuiColorPicker(), get parameters by reference and return result value +* REDESIGNED: GuiColorPanel(), get parameters by reference and return result value +* REDESIGNED: GuiColorBarAlpha(), get parameters by reference and return result value +* REDESIGNED: GuiColorBarHue(), get parameters by reference and return result value +* REDESIGNED: GuiGrid(), get parameters by reference and return result value +* REDESIGNED: GuiGrid(), added extra parameter +* REDESIGNED: GuiListViewEx(), change parameters order +* REDESIGNED: All controls return result as int value +* REVIEWED: GuiScrollPanel() to avoid smallish scroll-bars +* REVIEWED: All examples and specially controls_test_suite +* RENAMED: gui_file_dialog module to gui_window_file_dialog +* UPDATED: All styles to include ISO-8859-15 charset (as much as possible) +* +* 3.6 (10-May-2023) ADDED: New icon: SAND_TIMER +* ADDED: GuiLoadStyleFromMemory() (binary only) +* REVIEWED: GuiScrollBar() horizontal movement key +* REVIEWED: GuiTextBox() crash on cursor movement +* REVIEWED: GuiTextBox(), additional inputs support +* REVIEWED: GuiLabelButton(), avoid text cut +* REVIEWED: GuiTextInputBox(), password input +* REVIEWED: Local GetCodepointNext(), aligned with raylib +* REDESIGNED: GuiSlider*()/GuiScrollBar() to support out-of-bounds +* +* 3.5 (20-Apr-2023) ADDED: GuiTabBar(), based on GuiToggle() +* ADDED: Helper functions to split text in separate lines +* ADDED: Multiple new icons, useful for code editing tools +* REMOVED: Unneeded icon editing functions +* REMOVED: GuiTextBoxMulti(), very limited and broken +* REMOVED: MeasureTextEx() dependency, logic directly implemented +* REMOVED: DrawTextEx() dependency, logic directly implemented +* REVIEWED: GuiScrollBar(), improve mouse-click behaviour +* REVIEWED: Library header info, more info, better organized +* REDESIGNED: GuiTextBox() to support cursor movement +* REDESIGNED: GuiDrawText() to divide drawing by lines +* +* 3.2 (22-May-2022) RENAMED: Some enum values, for unification, avoiding prefixes +* REMOVED: GuiScrollBar(), only internal +* REDESIGNED: GuiPanel() to support text parameter +* REDESIGNED: GuiScrollPanel() to support text parameter +* REDESIGNED: GuiColorPicker() to support text parameter +* REDESIGNED: GuiColorPanel() to support text parameter +* REDESIGNED: GuiColorBarAlpha() to support text parameter +* REDESIGNED: GuiColorBarHue() to support text parameter +* REDESIGNED: GuiTextInputBox() to support password +* +* 3.1 (12-Jan-2022) REVIEWED: Default style for consistency (aligned with rGuiLayout v2.5 tool) +* REVIEWED: GuiLoadStyle() to support compressed font atlas image data and unload previous textures +* REVIEWED: External icons usage logic +* REVIEWED: GuiLine() for centered alignment when including text +* RENAMED: Multiple controls properties definitions to prepend RAYGUI_ +* RENAMED: RICON_ references to RAYGUI_ICON_ for library consistency +* Projects updated and multiple tweaks +* +* 3.0 (04-Nov-2021) Integrated ricons data to avoid external file +* REDESIGNED: GuiTextBoxMulti() +* REMOVED: GuiImageButton*() +* Multiple minor tweaks and bugs corrected +* +* 2.9 (17-Mar-2021) REMOVED: Tooltip API +* 2.8 (03-May-2020) Centralized rectangles drawing to GuiDrawRectangle() +* 2.7 (20-Feb-2020) ADDED: Possible tooltips API +* 2.6 (09-Sep-2019) ADDED: GuiTextInputBox() +* REDESIGNED: GuiListView*(), GuiDropdownBox(), GuiSlider*(), GuiProgressBar(), GuiMessageBox() +* REVIEWED: GuiTextBox(), GuiSpinner(), GuiValueBox(), GuiLoadStyle() +* Replaced property INNER_PADDING by TEXT_PADDING, renamed some properties +* ADDED: 8 new custom styles ready to use +* Multiple minor tweaks and bugs corrected +* +* 2.5 (28-May-2019) Implemented extended GuiTextBox(), GuiValueBox(), GuiSpinner() +* 2.3 (29-Apr-2019) ADDED: rIcons auxiliar library and support for it, multiple controls reviewed +* Refactor all controls drawing mechanism to use control state +* 2.2 (05-Feb-2019) ADDED: GuiScrollBar(), GuiScrollPanel(), reviewed GuiListView(), removed Gui*Ex() controls +* 2.1 (26-Dec-2018) REDESIGNED: GuiCheckBox(), GuiComboBox(), GuiDropdownBox(), GuiToggleGroup() > Use combined text string +* REDESIGNED: Style system (breaking change) +* 2.0 (08-Nov-2018) ADDED: Support controls guiLock and custom fonts +* REVIEWED: GuiComboBox(), GuiListView()... +* 1.9 (09-Oct-2018) REVIEWED: GuiGrid(), GuiTextBox(), GuiTextBoxMulti(), GuiValueBox()... +* 1.8 (01-May-2018) Lot of rework and redesign to align with rGuiStyler and rGuiLayout +* 1.5 (21-Jun-2017) Working in an improved styles system +* 1.4 (15-Jun-2017) Rewritten all GUI functions (removed useless ones) +* 1.3 (12-Jun-2017) Complete redesign of style system +* 1.1 (01-Jun-2017) Complete review of the library +* 1.0 (07-Jun-2016) Converted to header-only by Ramon Santamaria +* 0.9 (07-Mar-2016) Reviewed and tested by Albert Martos, Ian Eito, Sergio Martinez and Ramon Santamaria +* 0.8 (27-Aug-2015) Initial release. Implemented by Kevin Gato, Daniel Nicolás and Ramon Santamaria +* +* DEPENDENCIES: +* raylib 6.1-dev - Inputs reading (keyboard/mouse), shapes drawing, font loading and text drawing +* +* STANDALONE MODE: +* By default raygui depends on raylib mostly for the inputs and the drawing functionality but that dependency can be disabled +* with the config flag RAYGUI_STANDALONE. In that case is up to the user to provide another backend to cover library needs +* +* The following functions should be redefined for a custom backend: +* +* - Vector2 GetMousePosition(void); +* - float GetMouseWheelMove(void); +* - bool IsMouseButtonDown(int button); +* - bool IsMouseButtonPressed(int button); +* - bool IsMouseButtonReleased(int button); +* - bool IsKeyDown(int key); +* - bool IsKeyPressed(int key); +* - int GetCharPressed(void); // -- GuiTextBox(), GuiValueBox() +* +* - void DrawRectangle(int x, int y, int width, int height, Color color); // -- GuiDrawRectangle() +* - void DrawRectangleGradientEx(Rectangle rec, Color col1, Color col2, Color col3, Color col4); // -- GuiColorPicker() +* +* - Font GetFontDefault(void); // -- GuiLoadStyleDefault() +* - Font LoadFontEx(const char *fileName, int fontSize, int *codepoints, int codepointCount); // -- GuiLoadStyle() +* - Texture2D LoadTextureFromImage(Image image); // -- GuiLoadStyle(), required to load texture from embedded font atlas image +* - void SetShapesTexture(Texture2D tex, Rectangle rec); // -- GuiLoadStyle(), required to set shapes rec to font white rec (optimization) +* - char *LoadFileText(const char *fileName); // -- GuiLoadStyle(), required to load charset data +* - void UnloadFileText(char *text); // -- GuiLoadStyle(), required to unload charset data +* - const char *GetDirectoryPath(const char *filePath); // -- GuiLoadStyle(), required to find charset/font file from text .rgs +* - int *LoadCodepoints(const char *text, int *count); // -- GuiLoadStyle(), required to load required font codepoints list +* - void UnloadCodepoints(int *codepoints); // -- GuiLoadStyle(), required to unload codepoints list +* - unsigned char *DecompressData(const unsigned char *compData, int compDataSize, int *dataSize); // -- GuiLoadStyle() +* +* CONTRIBUTORS: +* Ramon Santamaria: Supervision, review, redesign, update and maintenance +* Vlad Adrian: Complete rewrite of GuiTextBox() to support extended features (2019) +* Sergio Martinez: Review, testing (2015) and redesign of multiple controls (2018) +* Adria Arranz: Testing and implementation of additional controls (2018) +* Jordi Jorba: Testing and implementation of additional controls (2018) +* Albert Martos: Review and testing of the library (2015) +* Ian Eito: Review and testing of the library (2015) +* Kevin Gato: Initial implementation of basic components (2014) +* Daniel Nicolas: Initial implementation of basic components (2014) +* +* +* LICENSE: zlib/libpng +* +* Copyright (c) 2014-2026 Ramon Santamaria (@raysan5) +* +* This software is provided "as-is", without any express or implied warranty. In no event +* will the authors be held liable for any damages arising from the use of this software. +* +* Permission is granted to anyone to use this software for any purpose, including commercial +* applications, and to alter it and redistribute it freely, subject to the following restrictions: +* +* 1. The origin of this software must not be misrepresented; you must not claim that you +* wrote the original software. If you use this software in a product, an acknowledgment +* in the product documentation would be appreciated but is not required. +* +* 2. Altered source versions must be plainly marked as such, and must not be misrepresented +* as being the original software. +* +* 3. This notice may not be removed or altered from any source distribution. +* +**********************************************************************************************/ package raylib -import "core:c" - RAYGUI_SHARED :: #config(RAYGUI_SHARED, false) RAYGUI_WASM_LIB :: #config(RAYGUI_WASM_LIB, "wasm/libraygui.a") @@ -31,537 +379,553 @@ when ODIN_OS == .Windows { foreign import lib "system:raygui" } -RAYGUI_VERSION :: "4.0" + +RAYGUI_VERSION_MAJOR :: 5 +RAYGUI_VERSION_MINOR :: 0 +RAYGUI_VERSION_PATCH :: 0 +RAYGUI_VERSION :: "5.0" + +// Style property +// NOTE: Used when exporting style as code for convenience +GuiStyleProp :: struct { + controlId: u16, // Control identifier + propertyId: u16, // Property identifier + propertyValue: i32, // Property value +} + +// Gui control result +GuiResult :: enum u32 { + NONE = 0, + PRESSED = 1, + CHANGED = 2, + TAB_CLOSE = 4, // GuiTabBar(), tab close request +} // Gui control state -GuiState :: enum c.int { - STATE_NORMAL = 0, - STATE_FOCUSED, - STATE_PRESSED, - STATE_DISABLED, +GuiState :: enum u32 { + NORMAL = 0, + FOCUSED = 1, + PRESSED = 2, + DISABLED = 3, } // Gui control text alignment -GuiTextAlignment :: enum c.int { - TEXT_ALIGN_LEFT = 0, - TEXT_ALIGN_CENTER, - TEXT_ALIGN_RIGHT, +GuiTextAlignment :: enum u32 { + LEFT = 0, + CENTER = 1, + RIGHT = 2, } -GuiTextAlignmentVertical :: enum c.int { - TEXT_ALIGN_TOP = 0, - TEXT_ALIGN_MIDDLE, - TEXT_ALIGN_BOTTOM, +// Gui control text alignment vertical +// NOTE: Text vertical position inside the text bounds +GuiTextAlignmentVertical :: enum u32 { + TOP = 0, + MIDDLE = 1, + BOTTOM = 2, } -GuiTextWrapMode :: enum c.int { - TEXT_WRAP_NONE = 0, - TEXT_WRAP_CHAR, - TEXT_WRAP_WORD, +// Gui control text wrap mode +// NOTE: Useful for multiline text +GuiTextWrapMode :: enum u32 { + NONE = 0, + CHAR = 1, + WORD = 2, } // Gui controls -GuiControl :: enum c.int { +// NOTE: Up to 16 controls supported or 32 controls (v500) +GuiControl :: enum u32 { // Default -> populates to all controls when set - DEFAULT = 0, + DEFAULT = 0, + // Basic controls - LABEL, // Used also for: LABELBUTTON - BUTTON, - TOGGLE, // Used also for: TOGGLEGROUP - SLIDER, // Used also for: SLIDERBAR - PROGRESSBAR, - CHECKBOX, - COMBOBOX, - DROPDOWNBOX, - TEXTBOX, // Used also for: TEXTBOXMULTI - VALUEBOX, - SPINNER, // Uses: BUTTON, VALUEBOX - LISTVIEW, - COLORPICKER, - SCROLLBAR, - STATUSBAR, + LABEL = 1, // Used also for: LABELBUTTON + BUTTON = 2, + TOGGLE = 3, // Used also for: TOGGLEGROUP + SLIDER = 4, // Used also for: SLIDERBAR, TOGGLESLIDER + PROGRESSBAR = 5, + CHECKBOX = 6, + COMBOBOX = 7, + DROPDOWNBOX = 8, + TEXTBOX = 9, // Used also for: TEXTBOXMULTI + VALUEBOX = 10, + TABBAR = 11, + LISTVIEW = 12, + COLORPICKER = 13, + SCROLLBAR = 14, + STATUSBAR = 15, } -// Gui base properties for every control -// NOTE: RAYGUI_MAX_PROPS_BASE properties (by default 16 properties) -GuiControlProperty :: enum c.int { - BORDER_COLOR_NORMAL = 0, - BASE_COLOR_NORMAL, - TEXT_COLOR_NORMAL, - BORDER_COLOR_FOCUSED, - BASE_COLOR_FOCUSED, - TEXT_COLOR_FOCUSED, - BORDER_COLOR_PRESSED, - BASE_COLOR_PRESSED, - TEXT_COLOR_PRESSED, - BORDER_COLOR_DISABLED, - BASE_COLOR_DISABLED, - TEXT_COLOR_DISABLED, - BORDER_WIDTH, - TEXT_PADDING, - TEXT_ALIGNMENT, - RESERVED, +// Controls BASE properties for every control (RAYGUI_MAX_PROPS_BASE = 16) +// NOTE: Properties required for all controls, DEFAULT control sets +// default values for them but they can be overriden per control +GuiControlProperty :: enum u32 { + BORDER_COLOR_NORMAL = 0, // Control border color in STATE_NORMAL + BASE_COLOR_NORMAL = 1, // Control base color in STATE_NORMAL + TEXT_COLOR_NORMAL = 2, // Control text color in STATE_NORMAL + BORDER_COLOR_FOCUSED = 3, // Control border color in STATE_FOCUSED + BASE_COLOR_FOCUSED = 4, // Control base color in STATE_FOCUSED + TEXT_COLOR_FOCUSED = 5, // Control text color in STATE_FOCUSED + BORDER_COLOR_PRESSED = 6, // Control border color in STATE_PRESSED + BASE_COLOR_PRESSED = 7, // Control base color in STATE_PRESSED + TEXT_COLOR_PRESSED = 8, // Control text color in STATE_PRESSED + BORDER_COLOR_DISABLED = 9, // Control border color in STATE_DISABLED + BASE_COLOR_DISABLED = 10, // Control base color in STATE_DISABLED + TEXT_COLOR_DISABLED = 11, // Control text color in STATE_DISABLED + BORDER_WIDTH = 12, // Control border size, 0 for no border + TEXT_PADDING = 13, // Control text padding, not considering border + TEXT_ALIGNMENT = 14, // Control text horizontal alignment inside control text bound (after border and padding): 0-Left, 1-Center, 2-Right + BASEPROP16 = 15, // Not used yet... } -// Gui extended properties depend on control -// NOTE: RAYGUI_MAX_PROPS_EXTENDED properties (by default, max 8 properties) +// Controls EXTENDED properties (RAYGUI_MAX_PROPS_EXTENDED = 8) +// WARNING: Only 8 slots vailable for those properties per control, including DEFAULT //---------------------------------------------------------------------------------- - -// DEFAULT extended properties -// NOTE: Those properties are common to all controls or global -GuiDefaultProperty :: enum c.int { - TEXT_SIZE = 16, // Text size (glyphs max height) - TEXT_SPACING, // Text spacing between glyphs - LINE_COLOR, // Line control color - BACKGROUND_COLOR, // Background color - TEXT_LINE_SPACING, // Text spacing between lines - TEXT_ALIGNMENT_VERTICAL, // Text vertical alignment inside text bounds (after border and padding) - TEXT_WRAP_MODE, // Text wrap-mode inside text bounds +// DEFAULT control, extended properties +// NOTE: Those properties are global for all controls, they can not be setup per control +GuiDefaultProperty :: enum u32 { + TEXT_SIZE = 16, // Text size (glyphs max height) + TEXT_SPACING = 17, // Text spacing between glyphs + LINE_COLOR = 18, // Line control color + BACKGROUND_COLOR = 19, // Background color + TEXT_LINE_SPACING = 20, // Text spacing between lines + TEXT_ALIGNMENT_VERTICAL = 21, // Text vertical alignment inside text bounds (after border and padding): 0-Top, 1-Middle, 2-Bottom + TEXT_WRAP_MODE = 22, // Text wrap-mode inside text bounds + EXTPROP08 = 23, // Not used yet... } -// Label -//GuiLabelProperty :: enum c.int { } - -// Button/Spinner -//GuiButtonProperty :: enum c.int { } - // Toggle/ToggleGroup -GuiToggleProperty :: enum c.int { - GROUP_PADDING = 16, // ToggleGroup separation between toggles +GuiToggleProperty :: enum u32 { + PADDING = 16, // ToggleGroup separation between toggles + WIDTH_FULL = 17, // ToggleGroup bounds width considers all items: 0-Width per item, 1-Full width } // Slider/SliderBar -GuiSliderProperty :: enum c.int { - SLIDER_WIDTH = 16, // Slider size of internal bar - SLIDER_PADDING, // Slider/SliderBar internal bar padding +GuiSliderProperty :: enum u32 { + WIDTH = 16, // Slider size of internal bar + PADDING = 17, // Slider/SliderBar internal bar padding } // ProgressBar -GuiProgressBarProperty :: enum c.int { - PROGRESS_PADDING = 16, // ProgressBar internal padding +GuiProgressBarProperty :: enum u32 { + PADDING = 16, // ProgressBar internal padding + SIDE = 17, // ProgressBar increment side: 0-Left->Right, 1-Right->Left } // ScrollBar -GuiScrollBarProperty :: enum c.int { - ARROWS_SIZE = 16, - ARROWS_VISIBLE, - SCROLL_SLIDER_PADDING, // (SLIDERBAR, SLIDER_PADDING) - SCROLL_SLIDER_SIZE, - SCROLL_PADDING, - SCROLL_SPEED, +GuiScrollBarProperty :: enum u32 { + ARROWS_SIZE = 16, // ScrollBar arrows size + ARROWS_VISIBLE = 17, // ScrollBar arrows visible + SCROLL_SLIDER_PADDING = 18, // ScrollBar slider internal padding + SCROLL_SLIDER_SIZE = 19, // ScrollBar slider size + SCROLL_PADDING = 20, // ScrollBar scroll padding from arrows + SCROLL_SPEED = 21, // ScrollBar scrolling speed } // CheckBox -GuiCheckBoxProperty :: enum c.int { - CHECK_PADDING = 16, // CheckBox internal check padding +GuiCheckBoxProperty :: enum u32 { + CHECK_PADDING = 16, // CheckBox internal check padding } // ComboBox -GuiComboBoxProperty :: enum c.int { - COMBO_BUTTON_WIDTH = 16, // ComboBox right button width - COMBO_BUTTON_SPACING, // ComboBox button separation +GuiComboBoxProperty :: enum u32 { + WIDTH = 16, // ComboBox right button width + SPACING = 17, // ComboBox button separation } // DropdownBox -GuiDropdownBoxProperty :: enum c.int { - ARROW_PADDING = 16, // DropdownBox arrow separation from border and items - DROPDOWN_ITEMS_SPACING, // DropdownBox items separation +GuiDropdownBoxProperty :: enum u32 { + ARROW_PADDING = 16, // DropdownBox arrow separation from border and items + DROPDOWN_ITEMS_SPACING = 17, // DropdownBox items separation + DROPDOWN_ARROW_HIDDEN = 18, // DropdownBox arrow hidden + DROPDOWN_ROLL_UP = 19, // DropdownBox roll up flag: 0-Roll down, 1-Roll up } // TextBox/TextBoxMulti/ValueBox/Spinner -GuiTextBoxProperty :: enum c.int { - TEXT_READONLY = 16, // TextBox in read-only mode: 0-text editable, 1-text no-editable +GuiTextBoxProperty :: enum u32 { + TEXT_READONLY = 16, // TextBox in read-only mode: 0-Text editable, 1-Text read-only } -// Spinner -GuiSpinnerProperty :: enum c.int { - SPIN_BUTTON_WIDTH = 16, // Spinner left/right buttons width - SPIN_BUTTON_SPACING, // Spinner buttons separation +// ValueBox/Spinner +GuiValueBoxProperty :: enum u32 { + WIDTH = 16, // Spinner left/right buttons width + SPACING = 17, // Spinner buttons separation +} + +// TabBar +GuiTabBarProperty :: enum u32 { + ITEMS_WIDTH = 16, // TabBar tab items width + CLOSE_BUTTON = 17, // TabBar tab close button: 0-Not shown, 1-Shown + LINE_SIDE = 18, // TabBar tabs side: 0-Bottom, 1-Top } // ListView -GuiListViewProperty :: enum c.int { - LIST_ITEMS_HEIGHT = 16, // ListView items height - LIST_ITEMS_SPACING, // ListView items separation - SCROLLBAR_WIDTH, // ListView scrollbar size (usually width) - SCROLLBAR_SIDE, // ListView scrollbar side (0-left, 1-right) +SCROLLBAR_LEFT_SIDE :: 0 +SCROLLBAR_RIGHT_SIDE :: 1 + +GuiListViewProperty :: enum u32 { + LIST_ITEMS_HEIGHT = 16, // ListView items height + LIST_ITEMS_SPACING = 17, // ListView items separation + SCROLLBAR_WIDTH = 18, // ListView scrollbar size (usually width) + SCROLLBAR_SIDE = 19, // ListView scrollbar side: 0-Left side, 1-Right Side + LIST_ITEMS_BORDER_NORMAL = 20, // ListView items border enabled in normal state + LIST_ITEMS_BORDER_WIDTH = 21, // ListView items border width } // ColorPicker -GuiColorPickerProperty :: enum c.int { - COLOR_SELECTOR_SIZE = 16, - HUEBAR_WIDTH, // ColorPicker right hue bar width - HUEBAR_PADDING, // ColorPicker right hue bar separation from panel - HUEBAR_SELECTOR_HEIGHT, // ColorPicker right hue bar selector height - HUEBAR_SELECTOR_OVERFLOW, // ColorPicker right hue bar selector overflow +GuiColorPickerProperty :: enum u32 { + COLOR_SELECTOR_SIZE = 16, // ColorPicker selector square size + HUEBAR_WIDTH = 17, // ColorPicker right hue bar width + HUEBAR_PADDING = 18, // ColorPicker right hue bar separation from panel + HUEBAR_SELECTOR_HEIGHT = 19, // ColorPicker right hue bar selector height + HUEBAR_SELECTOR_OVERFLOW = 20, // ColorPicker right hue bar selector overflow } -SCROLLBAR_LEFT_SIDE :: 0 -SCROLLBAR_RIGHT_SIDE :: 1 - -//---------------------------------------------------------------------------------- -// Global Variables Definition -//---------------------------------------------------------------------------------- -// ... - -//---------------------------------------------------------------------------------- -// Module Functions Declaration -//---------------------------------------------------------------------------------- - @(default_calling_convention="c") foreign lib { - // WASM does not have foreign variable declarations. - when ODIN_ARCH != .wasm32 && ODIN_ARCH != .wasm64p32 { - @(link_name="raylib_version") version: cstring - } // Global gui state control functions - - GuiEnable :: proc() --- // Enable gui controls (global state) - GuiLock :: proc() --- // Lock gui controls (global state) - GuiDisable :: proc() --- // Disable gui controls (global state) - GuiUnlock :: proc() --- // Unlock gui controls (global state) - GuiIsLocked :: proc() -> bool --- // Check if gui is locked (global state) - GuiSetAlpha :: proc(alpha: f32) --- // Set gui controls alpha (global state), alpha goes from 0.0f to 1.0f - GuiSetState :: proc(state: c.int) --- // Set gui state (global state) - GuiGetState :: proc() -> c.int --- // Get gui state (global state) + GuiEnable :: proc() --- // Enable gui controls (global state) + GuiDisable :: proc() --- // Disable gui controls (global state) + GuiLock :: proc() --- // Lock gui controls (global state) + GuiUnlock :: proc() --- // Unlock gui controls (global state) + GuiIsLocked :: proc() -> bool --- // Check if gui is locked (global state) + GuiSetAlpha :: proc(alpha: f32) --- // Set gui controls alpha (global state), alpha goes from 0.0f to 1.0f + GuiSetState :: proc(state: i32) --- // Set gui state (global state) + GuiGetState :: proc() -> i32 --- // Get gui state (global state) // Font set/get functions - - GuiSetFont :: proc(font: Font) --- // Set gui custom font (global state) - GuiGetFont :: proc() -> Font --- // Get gui custom font (global state) + GuiSetFont :: proc(font: Font) --- // Set gui custom font (global state) + GuiGetFont :: proc() -> Font --- // Get gui custom font (global state) // Style set/get functions - - GuiSetStyle :: proc(control: GuiControl, property: c.int, value: c.int) --- // Set one style property - GuiGetStyle :: proc(control: GuiControl, property: c.int) -> c.int --- // Get one style property + GuiSetStyle :: proc(control: GuiControl, property: i32, value: i32) --- // Set one style property + GuiGetStyle :: proc(control: GuiControl, property: i32) -> i32 --- // Get one style property // Styles loading functions - - GuiLoadStyle :: proc(fileName: cstring) --- // Load style file over global style variable (.rgs) - GuiLoadStyleDefault :: proc() --- // Load style default over global style + GuiLoadStyle :: proc(fileName: cstring) --- // Load style file over global style variable (.rgs) + GuiLoadStyleFromMemory :: proc(fileData: ^u8, dataSize: i32) --- // Load style from memory (binary only) + GuiLoadStyleDefault :: proc() --- // Load style default over global style // Tooltips management functions - - GuiEnableTooltip :: proc() --- // Enable gui tooltips (global state) - GuiDisableTooltip :: proc() --- // Disable gui tooltips (global state) - GuiSetTooltip :: proc(tooltip: cstring) --- // Set tooltip string + GuiEnableTooltip :: proc() --- // Enable gui tooltips (global state) + GuiDisableTooltip :: proc() --- // Disable gui tooltips (global state) + GuiSetTooltip :: proc(tooltip: cstring) --- // Set tooltip string // Icons functionality + GuiIconText :: proc(iconId: i32, text: cstring) -> cstring --- // Get text with icon id prepended (if supported) + GuiSetIconScale :: proc(scale: i32) --- // Set default icon drawing size + GuiGetIcons :: proc() -> ^u32 --- // Get raygui icons data pointer + GuiLoadIcons :: proc(fileName: cstring, loadIconsName: bool) -> ^cstring --- // Load raygui icons file (.rgi) into internal icons data + GuiLoadIconsFromMemory :: proc(fileData: ^u8, dataSize: i32, loadIconsName: bool) -> ^cstring --- // Load raygui icons file (.rgi) from memory into internal icons data + GuiDrawIcon :: proc(iconId: i32, posX: i32, posY: i32, pixelSize: i32, color: Color) --- // Draw icon using pixel size at specified position - GuiIconText :: proc(iconId: GuiIconName, text: cstring) -> cstring --- // Get text with icon id prepended (if supported) - GuiSetIconScale :: proc(scale: c.int) --- // Set default icon drawing size - GuiGetIcons :: proc() -> [^]u32 --- // Get raygui icons data pointer - GuiLoadIcons :: proc(fileName: cstring, loadIconsName: bool) -> [^]cstring --- // Load raygui icons file (.rgi) into internal icons data - GuiDrawIcon :: proc(iconId: GuiIconName, posX, posY: c.int, pixelSize: c.int, color: Color) --- // Draw icon using pixel size at specified position - + // Utility functions + GuiGetTextWidth :: proc(text: cstring) -> i32 --- // Get text width considering gui style and icon size (if required) // Controls //---------------------------------------------------------------------------------------------------------- // Container/separator controls, useful for controls organization - - GuiWindowBox :: proc(bounds: Rectangle, title: cstring) -> c.int --- // Window Box control, shows a window that can be closed - GuiGroupBox :: proc(bounds: Rectangle, text: cstring) -> c.int --- // Group Box control with text name - GuiLine :: proc(bounds: Rectangle, text: cstring) -> c.int --- // Line separator control, could contain text - GuiPanel :: proc(bounds: Rectangle, text: cstring) -> c.int --- // Panel control, useful to group controls - GuiTabBar :: proc(bounds: Rectangle, text: [^]cstring, count: c.int, active: ^c.int) -> c.int --- // Tab Bar control, returns TAB to be closed or -1 - GuiScrollPanel :: proc(bounds: Rectangle, text: cstring, content: Rectangle, scroll: ^Vector2, view: ^Rectangle) -> c.int --- // Scroll Panel control + GuiWindowBox :: proc(bounds: Rectangle, title: cstring) -> i32 --- // Window Box control, shows a window that can be closed + GuiGroupBox :: proc(bounds: Rectangle, text: cstring) -> i32 --- // Group Box control with text name + GuiLine :: proc(bounds: Rectangle, text: cstring) -> i32 --- // Line separator control, could contain text + GuiPanel :: proc(bounds: Rectangle, text: cstring) -> i32 --- // Panel control, useful to group controls + GuiScrollPanel :: proc(bounds: Rectangle, text: cstring, content: Rectangle, scroll: ^Vector2, view: ^Rectangle) -> i32 --- // Scroll Panel control // Basic controls set - - GuiLabel :: proc(bounds: Rectangle, text: cstring) -> c.int --- // Label control, shows text - GuiButton :: proc(bounds: Rectangle, text: cstring) -> bool --- // Button control, returns true when clicked - GuiLabelButton :: proc(bounds: Rectangle, text: cstring) -> bool --- // Label button control, show true when clicked - GuiToggle :: proc(bounds: Rectangle, text: cstring, active: ^bool) -> c.int --- // Toggle Button control, returns true when active - GuiToggleGroup :: proc(bounds: Rectangle, text: cstring, active: ^c.int) -> c.int --- // Toggle Group control, returns active toggle index - GuiToggleSlider :: proc(bounds: Rectangle, text: cstring, active: ^c.int) -> c.int --- - GuiCheckBox :: proc(bounds: Rectangle, text: cstring, checked: ^bool) -> bool --- // Check Box control, returns true when active - GuiComboBox :: proc(bounds: Rectangle, text: cstring, active: ^c.int) -> c.int --- // Combo Box control, returns selected item index - - GuiDropdownBox :: proc(bounds: Rectangle, text: cstring, active: ^c.int, editMode: bool) -> bool --- // Dropdown Box control, returns selected item - GuiSpinner :: proc(bounds: Rectangle, text: cstring, value: ^c.int, minValue, maxValue: c.int, editMode: bool) -> c.int --- // Spinner control, returns selected value - GuiValueBox :: proc(bounds: Rectangle, text: cstring, value: ^c.int, minValue, maxValue: c.int, editMode: bool) -> c.int --- // Value Box control, updates input text with numbers - GuiValueBoxFloat :: proc(bounds: Rectangle, text: cstring, text_value: cstring, value: ^c.float, editMode: bool) -> c.int --- // Value box control for float values - GuiTextBox :: proc(bounds: Rectangle, text: cstring, textSize: c.int, editMode: bool) -> bool --- // Text Box control, updates input text - - GuiSlider :: proc(bounds: Rectangle, textLeft: cstring, textRight: cstring, value: ^f32, minValue: f32, maxValue: f32) -> c.int --- // Slider control, returns selected value - GuiSliderBar :: proc(bounds: Rectangle, textLeft: cstring, textRight: cstring, value: ^f32, minValue: f32, maxValue: f32) -> c.int --- // Slider Bar control, returns selected value - GuiProgressBar :: proc(bounds: Rectangle, textLeft: cstring, textRight: cstring, value: ^f32, minValue: f32, maxValue: f32) -> c.int --- // Progress Bar control, shows current progress value - GuiStatusBar :: proc(bounds: Rectangle, text: cstring) -> c.int --- // Status Bar control, shows info text - GuiDummyRec :: proc(bounds: Rectangle, text: cstring) -> c.int --- // Dummy control for placeholders - GuiGrid :: proc(bounds: Rectangle, text: cstring, spacing: f32, subdivs: c.int, mouseCell: ^Vector2) -> c.int --- // Grid control, returns mouse cell position + GuiLabel :: proc(bounds: Rectangle, text: cstring) -> i32 --- // Label control + GuiButton :: proc(bounds: Rectangle, text: cstring) -> i32 --- // Button control, returns true when clicked + GuiLabelButton :: proc(bounds: Rectangle, text: cstring) -> i32 --- // Label button control, returns true when clicked + GuiToggle :: proc(bounds: Rectangle, text: cstring, active: ^bool) -> i32 --- // Toggle Button control + GuiToggleGroup :: proc(bounds: Rectangle, text: cstring, active: ^i32) -> i32 --- // Toggle Group control + GuiToggleSlider :: proc(bounds: Rectangle, text: cstring, active: ^i32) -> i32 --- // Toggle Slider control + GuiCheckBox :: proc(bounds: Rectangle, text: cstring, checked: ^bool) -> i32 --- // Check Box control, returns true when active + GuiComboBox :: proc(bounds: Rectangle, text: cstring, active: ^i32) -> i32 --- // Combo Box control + GuiDropdownBox :: proc(bounds: Rectangle, text: cstring, active: ^i32, editMode: bool) -> i32 --- // Dropdown Box control + GuiSpinner :: proc(bounds: Rectangle, text: cstring, value: ^i32, minValue: i32, maxValue: i32, editMode: bool) -> i32 --- // Spinner control + GuiValueBox :: proc(bounds: Rectangle, text: cstring, value: ^i32, minValue: i32, maxValue: i32, editMode: bool) -> i32 --- // Value Box control, updates input text with numbers + GuiValueBoxFloat :: proc(bounds: Rectangle, text: cstring, textValue: cstring, value: ^f32, editMode: bool) -> i32 --- // Value box control for float values + GuiTextBox :: proc(bounds: Rectangle, text: cstring, textSize: i32, editMode: bool) -> i32 --- // Text Box control, updates input text + GuiSlider :: proc(bounds: Rectangle, textLeft: cstring, textRight: cstring, value: ^f32, minValue: f32, maxValue: f32) -> i32 --- // Slider control + GuiSliderBar :: proc(bounds: Rectangle, textLeft: cstring, textRight: cstring, value: ^f32, minValue: f32, maxValue: f32) -> i32 --- // Slider Bar control + GuiProgressBar :: proc(bounds: Rectangle, textLeft: cstring, textRight: cstring, value: ^f32, minValue: f32, maxValue: f32) -> i32 --- // Progress Bar control + GuiStatusBar :: proc(bounds: Rectangle, text: cstring) -> i32 --- // Status Bar control, shows info text + GuiDummyRec :: proc(bounds: Rectangle, text: cstring) -> i32 --- // Dummy control for placeholders + GuiGrid :: proc(bounds: Rectangle, text: cstring, spacing: f32, subdivs: i32, mouseCell: ^Vector2) -> i32 --- // Grid control // Advance controls set - GuiListView :: proc(bounds: Rectangle, text: cstring, scrollIndex: ^c.int, active: ^c.int) -> c.int --- // List View control, returns selected list item index - GuiListViewEx :: proc(bounds: Rectangle, text:[^]cstring, count: c.int, scrollIndex: ^c.int, active: ^c.int, focus: ^c.int) -> c.int --- // List View with extended parameters - GuiMessageBox :: proc(bounds: Rectangle, title: cstring, message: cstring, buttons: cstring, active: ^c.int) -> c.int --- // Message Box control, displays a message - GuiTextInputBox :: proc(bounds: Rectangle, title: cstring, message: cstring, buttons: cstring, text: cstring, textMaxSize: c.int, secretViewActive: ^bool) -> c.int --- // Text Input Box control, ask for text, supports secret - GuiColorPicker :: proc(bounds: Rectangle, text: cstring, color: ^Color) -> c.int --- // Color Picker control (multiple color controls) - GuiColorPanel :: proc(bounds: Rectangle, text: cstring, color: ^Color) -> c.int --- // Color Panel control - GuiColorBarAlpha :: proc(bounds: Rectangle, text: cstring, alpha: ^f32) -> c.int --- // Color Bar Alpha control - GuiColorBarHue :: proc(bounds: Rectangle, text: cstring, value: ^f32) -> c.int --- // Color Bar Hue control - GuiColorPickerHSV :: proc(bounds: Rectangle, text: cstring, colorHsv: ^Vector3) -> c.int --- // Color Picker control that avoids conversion to RGB on each call (multiple color controls) - GuiColorPanelHSV :: proc(bounds: Rectangle, text: cstring, colorHsv: ^Vector3) -> c.int --- // Color Panel control that returns HSV color value, used by GuiColorPickerHSV() - //---------------------------------------------------------------------------------------------------------- + GuiListView :: proc(bounds: Rectangle, text: cstring, scrollIndex: ^i32, active: ^i32) -> i32 --- // List View control + GuiListViewEx :: proc(bounds: Rectangle, text: ^cstring, count: i32, scrollIndex: ^i32, active: ^i32, focus: ^i32) -> i32 --- // List View control, using text entries list and returning focus entry + GuiTabBar :: proc(bounds: Rectangle, text: cstring, hscroll: ^i32, active: ^i32) -> i32 --- // Tab Bar control + GuiTabBarEx :: proc(bounds: Rectangle, text: ^cstring, count: i32, hscroll: ^i32, active: ^i32, focus: ^i32) -> i32 --- // Tab Bar control, using text entries list and returning focus entry + GuiMessageBox :: proc(bounds: Rectangle, title: cstring, message: cstring, btnText: cstring, btnActive: ^i32) -> i32 --- // Message Box control, displays a message + GuiTextInputBox :: proc(bounds: Rectangle, title: cstring, message: cstring, text: cstring, textSize: i32, btnText: cstring, btnActive: ^i32, secretViewActive: ^bool) -> i32 --- // Text Input Box control, ask for text, supports secret + GuiColorPicker :: proc(bounds: Rectangle, text: cstring, color: ^Color) -> i32 --- // Color Picker control, includes Color bar controls + GuiColorPanel :: proc(bounds: Rectangle, text: cstring, color: ^Color) -> i32 --- // Color Panel control + GuiColorBarAlpha :: proc(bounds: Rectangle, text: cstring, alpha: ^f32) -> i32 --- // Color Bar Alpha control + GuiColorBarHue :: proc(bounds: Rectangle, text: cstring, value: ^f32) -> i32 --- // Color Bar Hue control + GuiColorPickerHSV :: proc(bounds: Rectangle, text: cstring, colorHsv: ^Vector3) -> i32 --- // Color Picker control, using Hue-Saturation-Value color data, includes Color bar controls + GuiColorPanelHSV :: proc(bounds: Rectangle, text: cstring, colorHsv: ^Vector3) -> i32 --- // Color Panel control, using Hue-Saturation-Value color data } //---------------------------------------------------------------------------------- // Icons enumeration //---------------------------------------------------------------------------------- -GuiIconName :: enum c.int { - ICON_NONE = 0, - ICON_FOLDER_FILE_OPEN = 1, - ICON_FILE_SAVE_CLASSIC = 2, - ICON_FOLDER_OPEN = 3, - ICON_FOLDER_SAVE = 4, - ICON_FILE_OPEN = 5, - ICON_FILE_SAVE = 6, - ICON_FILE_EXPORT = 7, - ICON_FILE_ADD = 8, - ICON_FILE_DELETE = 9, - ICON_FILETYPE_TEXT = 10, - ICON_FILETYPE_AUDIO = 11, - ICON_FILETYPE_IMAGE = 12, - ICON_FILETYPE_PLAY = 13, - ICON_FILETYPE_VIDEO = 14, - ICON_FILETYPE_INFO = 15, - ICON_FILE_COPY = 16, - ICON_FILE_CUT = 17, - ICON_FILE_PASTE = 18, - ICON_CURSOR_HAND = 19, - ICON_CURSOR_POINTER = 20, - ICON_CURSOR_CLASSIC = 21, - ICON_PENCIL = 22, - ICON_PENCIL_BIG = 23, - ICON_BRUSH_CLASSIC = 24, - ICON_BRUSH_PAINTER = 25, - ICON_WATER_DROP = 26, - ICON_COLOR_PICKER = 27, - ICON_RUBBER = 28, - ICON_COLOR_BUCKET = 29, - ICON_TEXT_T = 30, - ICON_TEXT_A = 31, - ICON_SCALE = 32, - ICON_RESIZE = 33, - ICON_FILTER_POINT = 34, - ICON_FILTER_BILINEAR = 35, - ICON_CROP = 36, - ICON_CROP_ALPHA = 37, - ICON_SQUARE_TOGGLE = 38, - ICON_SYMMETRY = 39, - ICON_SYMMETRY_HORIZONTAL = 40, - ICON_SYMMETRY_VERTICAL = 41, - ICON_LENS = 42, - ICON_LENS_BIG = 43, - ICON_EYE_ON = 44, - ICON_EYE_OFF = 45, - ICON_FILTER_TOP = 46, - ICON_FILTER = 47, - ICON_TARGET_POINT = 48, - ICON_TARGET_SMALL = 49, - ICON_TARGET_BIG = 50, - ICON_TARGET_MOVE = 51, - ICON_CURSOR_MOVE = 52, - ICON_CURSOR_SCALE = 53, - ICON_CURSOR_SCALE_RIGHT = 54, - ICON_CURSOR_SCALE_LEFT = 55, - ICON_UNDO = 56, - ICON_REDO = 57, - ICON_REREDO = 58, - ICON_MUTATE = 59, - ICON_ROTATE = 60, - ICON_REPEAT = 61, - ICON_SHUFFLE = 62, - ICON_EMPTYBOX = 63, - ICON_TARGET = 64, - ICON_TARGET_SMALL_FILL = 65, - ICON_TARGET_BIG_FILL = 66, - ICON_TARGET_MOVE_FILL = 67, - ICON_CURSOR_MOVE_FILL = 68, - ICON_CURSOR_SCALE_FILL = 69, - ICON_CURSOR_SCALE_RIGHT_FILL = 70, - ICON_CURSOR_SCALE_LEFT_FILL = 71, - ICON_UNDO_FILL = 72, - ICON_REDO_FILL = 73, - ICON_REREDO_FILL = 74, - ICON_MUTATE_FILL = 75, - ICON_ROTATE_FILL = 76, - ICON_REPEAT_FILL = 77, - ICON_SHUFFLE_FILL = 78, - ICON_EMPTYBOX_SMALL = 79, - ICON_BOX = 80, - ICON_BOX_TOP = 81, - ICON_BOX_TOP_RIGHT = 82, - ICON_BOX_RIGHT = 83, - ICON_BOX_BOTTOM_RIGHT = 84, - ICON_BOX_BOTTOM = 85, - ICON_BOX_BOTTOM_LEFT = 86, - ICON_BOX_LEFT = 87, - ICON_BOX_TOP_LEFT = 88, - ICON_BOX_CENTER = 89, - ICON_BOX_CIRCLE_MASK = 90, - ICON_POT = 91, - ICON_ALPHA_MULTIPLY = 92, - ICON_ALPHA_CLEAR = 93, - ICON_DITHERING = 94, - ICON_MIPMAPS = 95, - ICON_BOX_GRID = 96, - ICON_GRID = 97, - ICON_BOX_CORNERS_SMALL = 98, - ICON_BOX_CORNERS_BIG = 99, - ICON_FOUR_BOXES = 100, - ICON_GRID_FILL = 101, - ICON_BOX_MULTISIZE = 102, - ICON_ZOOM_SMALL = 103, - ICON_ZOOM_MEDIUM = 104, - ICON_ZOOM_BIG = 105, - ICON_ZOOM_ALL = 106, - ICON_ZOOM_CENTER = 107, - ICON_BOX_DOTS_SMALL = 108, - ICON_BOX_DOTS_BIG = 109, - ICON_BOX_CONCENTRIC = 110, - ICON_BOX_GRID_BIG = 111, - ICON_OK_TICK = 112, - ICON_CROSS = 113, - ICON_ARROW_LEFT = 114, - ICON_ARROW_RIGHT = 115, - ICON_ARROW_DOWN = 116, - ICON_ARROW_UP = 117, - ICON_ARROW_LEFT_FILL = 118, - ICON_ARROW_RIGHT_FILL = 119, - ICON_ARROW_DOWN_FILL = 120, - ICON_ARROW_UP_FILL = 121, - ICON_AUDIO = 122, - ICON_FX = 123, - ICON_WAVE = 124, - ICON_WAVE_SINUS = 125, - ICON_WAVE_SQUARE = 126, - ICON_WAVE_TRIANGULAR = 127, - ICON_CROSS_SMALL = 128, - ICON_PLAYER_PREVIOUS = 129, - ICON_PLAYER_PLAY_BACK = 130, - ICON_PLAYER_PLAY = 131, - ICON_PLAYER_PAUSE = 132, - ICON_PLAYER_STOP = 133, - ICON_PLAYER_NEXT = 134, - ICON_PLAYER_RECORD = 135, - ICON_MAGNET = 136, - ICON_LOCK_CLOSE = 137, - ICON_LOCK_OPEN = 138, - ICON_CLOCK = 139, - ICON_TOOLS = 140, - ICON_GEAR = 141, - ICON_GEAR_BIG = 142, - ICON_BIN = 143, - ICON_HAND_POINTER = 144, - ICON_LASER = 145, - ICON_COIN = 146, - ICON_EXPLOSION = 147, - ICON_1UP = 148, - ICON_PLAYER = 149, - ICON_PLAYER_JUMP = 150, - ICON_KEY = 151, - ICON_DEMON = 152, - ICON_TEXT_POPUP = 153, - ICON_GEAR_EX = 154, - ICON_CRACK = 155, - ICON_CRACK_POINTS = 156, - ICON_STAR = 157, - ICON_DOOR = 158, - ICON_EXIT = 159, - ICON_MODE_2D = 160, - ICON_MODE_3D = 161, - ICON_CUBE = 162, - ICON_CUBE_FACE_TOP = 163, - ICON_CUBE_FACE_LEFT = 164, - ICON_CUBE_FACE_FRONT = 165, - ICON_CUBE_FACE_BOTTOM = 166, - ICON_CUBE_FACE_RIGHT = 167, - ICON_CUBE_FACE_BACK = 168, - ICON_CAMERA = 169, - ICON_SPECIAL = 170, - ICON_LINK_NET = 171, - ICON_LINK_BOXES = 172, - ICON_LINK_MULTI = 173, - ICON_LINK = 174, - ICON_LINK_BROKE = 175, - ICON_TEXT_NOTES = 176, - ICON_NOTEBOOK = 177, - ICON_SUITCASE = 178, - ICON_SUITCASE_ZIP = 179, - ICON_MAILBOX = 180, - ICON_MONITOR = 181, - ICON_PRINTER = 182, - ICON_PHOTO_CAMERA = 183, - ICON_PHOTO_CAMERA_FLASH = 184, - ICON_HOUSE = 185, - ICON_HEART = 186, - ICON_CORNER = 187, - ICON_VERTICAL_BARS = 188, - ICON_VERTICAL_BARS_FILL = 189, - ICON_LIFE_BARS = 190, - ICON_INFO = 191, - ICON_CROSSLINE = 192, - ICON_HELP = 193, - ICON_FILETYPE_ALPHA = 194, - ICON_FILETYPE_HOME = 195, - ICON_LAYERS_VISIBLE = 196, - ICON_LAYERS = 197, - ICON_WINDOW = 198, - ICON_HIDPI = 199, - ICON_FILETYPE_BINARY = 200, - ICON_HEX = 201, - ICON_SHIELD = 202, - ICON_FILE_NEW = 203, - ICON_FOLDER_ADD = 204, - ICON_ALARM = 205, - ICON_CPU = 206, - ICON_ROM = 207, - ICON_STEP_OVER = 208, - ICON_STEP_INTO = 209, - ICON_STEP_OUT = 210, - ICON_RESTART = 211, - ICON_BREAKPOINT_ON = 212, - ICON_BREAKPOINT_OFF = 213, - ICON_BURGER_MENU = 214, - ICON_CASE_SENSITIVE = 215, - ICON_REG_EXP = 216, - ICON_FOLDER = 217, - ICON_FILE = 218, - ICON_SAND_TIMER = 219, - ICON_220 = 220, - ICON_221 = 221, - ICON_222 = 222, - ICON_223 = 223, - ICON_224 = 224, - ICON_225 = 225, - ICON_226 = 226, - ICON_227 = 227, - ICON_228 = 228, - ICON_229 = 229, - ICON_230 = 230, - ICON_231 = 231, - ICON_232 = 232, - ICON_233 = 233, - ICON_234 = 234, - ICON_235 = 235, - ICON_236 = 236, - ICON_237 = 237, - ICON_238 = 238, - ICON_239 = 239, - ICON_240 = 240, - ICON_241 = 241, - ICON_242 = 242, - ICON_243 = 243, - ICON_244 = 244, - ICON_245 = 245, - ICON_246 = 246, - ICON_247 = 247, - ICON_248 = 248, - ICON_249 = 249, - ICON_250 = 250, - ICON_251 = 251, - ICON_252 = 252, - ICON_253 = 253, - ICON_254 = 254, - ICON_255 = 255, +GuiIconName :: enum u32 { + NONE = 0, + FOLDER_FILE_OPEN = 1, + FILE_SAVE_CLASSIC = 2, + FOLDER_OPEN = 3, + FOLDER_SAVE = 4, + FILE_OPEN = 5, + FILE_SAVE = 6, + FILE_EXPORT = 7, + FILE_ADD = 8, + FILE_DELETE = 9, + FILETYPE_TEXT = 10, + FILETYPE_AUDIO = 11, + FILETYPE_IMAGE = 12, + FILETYPE_PLAY = 13, + FILETYPE_VIDEO = 14, + FILETYPE_INFO = 15, + FILE_COPY = 16, + FILE_CUT = 17, + FILE_PASTE = 18, + CURSOR_HAND = 19, + CURSOR_POINTER = 20, + CURSOR_CLASSIC = 21, + PENCIL = 22, + PENCIL_BIG = 23, + BRUSH_CLASSIC = 24, + BRUSH_PAINTER = 25, + WATER_DROP = 26, + COLOR_PICKER = 27, + RUBBER = 28, + COLOR_BUCKET = 29, + TEXT_T = 30, + TEXT_A = 31, + SCALE = 32, + RESIZE = 33, + FILTER_POINT = 34, + FILTER_BILINEAR = 35, + CROP = 36, + CROP_ALPHA = 37, + SQUARE_TOGGLE = 38, + SYMMETRY = 39, + SYMMETRY_HORIZONTAL = 40, + SYMMETRY_VERTICAL = 41, + LENS = 42, + LENS_BIG = 43, + EYE_ON = 44, + EYE_OFF = 45, + FILTER_TOP = 46, + FILTER = 47, + TARGET_POINT = 48, + TARGET_SMALL = 49, + TARGET_BIG = 50, + TARGET_MOVE = 51, + CURSOR_MOVE = 52, + CURSOR_SCALE = 53, + CURSOR_SCALE_RIGHT = 54, + CURSOR_SCALE_LEFT = 55, + UNDO = 56, + REDO = 57, + REREDO = 58, + MUTATE = 59, + ROTATE = 60, + REPEAT = 61, + SHUFFLE = 62, + EMPTYBOX = 63, + TARGET = 64, + TARGET_SMALL_FILL = 65, + TARGET_BIG_FILL = 66, + TARGET_MOVE_FILL = 67, + CURSOR_MOVE_FILL = 68, + CURSOR_SCALE_FILL = 69, + CURSOR_SCALE_RIGHT_FILL = 70, + CURSOR_SCALE_LEFT_FILL = 71, + UNDO_FILL = 72, + REDO_FILL = 73, + REREDO_FILL = 74, + MUTATE_FILL = 75, + ROTATE_FILL = 76, + REPEAT_FILL = 77, + SHUFFLE_FILL = 78, + EMPTYBOX_SMALL = 79, + BOX = 80, + BOX_TOP = 81, + BOX_TOP_RIGHT = 82, + BOX_RIGHT = 83, + BOX_BOTTOM_RIGHT = 84, + BOX_BOTTOM = 85, + BOX_BOTTOM_LEFT = 86, + BOX_LEFT = 87, + BOX_TOP_LEFT = 88, + BOX_CENTER = 89, + BOX_CIRCLE_MASK = 90, + POT = 91, + ALPHA_MULTIPLY = 92, + ALPHA_CLEAR = 93, + DITHERING = 94, + MIPMAPS = 95, + BOX_GRID = 96, + GRID = 97, + BOX_CORNERS_SMALL = 98, + BOX_CORNERS_BIG = 99, + FOUR_BOXES = 100, + GRID_FILL = 101, + BOX_MULTISIZE = 102, + ZOOM_SMALL = 103, + ZOOM_MEDIUM = 104, + ZOOM_BIG = 105, + ZOOM_ALL = 106, + ZOOM_CENTER = 107, + BOX_DOTS_SMALL = 108, + BOX_DOTS_BIG = 109, + BOX_CONCENTRIC = 110, + BOX_GRID_BIG = 111, + OK_TICK = 112, + CROSS = 113, + ARROW_LEFT = 114, + ARROW_RIGHT = 115, + ARROW_DOWN = 116, + ARROW_UP = 117, + ARROW_LEFT_FILL = 118, + ARROW_RIGHT_FILL = 119, + ARROW_DOWN_FILL = 120, + ARROW_UP_FILL = 121, + AUDIO = 122, + FX = 123, + WAVE = 124, + WAVE_SINUS = 125, + WAVE_SQUARE = 126, + WAVE_TRIANGULAR = 127, + CROSS_SMALL = 128, + PLAYER_PREVIOUS = 129, + PLAYER_PLAY_BACK = 130, + PLAYER_PLAY = 131, + PLAYER_PAUSE = 132, + PLAYER_STOP = 133, + PLAYER_NEXT = 134, + PLAYER_RECORD = 135, + MAGNET = 136, + LOCK_CLOSE = 137, + LOCK_OPEN = 138, + CLOCK = 139, + TOOLS = 140, + GEAR = 141, + GEAR_BIG = 142, + BIN = 143, + HAND_POINTER = 144, + LASER = 145, + COIN = 146, + EXPLOSION = 147, + _1UP = 148, + PLAYER = 149, + PLAYER_JUMP = 150, + KEY = 151, + DEMON = 152, + TEXT_POPUP = 153, + GEAR_EX = 154, + CRACK = 155, + CRACK_POINTS = 156, + STAR = 157, + DOOR = 158, + EXIT = 159, + MODE_2D = 160, + MODE_3D = 161, + CUBE = 162, + CUBE_FACE_TOP = 163, + CUBE_FACE_LEFT = 164, + CUBE_FACE_FRONT = 165, + CUBE_FACE_BOTTOM = 166, + CUBE_FACE_RIGHT = 167, + CUBE_FACE_BACK = 168, + CAMERA = 169, + SPECIAL = 170, + LINK_NET = 171, + LINK_BOXES = 172, + LINK_MULTI = 173, + LINK = 174, + LINK_BROKE = 175, + TEXT_NOTES = 176, + NOTEBOOK = 177, + SUITCASE = 178, + SUITCASE_ZIP = 179, + MAILBOX = 180, + MONITOR = 181, + PRINTER = 182, + PHOTO_CAMERA = 183, + PHOTO_CAMERA_FLASH = 184, + HOUSE = 185, + HEART = 186, + CORNER = 187, + VERTICAL_BARS = 188, + VERTICAL_BARS_FILL = 189, + LIFE_BARS = 190, + INFO = 191, + CROSSLINE = 192, + HELP = 193, + FILETYPE_ALPHA = 194, + FILETYPE_HOME = 195, + LAYERS_VISIBLE = 196, + LAYERS = 197, + WINDOW = 198, + HIDPI = 199, + FILETYPE_BINARY = 200, + HEX = 201, + SHIELD = 202, + FILE_NEW = 203, + FOLDER_ADD = 204, + ALARM = 205, + CPU = 206, + ROM = 207, + STEP_OVER = 208, + STEP_INTO = 209, + STEP_OUT = 210, + RESTART = 211, + BREAKPOINT_ON = 212, + BREAKPOINT_OFF = 213, + BURGER_MENU = 214, + CASE_SENSITIVE = 215, + REG_EXP = 216, + FOLDER = 217, + FILE = 218, + SAND_TIMER = 219, + WARNING = 220, + HELP_BOX = 221, + INFO_BOX = 222, + PRIORITY = 223, + LAYERS_ISO = 224, + LAYERS2 = 225, + MLAYERS = 226, + MAPS = 227, + HOT = 228, + LABEL = 229, + NAME_ID = 230, + SLICING = 231, + MANUAL_CONTROL = 232, + COLLISION = 233, + CIRCLE_ADD = 234, + CIRCLE_ADD_FILL = 235, + CIRCLE_WARNING = 236, + CIRCLE_WARNING_FILL = 237, + BOX_MORE = 238, + BOX_MORE_FILL = 239, + BOX_MINUS = 240, + BOX_MINUS_FILL = 241, + UNION = 242, + INTERSECTION = 243, + DIFFERENCE = 244, + SPHERE = 245, + CYLINDER = 246, + CONE = 247, + ELLIPSOID = 248, + CAPSULE = 249, + FILETYPE_FONT = 250, + FILETYPE_3D = 251, + FILETYPE_CODE_XML = 252, + FILETYPE_CODE_C = 253, + FILETYPE_CODE_PYTHON = 254, + FILETYPE_CODE_JS = 255, + FILETYPE_ICON = 256, } diff --git a/src/libraries/raylib/raygui/HISTORY.md b/src/libraries/raylib/raygui/HISTORY.md deleted file mode 100644 index 7d0f717..0000000 --- a/src/libraries/raylib/raygui/HISTORY.md +++ /dev/null @@ -1,17 +0,0 @@ -## raygui history - -raygui development started on December 2014 by two internship students (Kevin and Daniel) guided by me, objective was creating a simple and easy-to-use immediate-mode-gui module for raylib, intended for tools development. On June 2015, library was mostly functional (including basic controls) and we started working in the styling posibilities for the library, focusing on an easy way to style controls properties. Consequently, development of [rGuiStyler](https://raylibtech.itch.io/rguistyler) also started at that point... but resources were quite limited and project was stopped for several months, most of the time was invested in [raylib](https://github.com/raysan5/raylib) development. - -On June 2016, project was picked up again and raygui 1.0 was released by the end of that month. During August 2016, raygui was used to develop [rFXGen](https://github.com/raysan5/rfxgen) and also an early protoype of [rGuiLayout](https://raylibtech.itch.io/rguilayout), those tools were a testbed for the library. By the end of 2016, raygui project development was stopped again for several months. - -On June 2017, a complete redesign of the library started, almost from scratch, all functions were reviewed and mostly rewritten and a brand new styling system was developed. The objective was using raygui professionally in several tools. It was the beginning of raygui 2.0. - -On January 2018, two students (Adria and Jordi) started working on raygui and related tools; library evolved considerably in the following months. [rGuiStyler](https://raylibtech.itch.io/rguistyler) was completely redesigned and rewritten from scratch (rGuiStyler v2.0). [rGuiLayout](https://raylibtech.itch.io/rguilayout) turned from a protoype into a professional software and raygui reached version 2.0 with plenty of new controls and features. - -On July 2018, I started working full time on raygui and its tools, improving the library considerably. On October 2018 [Sergio](https://github.com/anidealgift) joined the project and focused efforts on [rGuiLayout](https://raylibtech.itch.io/rguilayout) tool redesign. We reached 2019 with continuous improvement and redesigns of mostly all raygui functions along rGuiLayout 2.0 and rGuiStyler 3.0. - -On March 2019, the first set of new raygui tools was published: [rFXGen 2.0](https://raylibtech.itch.io/rfxgen), [rTexViewer 1.0](https://raylibtech.itch.io/rtexviewer) and [rIconPacker 1.0](https://raylibtech.itch.io/riconpacker). - -From March 2019 to June 2019 raygui development decelerated, Sergio left the project and efforts were focused on raylib 2.5, during this time one external contributor, [Vlad Adrian](https://github.com/Demizdor), completely redesigned `GuiTextBox()` and related controls and version was bumped to raygui 2.5. - -During summer 2019 lots of raygui functions were reviewed, breaking compatibility to any previous version and pointing to a **raygui 2.6** update. diff --git a/src/libraries/raylib/raygui/bindgen.sh b/src/libraries/raylib/raygui/bindgen.sh new file mode 100755 index 0000000..10aedff --- /dev/null +++ b/src/libraries/raylib/raygui/bindgen.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +# Currently not cross compiling for windows and darwin +set -euo pipefail + +# This is supposed to use Karl Zylinski's odin-c-bindgen +# https://github.com/karl-zylinski/odin-c-bindgen +odin-c-bindgen bindgen.sjson +rm -f ../raygui.odin +cp bindgen_output/raygui.odin ../ +rm -r bindgen_output diff --git a/src/libraries/raylib/raygui/bindgen.sjson b/src/libraries/raylib/raygui/bindgen.sjson new file mode 100644 index 0000000..0b45f08 --- /dev/null +++ b/src/libraries/raylib/raygui/bindgen.sjson @@ -0,0 +1,18 @@ +inputs = [ + "raygui.h" +] + +imports_file = "imports.txt" + +output_folder = "bindgen_output" + +package_name = "raylib" + +clang_include_paths = [ + "../raylib/src" +] + +procedure_type_overrides = { + "GuiSetStyle.control" = "GuiControl" + "GuiGetStyle.control" = "GuiControl" +} diff --git a/src/libraries/raylib/raygui/imports.txt b/src/libraries/raylib/raygui/imports.txt new file mode 100644 index 0000000..d9bd13a --- /dev/null +++ b/src/libraries/raylib/raygui/imports.txt @@ -0,0 +1,28 @@ +RAYGUI_SHARED :: #config(RAYGUI_SHARED, false) +RAYGUI_WASM_LIB :: #config(RAYGUI_WASM_LIB, "wasm/libraygui.a") + +when ODIN_OS == .Windows { + foreign import lib { + "windows/rayguidll.lib" when RAYGUI_SHARED else "windows/raygui.lib", + } +} else when ODIN_OS == .Linux { + foreign import lib { + "linux/libraygui.so" when RAYGUI_SHARED else "linux/libraygui.a", + } +} else when ODIN_OS == .Darwin { + when ODIN_ARCH == .arm64 { + foreign import lib { + "macos/libraygui-arm64.dylib" when RAYGUI_SHARED else "macos/libraygui-arm64.a", + } + } else { + foreign import lib { + "macos/libraygui.dylib" when RAYGUI_SHARED else "macos/libraygui.a", + } + } +} else when ODIN_ARCH == .wasm32 || ODIN_ARCH == .wasm64p32 { + foreign import lib { + RAYGUI_WASM_LIB, + } +} else { + foreign import lib "system:raygui" +} diff --git a/src/libraries/raylib/raygui/raygui.h b/src/libraries/raylib/raygui/raygui.h index 36b6611..3851d48 100644 --- a/src/libraries/raylib/raygui/raygui.h +++ b/src/libraries/raylib/raygui/raygui.h @@ -1585,8 +1585,6 @@ static void UnloadCodepoints(int *codepoints); // -- GuiLoadStyle( static unsigned char *DecompressData(const unsigned char *compData, int compDataSize, int *dataSize); // -- GuiLoadStyle() static Vector2 MeasureTextEx(Font font, const char *text, float fontSize, float spacing); // Measure string size for Font - -static void DrawTextCodepoint(Font font, int codepoint, Vector2 position, float fontSize, Color tint); // Draw one character (codepoint) //------------------------------------------------------------------------------- // raylib functions already implemented in raygui @@ -3348,7 +3346,19 @@ int GuiValueBoxFloat(Rectangle bounds, const char *text, char *textValue, float { if (GuiGetTextWidth(textValue) < bounds.width) { - int key = GUI_INPUT_KEY; + int key = 0; + for (int i = 0; i < 10; i++) { + if (GUI_KEY_PRESSED(KEY_ZERO + i)) { + key = KEY_ZERO + i; + break; + } + } + if (key == 0 && GUI_KEY_PRESSED(KEY_MINUS)) { + key = '-'; + } + if (key == 0 && GUI_KEY_PRESSED(KEY_PERIOD)) { + key = '.'; + } if (((key >= 48) && (key <= 57)) || (key == '.') || ((keyCount == 0) && (key == '+')) || // NOTE: Sign can only be in first position @@ -5807,7 +5817,6 @@ static void GuiTooltip(Rectangle controlRec) { if (!guiLocked && guiTooltip && (guiTooltipPtr != NULL) && !guiControlExclusiveMode) { - // TODO: Remove MeasureTextEx(), implement logic directly or add custom GuiMeasureText() Vector2 textSize = MeasureTextEx(guiFont, guiTooltipPtr, (float)GuiGetStyle(DEFAULT, TEXT_SIZE), (float)GuiGetStyle(DEFAULT, TEXT_SPACING));