diff --git a/.gitmodules b/.gitmodules index 41ef811..3ff8c1d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "libs/raylib/raylib"] path = libs/raylib/raylib url = git@github.com:raysan5/raylib.git +[submodule "libs/raygui/raygui"] + path = libs/raygui/raygui + url = https://github.com/raysan5/raygui diff --git a/libs/raygui/LICENSE b/libs/raygui/LICENSE new file mode 100644 index 0000000..a3d23c1 --- /dev/null +++ b/libs/raygui/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Michael Scherbakow + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/libs/raygui/README.md b/libs/raygui/README.md new file mode 100644 index 0000000..670edb8 --- /dev/null +++ b/libs/raygui/README.md @@ -0,0 +1,81 @@ +![logo](logo.png) + +# raygui.zig +Idiomatic [raygui](https://github.com/raysan5/raygui) **RAYGUIAPI** (raygui.h) bindings for [Zig](https://ziglang.org/) (master). + +## usage + +The easy way would be adding this as submodule directly in your source folder. +Thats what I do until there is an official package manager for Zig. + +```sh +cd $YOUR_SRC_FOLDER +git submodule add https://github.com/ryupold/raygui.zig raygui +git submodule update --init --recursive +``` + +The bindings have been prebuilt so you just need to add raylib as module + +build.zig: +```zig +const raylib = @import("path/to/raylib.zig/build.zig"); +const raygui = @import("path/to/raygui.zig/build.zig"); + +pub fn build(b: *std.Build) !void { + const target = b.standardTargetOptions(.{}); + const mode = b.standardOptimizeOption(.{}); + const exe = ...; + raylib.addTo(b, exe, target, mode); + raygui.addTo(b, exe, target, mode); +} +``` + +and import in main.zig: +```zig +const raylib = @import("raylib"); +const raygui = @import("raygui"); + +pub fn main() void { + raylib.InitWindow(800, 800, "hello world!"); + raylib.SetConfigFlags(.FLAG_WINDOW_RESIZABLE); + raylib.SetTargetFPS(60); + + defer raylib.CloseWindow(); + + while (!raylib.WindowShouldClose()) { + raylib.BeginDrawing(); + defer raylib.EndDrawing(); + + raylib.ClearBackground(raylib.BLACK); + raylib.DrawFPS(10, 10); + + if (raygui.GuiButton(.{ .x = 100, .y = 100, .width = 200, .height = 100 }, "press me!")) { + std.debug.print("pressed\n", .{}); + } + } +} +``` + +> See `build.zig` in [examples-raylib.zig](https://github.com/ryupold/examples-raylib.zig) for how to build. + +> Note: you only need the files `raygui.zig`, `raygui_marshal.h` and `raygui_marshal.c` for this to work +> +This weird workaround with `raygui_marshal.h/raygui_marshal.c` I actually had to make for Webassembly builds to work, because passing structs as function parameters or returning them cannot be done on the Zig side somehow. If I try it, I get a runtime error "index out of bounds". This happens only in WebAssembly builds. So `raygui_marshal.c` must be compiled with `emcc`. See [build.zig](https://github.com/ryupold/examples-raylib.zig/blob/main/build.zig) in the examples. + +## custom definitions +An easy way to fix binding mistakes is to edit them in `bindings.json` and setting the custom flag to true. This way the binding will not be overriden when calling `zig build intermediate`. +Additionally you can add custom definitions into `inject.zig, inject.h, inject.c` these files will be prepended accordingly. + +## disclaimer +I have NOT tested most of the generated functions, so there might be bugs. Especially when it comes to pointers as it is not decidable (for the generator) what a pointer to C means. Could be single item, array, sentinel terminated and/or nullable. If you run into crashes using one of the functions or types in `raygui.zig` feel free to [create an issue](https://github.com/ryupold/raygui.zig/issues) and I will look into it. + +## generate bindings +for current raygui source (submodule) + +```sh +zig build parse # create JSON files with raylib_parser +zig build intermediate # generate bindings.json (keeps definitions with custom=true) +zig build bindings # write all intermediate bindings to raylib.zig +``` + +For easier diffing and to follow changes to the raygui repository I commit also the generated json files. diff --git a/libs/raygui/bindings.json b/libs/raygui/bindings.json new file mode 100644 index 0000000..615db63 --- /dev/null +++ b/libs/raygui/bindings.json @@ -0,0 +1,3419 @@ +{ + "functions": [ + { + "name": "GuiEnable", + "params": [], + "returnType": "void", + "description": "Enable gui controls (global state)", + "custom": false + }, + { + "name": "GuiDisable", + "params": [], + "returnType": "void", + "description": "Disable gui controls (global state)", + "custom": false + }, + { + "name": "GuiLock", + "params": [], + "returnType": "void", + "description": "Lock gui controls (global state)", + "custom": false + }, + { + "name": "GuiUnlock", + "params": [], + "returnType": "void", + "description": "Unlock gui controls (global state)", + "custom": false + }, + { + "name": "GuiIsLocked", + "params": [], + "returnType": "bool", + "description": "Check if gui is locked (global state)", + "custom": false + }, + { + "name": "GuiSetAlpha", + "params": [ + { + "name": "alpha", + "typ": "f32" + } + ], + "returnType": "void", + "description": "Set gui controls alpha (global state), alpha goes from 0.0f to 1.0f", + "custom": false + }, + { + "name": "GuiSetState", + "params": [ + { + "name": "state", + "typ": "GuiState" + } + ], + "returnType": "void", + "description": "Set gui state (global state)", + "custom": true + }, + { + "name": "GuiGetState", + "params": [], + "returnType": "GuiState", + "description": "Get gui state (global state)", + "custom": true + }, + { + "name": "GuiSetFont", + "params": [ + { + "name": "font", + "typ": "Font" + } + ], + "returnType": "void", + "description": "Set gui custom font (global state)", + "custom": false + }, + { + "name": "GuiGetFont", + "params": [], + "returnType": "Font", + "description": "Get gui custom font (global state)", + "custom": false + }, + { + "name": "GuiSetStyle", + "params": [ + { + "name": "control", + "typ": "i32" + }, + { + "name": "property", + "typ": "i32" + }, + { + "name": "value", + "typ": "i32" + } + ], + "returnType": "void", + "description": "Set one style property", + "custom": true + }, + { + "name": "GuiGetStyle", + "params": [ + { + "name": "control", + "typ": "GuiControl" + }, + { + "name": "property", + "typ": "i32" + } + ], + "returnType": "i32", + "description": "Get one style property", + "custom": true + }, + { + "name": "GuiLoadStyle", + "params": [ + { + "name": "fileName", + "typ": "[*:0]const u8" + } + ], + "returnType": "void", + "description": "Load style file over global style variable (.rgs)", + "custom": false + }, + { + "name": "GuiLoadStyleDefault", + "params": [], + "returnType": "void", + "description": "Load style default over global style", + "custom": false + }, + { + "name": "GuiEnableTooltip", + "params": [], + "returnType": "void", + "description": "Enable gui tooltips (global state)", + "custom": false + }, + { + "name": "GuiDisableTooltip", + "params": [], + "returnType": "void", + "description": "Disable gui tooltips (global state)", + "custom": false + }, + { + "name": "GuiSetTooltip", + "params": [ + { + "name": "tooltip", + "typ": "[*:0]const u8" + } + ], + "returnType": "void", + "description": "Set tooltip string", + "custom": false + }, + { + "name": "GuiIconText", + "params": [ + { + "name": "iconId", + "typ": "i32" + }, + { + "name": "text", + "typ": "[*:0]const u8" + } + ], + "returnType": "[*:0]const u8", + "description": "Get text with icon id prepended (if supported)", + "custom": false + }, + { + "name": "GuiSetIconScale", + "params": [ + { + "name": "scale", + "typ": "i32" + } + ], + "returnType": "void", + "description": "Set default icon drawing size", + "custom": false + }, + { + "name": "GuiGetIcons", + "params": [], + "returnType": "*u32", + "description": "Get raygui icons data pointer", + "custom": false + }, + { + "name": "GuiLoadIcons", + "params": [ + { + "name": "fileName", + "typ": "[*:0]const u8" + }, + { + "name": "loadIconsName", + "typ": "bool" + } + ], + "returnType": "[*][*:0]u8", + "description": "Load raygui icons file (.rgi) into internal icons data", + "custom": false + }, + { + "name": "GuiDrawIcon", + "params": [ + { + "name": "iconId", + "typ": "i32" + }, + { + "name": "posX", + "typ": "i32" + }, + { + "name": "posY", + "typ": "i32" + }, + { + "name": "pixelSize", + "typ": "i32" + }, + { + "name": "color", + "typ": "Color" + } + ], + "returnType": "void", + "description": "Draw icon using pixel size at specified position", + "custom": false + }, + { + "name": "GuiWindowBox", + "params": [ + { + "name": "bounds", + "typ": "Rectangle" + }, + { + "name": "title", + "typ": "[*:0]const u8" + } + ], + "returnType": "i32", + "description": "Window Box control, shows a window that can be closed", + "custom": false + }, + { + "name": "GuiGroupBox", + "params": [ + { + "name": "bounds", + "typ": "Rectangle" + }, + { + "name": "text", + "typ": "[*:0]const u8" + } + ], + "returnType": "i32", + "description": "Group Box control with text name", + "custom": false + }, + { + "name": "GuiLine", + "params": [ + { + "name": "bounds", + "typ": "Rectangle" + }, + { + "name": "text", + "typ": "[*:0]const u8" + } + ], + "returnType": "i32", + "description": "Line separator control, could contain text", + "custom": false + }, + { + "name": "GuiPanel", + "params": [ + { + "name": "bounds", + "typ": "Rectangle" + }, + { + "name": "text", + "typ": "[*:0]const u8" + } + ], + "returnType": "i32", + "description": "Panel control, useful to group controls", + "custom": false + }, + { + "name": "GuiTabBar", + "params": [ + { + "name": "bounds", + "typ": "Rectangle" + }, + { + "name": "text", + "typ": "[*]const [*:0]const u8" + }, + { + "name": "count", + "typ": "i32" + }, + { + "name": "active", + "typ": "*i32" + } + ], + "returnType": "i32", + "description": "Tab Bar control, returns TAB to be closed or -1", + "custom": false + }, + { + "name": "GuiScrollPanel", + "params": [ + { + "name": "bounds", + "typ": "Rectangle" + }, + { + "name": "text", + "typ": "[*:0]const u8" + }, + { + "name": "content", + "typ": "Rectangle" + }, + { + "name": "scroll", + "typ": "*Vector2" + }, + { + "name": "view", + "typ": "*Rectangle" + } + ], + "returnType": "i32", + "description": "Scroll Panel control", + "custom": false + }, + { + "name": "GuiLabel", + "params": [ + { + "name": "bounds", + "typ": "Rectangle" + }, + { + "name": "text", + "typ": "[*:0]const u8" + } + ], + "returnType": "i32", + "description": "Label control, shows text", + "custom": false + }, + { + "name": "GuiButton", + "params": [ + { + "name": "bounds", + "typ": "Rectangle" + }, + { + "name": "text", + "typ": "[*:0]const u8" + } + ], + "returnType": "i32", + "description": "Button control, returns true when clicked", + "custom": false + }, + { + "name": "GuiLabelButton", + "params": [ + { + "name": "bounds", + "typ": "Rectangle" + }, + { + "name": "text", + "typ": "[*:0]const u8" + } + ], + "returnType": "i32", + "description": "Label button control, show true when clicked", + "custom": false + }, + { + "name": "GuiToggle", + "params": [ + { + "name": "bounds", + "typ": "Rectangle" + }, + { + "name": "text", + "typ": "[*:0]const u8" + }, + { + "name": "active", + "typ": "*bool" + } + ], + "returnType": "i32", + "description": "Toggle Button control, returns true when active", + "custom": false + }, + { + "name": "GuiToggleGroup", + "params": [ + { + "name": "bounds", + "typ": "Rectangle" + }, + { + "name": "text", + "typ": "[*:0]const u8" + }, + { + "name": "active", + "typ": "*i32" + } + ], + "returnType": "i32", + "description": "Toggle Group control, returns active toggle index", + "custom": false + }, + { + "name": "GuiToggleSlider", + "params": [ + { + "name": "bounds", + "typ": "Rectangle" + }, + { + "name": "text", + "typ": "[*:0]const u8" + }, + { + "name": "active", + "typ": "*i32" + } + ], + "returnType": "i32", + "description": "Toggle Slider control, returns true when clicked", + "custom": false + }, + { + "name": "GuiCheckBox", + "params": [ + { + "name": "bounds", + "typ": "Rectangle" + }, + { + "name": "text", + "typ": "[*:0]const u8" + }, + { + "name": "checked", + "typ": "*bool" + } + ], + "returnType": "i32", + "description": "Check Box control, returns true when active", + "custom": false + }, + { + "name": "GuiComboBox", + "params": [ + { + "name": "bounds", + "typ": "Rectangle" + }, + { + "name": "text", + "typ": "[*:0]const u8" + }, + { + "name": "active", + "typ": "*i32" + } + ], + "returnType": "i32", + "description": "Combo Box control, returns selected item index", + "custom": false + }, + { + "name": "GuiDropdownBox", + "params": [ + { + "name": "bounds", + "typ": "Rectangle" + }, + { + "name": "text", + "typ": "[*:0]const u8" + }, + { + "name": "active", + "typ": "*i32" + }, + { + "name": "editMode", + "typ": "bool" + } + ], + "returnType": "i32", + "description": "Dropdown Box control, returns selected item", + "custom": false + }, + { + "name": "GuiSpinner", + "params": [ + { + "name": "bounds", + "typ": "Rectangle" + }, + { + "name": "text", + "typ": "[*:0]const u8" + }, + { + "name": "value", + "typ": "*i32" + }, + { + "name": "minValue", + "typ": "i32" + }, + { + "name": "maxValue", + "typ": "i32" + }, + { + "name": "editMode", + "typ": "bool" + } + ], + "returnType": "i32", + "description": "Spinner control, returns selected value", + "custom": false + }, + { + "name": "GuiValueBox", + "params": [ + { + "name": "bounds", + "typ": "Rectangle" + }, + { + "name": "text", + "typ": "[*:0]const u8" + }, + { + "name": "value", + "typ": "*i32" + }, + { + "name": "minValue", + "typ": "i32" + }, + { + "name": "maxValue", + "typ": "i32" + }, + { + "name": "editMode", + "typ": "bool" + } + ], + "returnType": "i32", + "description": "Value Box control, updates input text with numbers", + "custom": false + }, + { + "name": "GuiTextBox", + "params": [ + { + "name": "bounds", + "typ": "Rectangle" + }, + { + "name": "text", + "typ": "?[*:0]u8" + }, + { + "name": "textSize", + "typ": "i32" + }, + { + "name": "editMode", + "typ": "bool" + } + ], + "returnType": "i32", + "description": "Text Box control, updates input text", + "custom": false + }, + { + "name": "GuiSlider", + "params": [ + { + "name": "bounds", + "typ": "Rectangle" + }, + { + "name": "textLeft", + "typ": "[*:0]const u8" + }, + { + "name": "textRight", + "typ": "[*:0]const u8" + }, + { + "name": "value", + "typ": "*f32" + }, + { + "name": "minValue", + "typ": "f32" + }, + { + "name": "maxValue", + "typ": "f32" + } + ], + "returnType": "i32", + "description": "Slider control, returns selected value", + "custom": false + }, + { + "name": "GuiSliderBar", + "params": [ + { + "name": "bounds", + "typ": "Rectangle" + }, + { + "name": "textLeft", + "typ": "[*:0]const u8" + }, + { + "name": "textRight", + "typ": "[*:0]const u8" + }, + { + "name": "value", + "typ": "*f32" + }, + { + "name": "minValue", + "typ": "f32" + }, + { + "name": "maxValue", + "typ": "f32" + } + ], + "returnType": "i32", + "description": "Slider Bar control, returns selected value", + "custom": false + }, + { + "name": "GuiProgressBar", + "params": [ + { + "name": "bounds", + "typ": "Rectangle" + }, + { + "name": "textLeft", + "typ": "[*:0]const u8" + }, + { + "name": "textRight", + "typ": "[*:0]const u8" + }, + { + "name": "value", + "typ": "*f32" + }, + { + "name": "minValue", + "typ": "f32" + }, + { + "name": "maxValue", + "typ": "f32" + } + ], + "returnType": "i32", + "description": "Progress Bar control, shows current progress value", + "custom": false + }, + { + "name": "GuiStatusBar", + "params": [ + { + "name": "bounds", + "typ": "Rectangle" + }, + { + "name": "text", + "typ": "[*:0]const u8" + } + ], + "returnType": "i32", + "description": "Status Bar control, shows info text", + "custom": false + }, + { + "name": "GuiDummyRec", + "params": [ + { + "name": "bounds", + "typ": "Rectangle" + }, + { + "name": "text", + "typ": "[*:0]const u8" + } + ], + "returnType": "i32", + "description": "Dummy control for placeholders", + "custom": false + }, + { + "name": "GuiGrid", + "params": [ + { + "name": "bounds", + "typ": "Rectangle" + }, + { + "name": "text", + "typ": "[*:0]const u8" + }, + { + "name": "spacing", + "typ": "f32" + }, + { + "name": "subdivs", + "typ": "i32" + }, + { + "name": "mouseCell", + "typ": "*Vector2" + } + ], + "returnType": "i32", + "description": "Grid control, returns mouse cell position", + "custom": false + }, + { + "name": "GuiListView", + "params": [ + { + "name": "bounds", + "typ": "Rectangle" + }, + { + "name": "text", + "typ": "[*:0]const u8" + }, + { + "name": "scrollIndex", + "typ": "*i32" + }, + { + "name": "active", + "typ": "*i32" + } + ], + "returnType": "i32", + "description": "List View control, returns selected list item index", + "custom": false + }, + { + "name": "GuiListViewEx", + "params": [ + { + "name": "bounds", + "typ": "Rectangle" + }, + { + "name": "text", + "typ": "[*]const [*:0]const u8" + }, + { + "name": "count", + "typ": "i32" + }, + { + "name": "scrollIndex", + "typ": "*i32" + }, + { + "name": "active", + "typ": "*i32" + }, + { + "name": "focus", + "typ": "*i32" + } + ], + "returnType": "i32", + "description": "List View with extended parameters", + "custom": false + }, + { + "name": "GuiMessageBox", + "params": [ + { + "name": "bounds", + "typ": "Rectangle" + }, + { + "name": "title", + "typ": "[*:0]const u8" + }, + { + "name": "message", + "typ": "[*:0]const u8" + }, + { + "name": "buttons", + "typ": "[*:0]const u8" + } + ], + "returnType": "i32", + "description": "Message Box control, displays a message", + "custom": false + }, + { + "name": "GuiTextInputBox", + "params": [ + { + "name": "bounds", + "typ": "Rectangle" + }, + { + "name": "title", + "typ": "[*:0]const u8" + }, + { + "name": "message", + "typ": "[*:0]const u8" + }, + { + "name": "buttons", + "typ": "[*:0]const u8" + }, + { + "name": "text", + "typ": "?[*:0]u8" + }, + { + "name": "textMaxSize", + "typ": "i32" + }, + { + "name": "secretViewActive", + "typ": "*bool" + } + ], + "returnType": "i32", + "description": "Text Input Box control, ask for text, supports secret", + "custom": false + }, + { + "name": "GuiColorPicker", + "params": [ + { + "name": "bounds", + "typ": "Rectangle" + }, + { + "name": "text", + "typ": "[*:0]const u8" + }, + { + "name": "color", + "typ": "*Color" + } + ], + "returnType": "i32", + "description": "Color Picker control (multiple color controls)", + "custom": false + }, + { + "name": "GuiColorPanel", + "params": [ + { + "name": "bounds", + "typ": "Rectangle" + }, + { + "name": "text", + "typ": "[*:0]const u8" + }, + { + "name": "color", + "typ": "*Color" + } + ], + "returnType": "i32", + "description": "Color Panel control", + "custom": false + }, + { + "name": "GuiColorBarAlpha", + "params": [ + { + "name": "bounds", + "typ": "Rectangle" + }, + { + "name": "text", + "typ": "[*:0]const u8" + }, + { + "name": "alpha", + "typ": "*f32" + } + ], + "returnType": "i32", + "description": "Color Bar Alpha control", + "custom": false + }, + { + "name": "GuiColorBarHue", + "params": [ + { + "name": "bounds", + "typ": "Rectangle" + }, + { + "name": "text", + "typ": "[*:0]const u8" + }, + { + "name": "value", + "typ": "*f32" + } + ], + "returnType": "i32", + "description": "Color Bar Hue control", + "custom": false + }, + { + "name": "GuiColorPickerHSV", + "params": [ + { + "name": "bounds", + "typ": "Rectangle" + }, + { + "name": "text", + "typ": "[*:0]const u8" + }, + { + "name": "colorHsv", + "typ": "*Vector3" + } + ], + "returnType": "i32", + "description": "Color Picker control that avoids conversion to RGB on each call (multiple color controls)", + "custom": false + }, + { + "name": "GuiColorPanelHSV", + "params": [ + { + "name": "bounds", + "typ": "Rectangle" + }, + { + "name": "text", + "typ": "[*:0]const u8" + }, + { + "name": "colorHsv", + "typ": "*Vector3" + } + ], + "returnType": "i32", + "description": "Color Panel control that returns HSV color value, used by GuiColorPickerHSV()", + "custom": false + } + ], + "enums": [ + { + "name": "GuiState", + "values": [ + { + "name": "STATE_NORMAL", + "value": 0, + "description": "" + }, + { + "name": "STATE_FOCUSED", + "value": 1, + "description": "" + }, + { + "name": "STATE_PRESSED", + "value": 2, + "description": "" + }, + { + "name": "STATE_DISABLED", + "value": 3, + "description": "" + } + ], + "description": "Gui control state", + "custom": false + }, + { + "name": "GuiTextAlignment", + "values": [ + { + "name": "TEXT_ALIGN_LEFT", + "value": 0, + "description": "" + }, + { + "name": "TEXT_ALIGN_CENTER", + "value": 1, + "description": "" + }, + { + "name": "TEXT_ALIGN_RIGHT", + "value": 2, + "description": "" + } + ], + "description": "Gui control text alignment", + "custom": false + }, + { + "name": "GuiTextAlignmentVertical", + "values": [ + { + "name": "TEXT_ALIGN_TOP", + "value": 0, + "description": "" + }, + { + "name": "TEXT_ALIGN_MIDDLE", + "value": 1, + "description": "" + }, + { + "name": "TEXT_ALIGN_BOTTOM", + "value": 2, + "description": "" + } + ], + "description": "Gui control text alignment vertical", + "custom": false + }, + { + "name": "GuiTextWrapMode", + "values": [ + { + "name": "TEXT_WRAP_NONE", + "value": 0, + "description": "" + }, + { + "name": "TEXT_WRAP_CHAR", + "value": 1, + "description": "" + }, + { + "name": "TEXT_WRAP_WORD", + "value": 2, + "description": "" + } + ], + "description": "Gui control text wrap mode", + "custom": false + }, + { + "name": "GuiControl", + "values": [ + { + "name": "DEFAULT", + "value": 0, + "description": "" + }, + { + "name": "LABEL", + "value": 1, + "description": "Used also for: LABELBUTTON" + }, + { + "name": "BUTTON", + "value": 2, + "description": "" + }, + { + "name": "TOGGLE", + "value": 3, + "description": "Used also for: TOGGLEGROUP" + }, + { + "name": "SLIDER", + "value": 4, + "description": "Used also for: SLIDERBAR, TOGGLESLIDER" + }, + { + "name": "PROGRESSBAR", + "value": 5, + "description": "" + }, + { + "name": "CHECKBOX", + "value": 6, + "description": "" + }, + { + "name": "COMBOBOX", + "value": 7, + "description": "" + }, + { + "name": "DROPDOWNBOX", + "value": 8, + "description": "" + }, + { + "name": "TEXTBOX", + "value": 9, + "description": "Used also for: TEXTBOXMULTI" + }, + { + "name": "VALUEBOX", + "value": 10, + "description": "" + }, + { + "name": "SPINNER", + "value": 11, + "description": "Uses: BUTTON, VALUEBOX" + }, + { + "name": "LISTVIEW", + "value": 12, + "description": "" + }, + { + "name": "COLORPICKER", + "value": 13, + "description": "" + }, + { + "name": "SCROLLBAR", + "value": 14, + "description": "" + }, + { + "name": "STATUSBAR", + "value": 15, + "description": "" + } + ], + "description": "Gui controls", + "custom": false + }, + { + "name": "GuiControlProperty", + "values": [ + { + "name": "BORDER_COLOR_NORMAL", + "value": 0, + "description": "Control border color in STATE_NORMAL" + }, + { + "name": "BASE_COLOR_NORMAL", + "value": 1, + "description": "Control base color in STATE_NORMAL" + }, + { + "name": "TEXT_COLOR_NORMAL", + "value": 2, + "description": "Control text color in STATE_NORMAL" + }, + { + "name": "BORDER_COLOR_FOCUSED", + "value": 3, + "description": "Control border color in STATE_FOCUSED" + }, + { + "name": "BASE_COLOR_FOCUSED", + "value": 4, + "description": "Control base color in STATE_FOCUSED" + }, + { + "name": "TEXT_COLOR_FOCUSED", + "value": 5, + "description": "Control text color in STATE_FOCUSED" + }, + { + "name": "BORDER_COLOR_PRESSED", + "value": 6, + "description": "Control border color in STATE_PRESSED" + }, + { + "name": "BASE_COLOR_PRESSED", + "value": 7, + "description": "Control base color in STATE_PRESSED" + }, + { + "name": "TEXT_COLOR_PRESSED", + "value": 8, + "description": "Control text color in STATE_PRESSED" + }, + { + "name": "BORDER_COLOR_DISABLED", + "value": 9, + "description": "Control border color in STATE_DISABLED" + }, + { + "name": "BASE_COLOR_DISABLED", + "value": 10, + "description": "Control base color in STATE_DISABLED" + }, + { + "name": "TEXT_COLOR_DISABLED", + "value": 11, + "description": "Control text color in STATE_DISABLED" + }, + { + "name": "BORDER_WIDTH", + "value": 12, + "description": "Control border size, 0 for no border" + }, + { + "name": "TEXT_PADDING", + "value": 13, + "description": "Control text padding, not considering border" + }, + { + "name": "TEXT_ALIGNMENT", + "value": 14, + "description": "Control text horizontal alignment inside control text bound (after border and padding)" + } + ], + "description": "Gui base properties for every control", + "custom": false + }, + { + "name": "GuiDefaultProperty", + "values": [ + { + "name": "TEXT_SIZE", + "value": 16, + "description": "Text size (glyphs max height)" + }, + { + "name": "TEXT_SPACING", + "value": 17, + "description": "Text spacing between glyphs" + }, + { + "name": "LINE_COLOR", + "value": 18, + "description": "Line control color" + }, + { + "name": "BACKGROUND_COLOR", + "value": 19, + "description": "Background color" + }, + { + "name": "TEXT_LINE_SPACING", + "value": 20, + "description": "Text spacing between lines" + }, + { + "name": "TEXT_ALIGNMENT_VERTICAL", + "value": 21, + "description": "Text vertical alignment inside text bounds (after border and padding)" + }, + { + "name": "TEXT_WRAP_MODE", + "value": 22, + "description": "Text wrap-mode inside text bounds" + } + ], + "description": "DEFAULT extended properties", + "custom": false + }, + { + "name": "GuiToggleProperty", + "values": [ + { + "name": "GROUP_PADDING", + "value": 16, + "description": "ToggleGroup separation between toggles" + } + ], + "description": "Toggle/ToggleGroup", + "custom": false + }, + { + "name": "GuiSliderProperty", + "values": [ + { + "name": "SLIDER_WIDTH", + "value": 16, + "description": "Slider size of internal bar" + }, + { + "name": "SLIDER_PADDING", + "value": 17, + "description": "Slider/SliderBar internal bar padding" + } + ], + "description": "Slider/SliderBar", + "custom": false + }, + { + "name": "GuiProgressBarProperty", + "values": [ + { + "name": "PROGRESS_PADDING", + "value": 16, + "description": "ProgressBar internal padding" + } + ], + "description": "ProgressBar", + "custom": false + }, + { + "name": "GuiScrollBarProperty", + "values": [ + { + "name": "ARROWS_SIZE", + "value": 16, + "description": "ScrollBar arrows size" + }, + { + "name": "ARROWS_VISIBLE", + "value": 17, + "description": "ScrollBar arrows visible" + }, + { + "name": "SCROLL_SLIDER_PADDING", + "value": 18, + "description": "ScrollBar slider internal padding" + }, + { + "name": "SCROLL_SLIDER_SIZE", + "value": 19, + "description": "ScrollBar slider size" + }, + { + "name": "SCROLL_PADDING", + "value": 20, + "description": "ScrollBar scroll padding from arrows" + }, + { + "name": "SCROLL_SPEED", + "value": 21, + "description": "ScrollBar scrolling speed" + } + ], + "description": "ScrollBar", + "custom": false + }, + { + "name": "GuiCheckBoxProperty", + "values": [ + { + "name": "CHECK_PADDING", + "value": 16, + "description": "CheckBox internal check padding" + } + ], + "description": "CheckBox", + "custom": false + }, + { + "name": "GuiComboBoxProperty", + "values": [ + { + "name": "COMBO_BUTTON_WIDTH", + "value": 16, + "description": "ComboBox right button width" + }, + { + "name": "COMBO_BUTTON_SPACING", + "value": 17, + "description": "ComboBox button separation" + } + ], + "description": "ComboBox", + "custom": false + }, + { + "name": "GuiDropdownBoxProperty", + "values": [ + { + "name": "ARROW_PADDING", + "value": 16, + "description": "DropdownBox arrow separation from border and items" + }, + { + "name": "DROPDOWN_ITEMS_SPACING", + "value": 17, + "description": "DropdownBox items separation" + } + ], + "description": "DropdownBox", + "custom": false + }, + { + "name": "GuiTextBoxProperty", + "values": [ + { + "name": "TEXT_READONLY", + "value": 16, + "description": "TextBox in read-only mode: 0-text editable, 1-text no-editable" + } + ], + "description": "TextBox/TextBoxMulti/ValueBox/Spinner", + "custom": false + }, + { + "name": "GuiSpinnerProperty", + "values": [ + { + "name": "SPIN_BUTTON_WIDTH", + "value": 16, + "description": "Spinner left/right buttons width" + }, + { + "name": "SPIN_BUTTON_SPACING", + "value": 17, + "description": "Spinner buttons separation" + } + ], + "description": "Spinner", + "custom": false + }, + { + "name": "GuiListViewProperty", + "values": [ + { + "name": "LIST_ITEMS_HEIGHT", + "value": 16, + "description": "ListView items height" + }, + { + "name": "LIST_ITEMS_SPACING", + "value": 17, + "description": "ListView items separation" + }, + { + "name": "SCROLLBAR_WIDTH", + "value": 18, + "description": "ListView scrollbar size (usually width)" + }, + { + "name": "SCROLLBAR_SIDE", + "value": 19, + "description": "ListView scrollbar side (0-SCROLLBAR_LEFT_SIDE, 1-SCROLLBAR_RIGHT_SIDE)" + } + ], + "description": "ListView", + "custom": false + }, + { + "name": "GuiColorPickerProperty", + "values": [ + { + "name": "COLOR_SELECTOR_SIZE", + "value": 16, + "description": "" + }, + { + "name": "HUEBAR_WIDTH", + "value": 17, + "description": "ColorPicker right hue bar width" + }, + { + "name": "HUEBAR_PADDING", + "value": 18, + "description": "ColorPicker right hue bar separation from panel" + }, + { + "name": "HUEBAR_SELECTOR_HEIGHT", + "value": 19, + "description": "ColorPicker right hue bar selector height" + }, + { + "name": "HUEBAR_SELECTOR_OVERFLOW", + "value": 20, + "description": "ColorPicker right hue bar selector overflow" + } + ], + "description": "ColorPicker", + "custom": false + }, + { + "name": "GuiIconName", + "values": [ + { + "name": "ICON_NONE", + "value": 0, + "description": "" + }, + { + "name": "ICON_FOLDER_FILE_OPEN", + "value": 1, + "description": "" + }, + { + "name": "ICON_FILE_SAVE_CLASSIC", + "value": 2, + "description": "" + }, + { + "name": "ICON_FOLDER_OPEN", + "value": 3, + "description": "" + }, + { + "name": "ICON_FOLDER_SAVE", + "value": 4, + "description": "" + }, + { + "name": "ICON_FILE_OPEN", + "value": 5, + "description": "" + }, + { + "name": "ICON_FILE_SAVE", + "value": 6, + "description": "" + }, + { + "name": "ICON_FILE_EXPORT", + "value": 7, + "description": "" + }, + { + "name": "ICON_FILE_ADD", + "value": 8, + "description": "" + }, + { + "name": "ICON_FILE_DELETE", + "value": 9, + "description": "" + }, + { + "name": "ICON_FILETYPE_TEXT", + "value": 10, + "description": "" + }, + { + "name": "ICON_FILETYPE_AUDIO", + "value": 11, + "description": "" + }, + { + "name": "ICON_FILETYPE_IMAGE", + "value": 12, + "description": "" + }, + { + "name": "ICON_FILETYPE_PLAY", + "value": 13, + "description": "" + }, + { + "name": "ICON_FILETYPE_VIDEO", + "value": 14, + "description": "" + }, + { + "name": "ICON_FILETYPE_INFO", + "value": 15, + "description": "" + }, + { + "name": "ICON_FILE_COPY", + "value": 16, + "description": "" + }, + { + "name": "ICON_FILE_CUT", + "value": 17, + "description": "" + }, + { + "name": "ICON_FILE_PASTE", + "value": 18, + "description": "" + }, + { + "name": "ICON_CURSOR_HAND", + "value": 19, + "description": "" + }, + { + "name": "ICON_CURSOR_POINTER", + "value": 20, + "description": "" + }, + { + "name": "ICON_CURSOR_CLASSIC", + "value": 21, + "description": "" + }, + { + "name": "ICON_PENCIL", + "value": 22, + "description": "" + }, + { + "name": "ICON_PENCIL_BIG", + "value": 23, + "description": "" + }, + { + "name": "ICON_BRUSH_CLASSIC", + "value": 24, + "description": "" + }, + { + "name": "ICON_BRUSH_PAINTER", + "value": 25, + "description": "" + }, + { + "name": "ICON_WATER_DROP", + "value": 26, + "description": "" + }, + { + "name": "ICON_COLOR_PICKER", + "value": 27, + "description": "" + }, + { + "name": "ICON_RUBBER", + "value": 28, + "description": "" + }, + { + "name": "ICON_COLOR_BUCKET", + "value": 29, + "description": "" + }, + { + "name": "ICON_TEXT_T", + "value": 30, + "description": "" + }, + { + "name": "ICON_TEXT_A", + "value": 31, + "description": "" + }, + { + "name": "ICON_SCALE", + "value": 32, + "description": "" + }, + { + "name": "ICON_RESIZE", + "value": 33, + "description": "" + }, + { + "name": "ICON_FILTER_POINT", + "value": 34, + "description": "" + }, + { + "name": "ICON_FILTER_BILINEAR", + "value": 35, + "description": "" + }, + { + "name": "ICON_CROP", + "value": 36, + "description": "" + }, + { + "name": "ICON_CROP_ALPHA", + "value": 37, + "description": "" + }, + { + "name": "ICON_SQUARE_TOGGLE", + "value": 38, + "description": "" + }, + { + "name": "ICON_SYMMETRY", + "value": 39, + "description": "" + }, + { + "name": "ICON_SYMMETRY_HORIZONTAL", + "value": 40, + "description": "" + }, + { + "name": "ICON_SYMMETRY_VERTICAL", + "value": 41, + "description": "" + }, + { + "name": "ICON_LENS", + "value": 42, + "description": "" + }, + { + "name": "ICON_LENS_BIG", + "value": 43, + "description": "" + }, + { + "name": "ICON_EYE_ON", + "value": 44, + "description": "" + }, + { + "name": "ICON_EYE_OFF", + "value": 45, + "description": "" + }, + { + "name": "ICON_FILTER_TOP", + "value": 46, + "description": "" + }, + { + "name": "ICON_FILTER", + "value": 47, + "description": "" + }, + { + "name": "ICON_TARGET_POINT", + "value": 48, + "description": "" + }, + { + "name": "ICON_TARGET_SMALL", + "value": 49, + "description": "" + }, + { + "name": "ICON_TARGET_BIG", + "value": 50, + "description": "" + }, + { + "name": "ICON_TARGET_MOVE", + "value": 51, + "description": "" + }, + { + "name": "ICON_CURSOR_MOVE", + "value": 52, + "description": "" + }, + { + "name": "ICON_CURSOR_SCALE", + "value": 53, + "description": "" + }, + { + "name": "ICON_CURSOR_SCALE_RIGHT", + "value": 54, + "description": "" + }, + { + "name": "ICON_CURSOR_SCALE_LEFT", + "value": 55, + "description": "" + }, + { + "name": "ICON_UNDO", + "value": 56, + "description": "" + }, + { + "name": "ICON_REDO", + "value": 57, + "description": "" + }, + { + "name": "ICON_REREDO", + "value": 58, + "description": "" + }, + { + "name": "ICON_MUTATE", + "value": 59, + "description": "" + }, + { + "name": "ICON_ROTATE", + "value": 60, + "description": "" + }, + { + "name": "ICON_REPEAT", + "value": 61, + "description": "" + }, + { + "name": "ICON_SHUFFLE", + "value": 62, + "description": "" + }, + { + "name": "ICON_EMPTYBOX", + "value": 63, + "description": "" + }, + { + "name": "ICON_TARGET", + "value": 64, + "description": "" + }, + { + "name": "ICON_TARGET_SMALL_FILL", + "value": 65, + "description": "" + }, + { + "name": "ICON_TARGET_BIG_FILL", + "value": 66, + "description": "" + }, + { + "name": "ICON_TARGET_MOVE_FILL", + "value": 67, + "description": "" + }, + { + "name": "ICON_CURSOR_MOVE_FILL", + "value": 68, + "description": "" + }, + { + "name": "ICON_CURSOR_SCALE_FILL", + "value": 69, + "description": "" + }, + { + "name": "ICON_CURSOR_SCALE_RIGHT_FILL", + "value": 70, + "description": "" + }, + { + "name": "ICON_CURSOR_SCALE_LEFT_FILL", + "value": 71, + "description": "" + }, + { + "name": "ICON_UNDO_FILL", + "value": 72, + "description": "" + }, + { + "name": "ICON_REDO_FILL", + "value": 73, + "description": "" + }, + { + "name": "ICON_REREDO_FILL", + "value": 74, + "description": "" + }, + { + "name": "ICON_MUTATE_FILL", + "value": 75, + "description": "" + }, + { + "name": "ICON_ROTATE_FILL", + "value": 76, + "description": "" + }, + { + "name": "ICON_REPEAT_FILL", + "value": 77, + "description": "" + }, + { + "name": "ICON_SHUFFLE_FILL", + "value": 78, + "description": "" + }, + { + "name": "ICON_EMPTYBOX_SMALL", + "value": 79, + "description": "" + }, + { + "name": "ICON_BOX", + "value": 80, + "description": "" + }, + { + "name": "ICON_BOX_TOP", + "value": 81, + "description": "" + }, + { + "name": "ICON_BOX_TOP_RIGHT", + "value": 82, + "description": "" + }, + { + "name": "ICON_BOX_RIGHT", + "value": 83, + "description": "" + }, + { + "name": "ICON_BOX_BOTTOM_RIGHT", + "value": 84, + "description": "" + }, + { + "name": "ICON_BOX_BOTTOM", + "value": 85, + "description": "" + }, + { + "name": "ICON_BOX_BOTTOM_LEFT", + "value": 86, + "description": "" + }, + { + "name": "ICON_BOX_LEFT", + "value": 87, + "description": "" + }, + { + "name": "ICON_BOX_TOP_LEFT", + "value": 88, + "description": "" + }, + { + "name": "ICON_BOX_CENTER", + "value": 89, + "description": "" + }, + { + "name": "ICON_BOX_CIRCLE_MASK", + "value": 90, + "description": "" + }, + { + "name": "ICON_POT", + "value": 91, + "description": "" + }, + { + "name": "ICON_ALPHA_MULTIPLY", + "value": 92, + "description": "" + }, + { + "name": "ICON_ALPHA_CLEAR", + "value": 93, + "description": "" + }, + { + "name": "ICON_DITHERING", + "value": 94, + "description": "" + }, + { + "name": "ICON_MIPMAPS", + "value": 95, + "description": "" + }, + { + "name": "ICON_BOX_GRID", + "value": 96, + "description": "" + }, + { + "name": "ICON_GRID", + "value": 97, + "description": "" + }, + { + "name": "ICON_BOX_CORNERS_SMALL", + "value": 98, + "description": "" + }, + { + "name": "ICON_BOX_CORNERS_BIG", + "value": 99, + "description": "" + }, + { + "name": "ICON_FOUR_BOXES", + "value": 100, + "description": "" + }, + { + "name": "ICON_GRID_FILL", + "value": 101, + "description": "" + }, + { + "name": "ICON_BOX_MULTISIZE", + "value": 102, + "description": "" + }, + { + "name": "ICON_ZOOM_SMALL", + "value": 103, + "description": "" + }, + { + "name": "ICON_ZOOM_MEDIUM", + "value": 104, + "description": "" + }, + { + "name": "ICON_ZOOM_BIG", + "value": 105, + "description": "" + }, + { + "name": "ICON_ZOOM_ALL", + "value": 106, + "description": "" + }, + { + "name": "ICON_ZOOM_CENTER", + "value": 107, + "description": "" + }, + { + "name": "ICON_BOX_DOTS_SMALL", + "value": 108, + "description": "" + }, + { + "name": "ICON_BOX_DOTS_BIG", + "value": 109, + "description": "" + }, + { + "name": "ICON_BOX_CONCENTRIC", + "value": 110, + "description": "" + }, + { + "name": "ICON_BOX_GRID_BIG", + "value": 111, + "description": "" + }, + { + "name": "ICON_OK_TICK", + "value": 112, + "description": "" + }, + { + "name": "ICON_CROSS", + "value": 113, + "description": "" + }, + { + "name": "ICON_ARROW_LEFT", + "value": 114, + "description": "" + }, + { + "name": "ICON_ARROW_RIGHT", + "value": 115, + "description": "" + }, + { + "name": "ICON_ARROW_DOWN", + "value": 116, + "description": "" + }, + { + "name": "ICON_ARROW_UP", + "value": 117, + "description": "" + }, + { + "name": "ICON_ARROW_LEFT_FILL", + "value": 118, + "description": "" + }, + { + "name": "ICON_ARROW_RIGHT_FILL", + "value": 119, + "description": "" + }, + { + "name": "ICON_ARROW_DOWN_FILL", + "value": 120, + "description": "" + }, + { + "name": "ICON_ARROW_UP_FILL", + "value": 121, + "description": "" + }, + { + "name": "ICON_AUDIO", + "value": 122, + "description": "" + }, + { + "name": "ICON_FX", + "value": 123, + "description": "" + }, + { + "name": "ICON_WAVE", + "value": 124, + "description": "" + }, + { + "name": "ICON_WAVE_SINUS", + "value": 125, + "description": "" + }, + { + "name": "ICON_WAVE_SQUARE", + "value": 126, + "description": "" + }, + { + "name": "ICON_WAVE_TRIANGULAR", + "value": 127, + "description": "" + }, + { + "name": "ICON_CROSS_SMALL", + "value": 128, + "description": "" + }, + { + "name": "ICON_PLAYER_PREVIOUS", + "value": 129, + "description": "" + }, + { + "name": "ICON_PLAYER_PLAY_BACK", + "value": 130, + "description": "" + }, + { + "name": "ICON_PLAYER_PLAY", + "value": 131, + "description": "" + }, + { + "name": "ICON_PLAYER_PAUSE", + "value": 132, + "description": "" + }, + { + "name": "ICON_PLAYER_STOP", + "value": 133, + "description": "" + }, + { + "name": "ICON_PLAYER_NEXT", + "value": 134, + "description": "" + }, + { + "name": "ICON_PLAYER_RECORD", + "value": 135, + "description": "" + }, + { + "name": "ICON_MAGNET", + "value": 136, + "description": "" + }, + { + "name": "ICON_LOCK_CLOSE", + "value": 137, + "description": "" + }, + { + "name": "ICON_LOCK_OPEN", + "value": 138, + "description": "" + }, + { + "name": "ICON_CLOCK", + "value": 139, + "description": "" + }, + { + "name": "ICON_TOOLS", + "value": 140, + "description": "" + }, + { + "name": "ICON_GEAR", + "value": 141, + "description": "" + }, + { + "name": "ICON_GEAR_BIG", + "value": 142, + "description": "" + }, + { + "name": "ICON_BIN", + "value": 143, + "description": "" + }, + { + "name": "ICON_HAND_POINTER", + "value": 144, + "description": "" + }, + { + "name": "ICON_LASER", + "value": 145, + "description": "" + }, + { + "name": "ICON_COIN", + "value": 146, + "description": "" + }, + { + "name": "ICON_EXPLOSION", + "value": 147, + "description": "" + }, + { + "name": "ICON_1UP", + "value": 148, + "description": "" + }, + { + "name": "ICON_PLAYER", + "value": 149, + "description": "" + }, + { + "name": "ICON_PLAYER_JUMP", + "value": 150, + "description": "" + }, + { + "name": "ICON_KEY", + "value": 151, + "description": "" + }, + { + "name": "ICON_DEMON", + "value": 152, + "description": "" + }, + { + "name": "ICON_TEXT_POPUP", + "value": 153, + "description": "" + }, + { + "name": "ICON_GEAR_EX", + "value": 154, + "description": "" + }, + { + "name": "ICON_CRACK", + "value": 155, + "description": "" + }, + { + "name": "ICON_CRACK_POINTS", + "value": 156, + "description": "" + }, + { + "name": "ICON_STAR", + "value": 157, + "description": "" + }, + { + "name": "ICON_DOOR", + "value": 158, + "description": "" + }, + { + "name": "ICON_EXIT", + "value": 159, + "description": "" + }, + { + "name": "ICON_MODE_2D", + "value": 160, + "description": "" + }, + { + "name": "ICON_MODE_3D", + "value": 161, + "description": "" + }, + { + "name": "ICON_CUBE", + "value": 162, + "description": "" + }, + { + "name": "ICON_CUBE_FACE_TOP", + "value": 163, + "description": "" + }, + { + "name": "ICON_CUBE_FACE_LEFT", + "value": 164, + "description": "" + }, + { + "name": "ICON_CUBE_FACE_FRONT", + "value": 165, + "description": "" + }, + { + "name": "ICON_CUBE_FACE_BOTTOM", + "value": 166, + "description": "" + }, + { + "name": "ICON_CUBE_FACE_RIGHT", + "value": 167, + "description": "" + }, + { + "name": "ICON_CUBE_FACE_BACK", + "value": 168, + "description": "" + }, + { + "name": "ICON_CAMERA", + "value": 169, + "description": "" + }, + { + "name": "ICON_SPECIAL", + "value": 170, + "description": "" + }, + { + "name": "ICON_LINK_NET", + "value": 171, + "description": "" + }, + { + "name": "ICON_LINK_BOXES", + "value": 172, + "description": "" + }, + { + "name": "ICON_LINK_MULTI", + "value": 173, + "description": "" + }, + { + "name": "ICON_LINK", + "value": 174, + "description": "" + }, + { + "name": "ICON_LINK_BROKE", + "value": 175, + "description": "" + }, + { + "name": "ICON_TEXT_NOTES", + "value": 176, + "description": "" + }, + { + "name": "ICON_NOTEBOOK", + "value": 177, + "description": "" + }, + { + "name": "ICON_SUITCASE", + "value": 178, + "description": "" + }, + { + "name": "ICON_SUITCASE_ZIP", + "value": 179, + "description": "" + }, + { + "name": "ICON_MAILBOX", + "value": 180, + "description": "" + }, + { + "name": "ICON_MONITOR", + "value": 181, + "description": "" + }, + { + "name": "ICON_PRINTER", + "value": 182, + "description": "" + }, + { + "name": "ICON_PHOTO_CAMERA", + "value": 183, + "description": "" + }, + { + "name": "ICON_PHOTO_CAMERA_FLASH", + "value": 184, + "description": "" + }, + { + "name": "ICON_HOUSE", + "value": 185, + "description": "" + }, + { + "name": "ICON_HEART", + "value": 186, + "description": "" + }, + { + "name": "ICON_CORNER", + "value": 187, + "description": "" + }, + { + "name": "ICON_VERTICAL_BARS", + "value": 188, + "description": "" + }, + { + "name": "ICON_VERTICAL_BARS_FILL", + "value": 189, + "description": "" + }, + { + "name": "ICON_LIFE_BARS", + "value": 190, + "description": "" + }, + { + "name": "ICON_INFO", + "value": 191, + "description": "" + }, + { + "name": "ICON_CROSSLINE", + "value": 192, + "description": "" + }, + { + "name": "ICON_HELP", + "value": 193, + "description": "" + }, + { + "name": "ICON_FILETYPE_ALPHA", + "value": 194, + "description": "" + }, + { + "name": "ICON_FILETYPE_HOME", + "value": 195, + "description": "" + }, + { + "name": "ICON_LAYERS_VISIBLE", + "value": 196, + "description": "" + }, + { + "name": "ICON_LAYERS", + "value": 197, + "description": "" + }, + { + "name": "ICON_WINDOW", + "value": 198, + "description": "" + }, + { + "name": "ICON_HIDPI", + "value": 199, + "description": "" + }, + { + "name": "ICON_FILETYPE_BINARY", + "value": 200, + "description": "" + }, + { + "name": "ICON_HEX", + "value": 201, + "description": "" + }, + { + "name": "ICON_SHIELD", + "value": 202, + "description": "" + }, + { + "name": "ICON_FILE_NEW", + "value": 203, + "description": "" + }, + { + "name": "ICON_FOLDER_ADD", + "value": 204, + "description": "" + }, + { + "name": "ICON_ALARM", + "value": 205, + "description": "" + }, + { + "name": "ICON_CPU", + "value": 206, + "description": "" + }, + { + "name": "ICON_ROM", + "value": 207, + "description": "" + }, + { + "name": "ICON_STEP_OVER", + "value": 208, + "description": "" + }, + { + "name": "ICON_STEP_INTO", + "value": 209, + "description": "" + }, + { + "name": "ICON_STEP_OUT", + "value": 210, + "description": "" + }, + { + "name": "ICON_RESTART", + "value": 211, + "description": "" + }, + { + "name": "ICON_BREAKPOINT_ON", + "value": 212, + "description": "" + }, + { + "name": "ICON_BREAKPOINT_OFF", + "value": 213, + "description": "" + }, + { + "name": "ICON_BURGER_MENU", + "value": 214, + "description": "" + }, + { + "name": "ICON_CASE_SENSITIVE", + "value": 215, + "description": "" + }, + { + "name": "ICON_REG_EXP", + "value": 216, + "description": "" + }, + { + "name": "ICON_FOLDER", + "value": 217, + "description": "" + }, + { + "name": "ICON_FILE", + "value": 218, + "description": "" + }, + { + "name": "ICON_SAND_TIMER", + "value": 219, + "description": "" + }, + { + "name": "ICON_220", + "value": 220, + "description": "" + }, + { + "name": "ICON_221", + "value": 221, + "description": "" + }, + { + "name": "ICON_222", + "value": 222, + "description": "" + }, + { + "name": "ICON_223", + "value": 223, + "description": "" + }, + { + "name": "ICON_224", + "value": 224, + "description": "" + }, + { + "name": "ICON_225", + "value": 225, + "description": "" + }, + { + "name": "ICON_226", + "value": 226, + "description": "" + }, + { + "name": "ICON_227", + "value": 227, + "description": "" + }, + { + "name": "ICON_228", + "value": 228, + "description": "" + }, + { + "name": "ICON_229", + "value": 229, + "description": "" + }, + { + "name": "ICON_230", + "value": 230, + "description": "" + }, + { + "name": "ICON_231", + "value": 231, + "description": "" + }, + { + "name": "ICON_232", + "value": 232, + "description": "" + }, + { + "name": "ICON_233", + "value": 233, + "description": "" + }, + { + "name": "ICON_234", + "value": 234, + "description": "" + }, + { + "name": "ICON_235", + "value": 235, + "description": "" + }, + { + "name": "ICON_236", + "value": 236, + "description": "" + }, + { + "name": "ICON_237", + "value": 237, + "description": "" + }, + { + "name": "ICON_238", + "value": 238, + "description": "" + }, + { + "name": "ICON_239", + "value": 239, + "description": "" + }, + { + "name": "ICON_240", + "value": 240, + "description": "" + }, + { + "name": "ICON_241", + "value": 241, + "description": "" + }, + { + "name": "ICON_242", + "value": 242, + "description": "" + }, + { + "name": "ICON_243", + "value": 243, + "description": "" + }, + { + "name": "ICON_244", + "value": 244, + "description": "" + }, + { + "name": "ICON_245", + "value": 245, + "description": "" + }, + { + "name": "ICON_246", + "value": 246, + "description": "" + }, + { + "name": "ICON_247", + "value": 247, + "description": "" + }, + { + "name": "ICON_248", + "value": 248, + "description": "" + }, + { + "name": "ICON_249", + "value": 249, + "description": "" + }, + { + "name": "ICON_250", + "value": 250, + "description": "" + }, + { + "name": "ICON_251", + "value": 251, + "description": "" + }, + { + "name": "ICON_252", + "value": 252, + "description": "" + }, + { + "name": "ICON_253", + "value": 253, + "description": "" + }, + { + "name": "ICON_254", + "value": 254, + "description": "" + }, + { + "name": "ICON_255", + "value": 255, + "description": "" + } + ], + "description": "", + "custom": false + } + ], + "structs": [ + { + "name": "Vector2", + "fields": [ + { + "name": "x", + "typ": "f32", + "description": "" + }, + { + "name": "y", + "typ": "f32", + "description": "" + } + ], + "description": "Vector2 type", + "custom": false + }, + { + "name": "Vector3", + "fields": [ + { + "name": "x", + "typ": "f32", + "description": "" + }, + { + "name": "y", + "typ": "f32", + "description": "" + }, + { + "name": "z", + "typ": "f32", + "description": "" + } + ], + "description": "Vector3 type // -- ConvertHSVtoRGB(), ConvertRGBtoHSV()", + "custom": false + }, + { + "name": "Color", + "fields": [ + { + "name": "r", + "typ": "u8", + "description": "" + }, + { + "name": "g", + "typ": "u8", + "description": "" + }, + { + "name": "b", + "typ": "u8", + "description": "" + }, + { + "name": "a", + "typ": "u8", + "description": "" + } + ], + "description": "Color type, RGBA (32bit)", + "custom": false + }, + { + "name": "Rectangle", + "fields": [ + { + "name": "x", + "typ": "f32", + "description": "" + }, + { + "name": "y", + "typ": "f32", + "description": "" + }, + { + "name": "width", + "typ": "f32", + "description": "" + }, + { + "name": "height", + "typ": "f32", + "description": "" + } + ], + "description": "Rectangle type", + "custom": false + }, + { + "name": "Texture2D", + "fields": [ + { + "name": "id", + "typ": "u32", + "description": "OpenGL texture id" + }, + { + "name": "width", + "typ": "i32", + "description": "Texture base width" + }, + { + "name": "height", + "typ": "i32", + "description": "Texture base height" + }, + { + "name": "mipmaps", + "typ": "i32", + "description": "Mipmap levels, 1 by default" + }, + { + "name": "format", + "typ": "i32", + "description": "Data format (PixelFormat type)" + } + ], + "description": "It should be redesigned to be provided by user", + "custom": false + }, + { + "name": "Image", + "fields": [ + { + "name": "data", + "typ": "*anyopaque", + "description": "Image raw data" + }, + { + "name": "width", + "typ": "i32", + "description": "Image base width" + }, + { + "name": "height", + "typ": "i32", + "description": "Image base height" + }, + { + "name": "mipmaps", + "typ": "i32", + "description": "Mipmap levels, 1 by default" + }, + { + "name": "format", + "typ": "i32", + "description": "Data format (PixelFormat type)" + } + ], + "description": "Image, pixel data stored in CPU memory (RAM)", + "custom": false + }, + { + "name": "GlyphInfo", + "fields": [ + { + "name": "value", + "typ": "i32", + "description": "Character value (Unicode)" + }, + { + "name": "offsetX", + "typ": "i32", + "description": "Character offset X when drawing" + }, + { + "name": "offsetY", + "typ": "i32", + "description": "Character offset Y when drawing" + }, + { + "name": "advanceX", + "typ": "i32", + "description": "Character advance position X" + }, + { + "name": "image", + "typ": "Image", + "description": "Character image data" + } + ], + "description": "GlyphInfo, font characters glyphs info", + "custom": false + }, + { + "name": "Font", + "fields": [ + { + "name": "baseSize", + "typ": "i32", + "description": "Base size (default chars height)" + }, + { + "name": "glyphCount", + "typ": "i32", + "description": "Number of glyph characters" + }, + { + "name": "glyphPadding", + "typ": "i32", + "description": "Padding around the glyph characters" + }, + { + "name": "texture", + "typ": "Texture2D", + "description": "Texture atlas containing the glyphs" + }, + { + "name": "recs", + "typ": "*Rectangle", + "description": "Rectangles in texture for the glyphs" + }, + { + "name": "glyphs", + "typ": "*GlyphInfo", + "description": "Glyphs info data" + } + ], + "description": "It should be redesigned to be provided by user", + "custom": false + }, + { + "name": "GuiStyleProp", + "fields": [ + { + "name": "controlId", + "typ": "u16", + "description": "Control identifier" + }, + { + "name": "propertyId", + "typ": "u16", + "description": "Property identifier" + }, + { + "name": "propertyValue", + "typ": "i32", + "description": "Property value" + } + ], + "description": "NOTE: Used when exporting style as code for convenience", + "custom": false + }, + { + "name": "GuiTextStyle", + "fields": [ + { + "name": "size", + "typ": "u32", + "description": "" + }, + { + "name": "charSpacing", + "typ": "i32", + "description": "" + }, + { + "name": "lineSpacing", + "typ": "i32", + "description": "" + }, + { + "name": "alignmentH", + "typ": "i32", + "description": "" + }, + { + "name": "alignmentV", + "typ": "i32", + "description": "" + }, + { + "name": "padding", + "typ": "i32", + "description": "" + } + ], + "description": "NOTE: Text style is defined by control", + "custom": false + } + ], + "defines": [ + { + "name": "RAYGUI_VERSION_MAJOR", + "typ": "i32", + "value": "4", + "description": "", + "custom": false + }, + { + "name": "RAYGUI_VERSION_MINOR", + "typ": "i32", + "value": "0", + "description": "", + "custom": false + }, + { + "name": "RAYGUI_VERSION_PATCH", + "typ": "i32", + "value": "0", + "description": "", + "custom": false + }, + { + "name": "RAYGUI_VERSION", + "typ": "[]const u8", + "value": "\"4.0\"", + "description": "", + "custom": false + }, + { + "name": "SCROLLBAR_LEFT_SIDE", + "typ": "i32", + "value": "0", + "description": "", + "custom": false + }, + { + "name": "SCROLLBAR_RIGHT_SIDE", + "typ": "i32", + "value": "1", + "description": "", + "custom": false + }, + { + "name": "RAYGUI_ICON_SIZE", + "typ": "i32", + "value": "16", + "description": "Size of icons in pixels (squared)", + "custom": false + }, + { + "name": "RAYGUI_ICON_MAX_ICONS", + "typ": "i32", + "value": "256", + "description": "Maximum number of icons", + "custom": false + }, + { + "name": "RAYGUI_ICON_MAX_NAME_LENGTH", + "typ": "i32", + "value": "32", + "description": "Maximum length of icon name id", + "custom": false + }, + { + "name": "RAYGUI_MAX_CONTROLS", + "typ": "i32", + "value": "16", + "description": "Maximum number of controls", + "custom": false + }, + { + "name": "RAYGUI_MAX_PROPS_BASE", + "typ": "i32", + "value": "16", + "description": "Maximum number of base properties", + "custom": false + }, + { + "name": "RAYGUI_MAX_PROPS_EXTENDED", + "typ": "i32", + "value": "8", + "description": "Maximum number of extended properties", + "custom": false + }, + { + "name": "KEY_RIGHT", + "typ": "i32", + "value": "262", + "description": "", + "custom": false + }, + { + "name": "KEY_LEFT", + "typ": "i32", + "value": "263", + "description": "", + "custom": false + }, + { + "name": "KEY_DOWN", + "typ": "i32", + "value": "264", + "description": "", + "custom": false + }, + { + "name": "KEY_UP", + "typ": "i32", + "value": "265", + "description": "", + "custom": false + }, + { + "name": "KEY_BACKSPACE", + "typ": "i32", + "value": "259", + "description": "", + "custom": false + }, + { + "name": "KEY_ENTER", + "typ": "i32", + "value": "257", + "description": "", + "custom": false + }, + { + "name": "MOUSE_LEFT_BUTTON", + "typ": "i32", + "value": "0", + "description": "", + "custom": false + }, + { + "name": "RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT", + "typ": "i32", + "value": "24", + "description": "", + "custom": false + }, + { + "name": "RAYGUI_GROUPBOX_LINE_THICK", + "typ": "i32", + "value": "1", + "description": "", + "custom": false + }, + { + "name": "RAYGUI_LINE_MARGIN_TEXT", + "typ": "i32", + "value": "12", + "description": "", + "custom": false + }, + { + "name": "RAYGUI_LINE_TEXT_PADDING", + "typ": "i32", + "value": "4", + "description": "", + "custom": false + }, + { + "name": "RAYGUI_PANEL_BORDER_WIDTH", + "typ": "i32", + "value": "1", + "description": "", + "custom": false + }, + { + "name": "RAYGUI_TABBAR_ITEM_WIDTH", + "typ": "i32", + "value": "160", + "description": "", + "custom": false + }, + { + "name": "RAYGUI_MIN_SCROLLBAR_WIDTH", + "typ": "i32", + "value": "40", + "description": "", + "custom": false + }, + { + "name": "RAYGUI_MIN_SCROLLBAR_HEIGHT", + "typ": "i32", + "value": "40", + "description": "", + "custom": false + }, + { + "name": "RAYGUI_TOGGLEGROUP_MAX_ITEMS", + "typ": "i32", + "value": "32", + "description": "", + "custom": false + }, + { + "name": "RAYGUI_TEXTBOX_AUTO_CURSOR_COOLDOWN", + "typ": "i32", + "value": "40", + "description": "Frames to wait for autocursor movement", + "custom": false + }, + { + "name": "RAYGUI_TEXTBOX_AUTO_CURSOR_DELAY", + "typ": "i32", + "value": "1", + "description": "Frames delay for autocursor movement", + "custom": false + }, + { + "name": "RAYGUI_VALUEBOX_MAX_CHARS", + "typ": "i32", + "value": "32", + "description": "", + "custom": false + }, + { + "name": "RAYGUI_COLORBARALPHA_CHECKED_SIZE", + "typ": "i32", + "value": "10", + "description": "", + "custom": false + }, + { + "name": "RAYGUI_MESSAGEBOX_BUTTON_HEIGHT", + "typ": "i32", + "value": "24", + "description": "", + "custom": false + }, + { + "name": "RAYGUI_MESSAGEBOX_BUTTON_PADDING", + "typ": "i32", + "value": "12", + "description": "", + "custom": false + }, + { + "name": "RAYGUI_TEXTINPUTBOX_BUTTON_HEIGHT", + "typ": "i32", + "value": "24", + "description": "", + "custom": false + }, + { + "name": "RAYGUI_TEXTINPUTBOX_BUTTON_PADDING", + "typ": "i32", + "value": "12", + "description": "", + "custom": false + }, + { + "name": "RAYGUI_TEXTINPUTBOX_HEIGHT", + "typ": "i32", + "value": "26", + "description": "", + "custom": false + }, + { + "name": "RAYGUI_GRID_ALPHA", + "typ": "f32", + "value": "0.15", + "description": "", + "custom": false + }, + { + "name": "MAX_LINE_BUFFER_SIZE", + "typ": "i32", + "value": "256", + "description": "", + "custom": false + }, + { + "name": "ICON_TEXT_PADDING", + "typ": "i32", + "value": "4", + "description": "", + "custom": false + }, + { + "name": "RAYGUI_MAX_TEXT_LINES", + "typ": "i32", + "value": "128", + "description": "", + "custom": false + }, + { + "name": "RAYGUI_TEXTSPLIT_MAX_ITEMS", + "typ": "i32", + "value": "128", + "description": "", + "custom": false + }, + { + "name": "RAYGUI_TEXTSPLIT_MAX_TEXT_SIZE", + "typ": "i32", + "value": "1024", + "description": "", + "custom": false + }, + { + "name": "RAYGUI_TEXTFORMAT_MAX_SIZE", + "typ": "i32", + "value": "256", + "description": "", + "custom": false + } + ] +} \ No newline at end of file diff --git a/libs/raygui/build.zig b/libs/raygui/build.zig new file mode 100644 index 0000000..2f53259 --- /dev/null +++ b/libs/raygui/build.zig @@ -0,0 +1,87 @@ +const std = @import("std"); +const generate = @import("generate.zig"); + +const rayguiSrc = "raygui/src/"; + +pub fn build(b: *std.Build) !void { + const target = b.standardTargetOptions(.{}); + + //--- parse raygui and generate JSONs for all signatures -------------------------------------- + const jsons = b.step("parse", "parse raygui headers and generate raylib parser output as json"); + const raylib_parser_build = b.addExecutable(.{ + .name = "raylib_parser", + .root_source_file = std.build.FileSource.relative("raylib_parser.zig"), + .target = target, + .optimize = .ReleaseFast, + }); + raylib_parser_build.addCSourceFile(.{ .file = .{ .path = "../raylib/raylib/parser/raylib_parser.c" }, .flags = &.{} }); + raylib_parser_build.linkLibC(); + + //raygui + const raygui_H = b.addRunArtifact(raylib_parser_build); + raygui_H.addArgs(&.{ + "-i", "raygui/src/raygui.h", + "-o", "raygui.json", + "-f", "JSON", + "-d", "RAYGUIAPI", + }); + jsons.dependOn(&raygui_H.step); + + //--- Generate intermediate ------------------------------------------------------------------- + const intermediate = b.step("intermediate", "generate intermediate representation of the results from 'zig build parse' (keep custom=true)"); + var intermediateZig = b.addRunArtifact(b.addExecutable(.{ + .name = "intermediate", + .root_source_file = std.build.FileSource.relative("intermediate.zig"), + .target = target, + })); + intermediate.dependOn(&intermediateZig.step); + + //--- Generate bindings ----------------------------------------------------------------------- + const bindings = b.step("bindings", "generate bindings in from bindings.json"); + var generateZig = b.addRunArtifact(b.addExecutable(.{ + .name = "generate", + .root_source_file = std.build.FileSource.relative("generate.zig"), + .target = target, + })); + const fmt = b.addFmt(.{ .paths = &.{generate.outputFile} }); + fmt.step.dependOn(&generateZig.step); + bindings.dependOn(&fmt.step); + + //--- just build raylib_parser.exe ------------------------------------------------------------ + const raylib_parser_install = b.step("raylib_parser", "build ./zig-out/bin/raylib_parser.exe"); + const generateBindings_install = b.addInstallArtifact(raylib_parser_build, .{}); + raylib_parser_install.dependOn(&generateBindings_install.step); +} + +// above: generate library +// below: linking (use as dependency) + +fn current_file() []const u8 { + return @src().file; +} + +const cwd = std.fs.path.dirname(current_file()).?; +const sep = std.fs.path.sep_str; +const dir_raygui = cwd ++ sep ++ "raygui/src"; + +/// add this package to lib +pub fn addTo(b: *std.Build, lib: *std.build.LibExeObjStep, target: std.zig.CrossTarget, optimize: std.builtin.Mode) void { + _ = b; + _ = optimize; + _ = target; + + if (lib.modules.get("raylib") orelse lib.modules.get("raylib.zig") orelse lib.modules.get("raylib-zig")) |raylib| { + lib.addAnonymousModule("raygui", .{ + .source_file = .{ .path = cwd ++ sep ++ "raygui.zig" }, + .dependencies = &.{ + .{ .name = "raylib", .module = raylib }, + }, + }); + lib.addIncludePath(.{ .path = dir_raygui }); + lib.addIncludePath(.{ .path = cwd }); + lib.linkLibC(); + lib.addCSourceFile(.{ .file = .{ .path = cwd ++ sep ++ "raygui_marshal.c" }, .flags = &.{"-DRAYGUI_IMPLEMENTATION"} }); + } else { + std.debug.panic("lib needs to have 'raylib', 'raylib.zig' or 'raylib-zig' as module dependency", .{}); + } +} diff --git a/libs/raygui/generate.zig b/libs/raygui/generate.zig new file mode 100644 index 0000000..fa044f0 --- /dev/null +++ b/libs/raygui/generate.zig @@ -0,0 +1,528 @@ +const std = @import("std"); +const fs = std.fs; +const json = std.json; +const allocPrint = std.fmt.allocPrint; +const mapping = @import("type_mapping.zig"); +const intermediate = @import("intermediate.zig"); + +pub const outputFile = "raygui.zig"; +pub const injectFile = "inject.zig"; +pub const marshalFilePrefix = "raygui_marshal"; + +fn trim(s: []const u8) []const u8 { + return std.mem.trim(u8, s, &[_]u8{ ' ', '\t', '\n' }); +} + +pub fn main() !void { + std.log.info("generating raygui.zig ...", .{}); + var gpa = std.heap.GeneralPurposeAllocator(.{}){}; + defer { + if (gpa.deinit() == .leak) { + std.log.err("memory leak detected", .{}); + } + } + const allocator = gpa.allocator(); + var arena = std.heap.ArenaAllocator.init(allocator); + defer arena.deinit(); + + const bindingsData = try fs.cwd().readFileAlloc(arena.allocator(), intermediate.bindingsJSON, std.math.maxInt(usize)); + + const bindings = try json.parseFromSliceLeaky(mapping.Intermediate, arena.allocator(), bindingsData, .{ + .ignore_unknown_fields = true, + }); + + var file = try fs.cwd().createFile(outputFile, .{}); + defer file.close(); + + try file.writeAll("\n\n"); + + const inject = try Injections.load(arena.allocator()); + try writeInjections(arena.allocator(), &file, inject); + + try writeFunctions(arena.allocator(), &file, bindings, inject); + var h = try fs.cwd().createFile(marshalFilePrefix ++ ".h", .{}); + defer h.close(); + var c = try fs.cwd().createFile(marshalFilePrefix ++ ".c", .{}); + defer c.close(); + const raylib: mapping.CombinedRaylib = try mapping.CombinedRaylib.load(arena.allocator(), intermediate.jsonFiles); + try writeCFunctions(arena.allocator(), &h, &c, inject, raylib); + + try writeStructs(arena.allocator(), &file, bindings, inject); + try writeEnums(arena.allocator(), &file, bindings, inject); + try writeDefines(arena.allocator(), &file, bindings, inject); + + std.log.info("... done", .{}); +} + +const Injections = struct { + lines: []const []const u8, + symbols: []const []const u8, + + pub fn load(allocator: std.mem.Allocator) !@This() { + var injectZigLines = std.ArrayList([]const u8).init(allocator); + var symbols = std.ArrayList([]const u8).init(allocator); + + var file = try fs.cwd().openFile(injectFile, .{}); + var reader = file.reader(); + while (try reader.readUntilDelimiterOrEofAlloc(allocator, '\n', std.math.maxInt(usize))) |line| { + if (std.mem.indexOf(u8, line, "pub const ")) |startIndex| { + if (std.mem.indexOf(u8, line, " = extern struct {")) |endIndex| { + const s = line["pub const ".len + startIndex .. endIndex]; + try symbols.append(s); + std.log.debug("inject symbol: {s}", .{s}); + } else if (std.mem.indexOf(u8, line, " = raylib.")) |endIndex| { + const s = line["pub const ".len + startIndex .. endIndex]; + try symbols.append(s); + std.log.debug("inject symbol: {s}", .{s}); + } + } + if (std.mem.indexOf(u8, line, "pub fn ")) |startIndex| { + if (std.mem.indexOf(u8, line, "(")) |endIndex| { + const s = line["pub fn ".len + startIndex .. endIndex]; + try symbols.append(s); + std.log.debug("inject symbol: {s}", .{s}); + } + } + try injectZigLines.append(line); + } + + return @This(){ + .lines = try injectZigLines.toOwnedSlice(), + .symbols = try symbols.toOwnedSlice(), + }; + } + + pub fn containsSymbol(self: @This(), name: []const u8) bool { + for (self.symbols) |s| { + if (eql(s, name)) return true; + } + return false; + } +}; + +fn writeFunctions( + allocator: std.mem.Allocator, + file: *fs.File, + bindings: mapping.Intermediate, + inject: Injections, +) !void { + var buf: [51200]u8 = undefined; + var fba = std.heap.FixedBufferAllocator.init(&buf); + + for (bindings.functions) |func| { + if (inject.containsSymbol(func.name)) continue; + defer fba.reset(); + + //--- signature ------------------------- + const funcDescription: []const u8 = func.description orelse ""; + try file.writeAll( + try allocPrint( + allocator, + "\n/// {s}\npub fn {s} (\n", + .{ funcDescription, func.name }, + ), + ); + + for (func.params) |param| { + if (param.description) |description| { + try file.writeAll(try allocPrint( + allocator, + "/// {s}\n", + .{description}, + )); + } + try file.writeAll(try allocPrint( + allocator, + "{s}: {s},\n", + .{ param.name, param.typ }, + )); + } + + if (func.custom) { + try file.writeAll( + try allocPrint( + allocator, + ") {s} {{\n", + .{func.returnType}, + ), + ); + } else if (isPointer(func.returnType)) { + if (eql("u8", (stripType(func.returnType)))) { + try file.writeAll( + try allocPrint( + allocator, + ") [*:0]const {s} {{\n", + .{stripType(func.returnType)}, + ), + ); + } else { + try file.writeAll( + try allocPrint( + allocator, + ") {s} {{\n", + .{func.returnType}, + ), + ); + } + } else { + try file.writeAll( + try allocPrint( + allocator, + ") {s} {{\n", + .{func.returnType}, + ), + ); + } + const returnTypeIsVoid = eql(func.returnType, "void"); + + //--- body ------------------------------ + if (isPointer(func.returnType)) { + try file.writeAll(try allocPrint(allocator, "return @ptrCast({s},\n", .{func.returnType})); + } else if (isPrimitiveOrPointer(func.returnType)) { + try file.writeAll("return "); + } else if (!returnTypeIsVoid) { + try file.writeAll(try allocPrint(allocator, "var out: {s} = undefined;\n", .{func.returnType})); + } + try file.writeAll(try allocPrint(allocator, "raygui.m{s}(\n", .{func.name})); + + if (!isPrimitiveOrPointer(func.returnType)) { + if (bindings.containsStruct(stripType(func.returnType))) { + try file.writeAll(try allocPrint(allocator, "@ptrCast([*c]raygui.{s}, &out),\n", .{func.returnType})); + } else if (!returnTypeIsVoid) { + try file.writeAll(try allocPrint(allocator, "@ptrCast([*c]{s}, &out),\n", .{func.returnType})); + } + } + + for (func.params) |param| { + if (isFunctionPointer(param.typ)) { + try file.writeAll(try allocPrint(allocator, "@ptrCast({s}),\n", .{param.name})); + } else if (bindings.containsStruct(stripType(param.typ)) and isPointer(param.typ)) { + try file.writeAll(try allocPrint(allocator, "@intToPtr([*c]raygui.{s}, @ptrToInt({s})),\n", .{ stripType(param.typ), param.name })); + } else if (bindings.containsEnum(param.typ)) { + try file.writeAll(try allocPrint(allocator, "@enumToInt({s}),\n", .{param.name})); + } else if (bindings.containsStruct(stripType(param.typ))) { + try file.writeAll(try allocPrint(allocator, "@intToPtr([*c]raygui.{s}, @ptrToInt(&{s})),\n", .{ stripType(param.typ), param.name })); + } else if (isPointer(param.typ)) { + if (isConst(param.typ)) { + try file.writeAll(try allocPrint(allocator, "@intToPtr([*c]const {s}, @ptrToInt({s})),\n", .{ stripType(param.typ), param.name })); + } else { + try file.writeAll(try allocPrint(allocator, "@ptrCast([*c]{s}, {s}),\n", .{ stripType(param.typ), param.name })); + } + } else { + try file.writeAll(try allocPrint(allocator, "{s},\n", .{param.name})); + } + } + + if (isPointer(func.returnType)) { + try file.writeAll("),\n);\n"); + } else { + try file.writeAll(");\n"); + } + + if (!isPrimitiveOrPointer(func.returnType) and !returnTypeIsVoid) { + try file.writeAll("return out;\n"); + } + + try file.writeAll("}\n"); + } + + std.log.info("generated functions", .{}); +} + +/// write: RETURN NAME(PARAMS...) +/// or: void NAME(RETURN*, PARAMS...) +fn writeCSignature( + allocator: std.mem.Allocator, + file: *fs.File, + func: mapping.RaylibFunction, +) !void { + const returnType = func.returnType; + + //return directly + if (mapping.isPrimitiveOrPointer(returnType)) { + try file.writeAll(try allocPrint(allocator, "{s} m{s}(", .{ returnType, func.name })); + if (func.params == null or func.params.?.len == 0) { + try file.writeAll("void"); + } + } + //wrap return type and put as first function parameter + else { + try file.writeAll(try allocPrint(allocator, "void m{s}({s} *out", .{ func.name, returnType })); + if (func.params != null and func.params.?.len > 0) { + try file.writeAll(", "); + } + } + + if (func.params) |params| { + for (params, 0..) |param, i| { + const paramType = param.type; + if (mapping.isPrimitiveOrPointer(paramType) or isFunctionPointer(paramType)) { + try file.writeAll(try allocPrint(allocator, "{s} {s}", .{ paramType, param.name })); + } else { + try file.writeAll(try allocPrint(allocator, "{s} *{s}", .{ paramType, param.name })); + } + + if (i < params.len - 1) { + try file.writeAll(", "); + } + } + } + + try file.writeAll(")"); +} + +fn writeCFunctions( + allocator: std.mem.Allocator, + h: *fs.File, + c: *fs.File, + inject: Injections, + rl: mapping.CombinedRaylib, +) !void { + var hInject = try fs.cwd().openFile("inject.h", .{}); + defer hInject.close(); + try h.writeFileAll(hInject, .{}); + var cInject = try fs.cwd().openFile("inject.c", .{}); + defer cInject.close(); + try c.writeFileAll(cInject, .{}); + + for (rl.functions.values()) |func| { + if (inject.containsSymbol(func.name)) continue; + + //--- C-HEADER ----------------------------- + + try h.writeAll(try allocPrint(allocator, "// {s}\n", .{func.description})); + try writeCSignature(allocator, h, func); + try h.writeAll(";\n\n"); + + try writeCSignature(allocator, c, func); + try c.writeAll("\n{\n"); + + //--- C-IMPLEMENT ----------------------------- + + if (eql(func.returnType, "void")) { + try c.writeAll("\t"); + } else if (mapping.isPrimitiveOrPointer(func.returnType)) { + try c.writeAll("\treturn "); + } else { + try c.writeAll("\t*out = "); + } + + try c.writeAll( + try allocPrint( + allocator, + "{s}(", + .{func.name}, + ), + ); + + if (func.params) |params| { + for (params, 0..) |param, i| { + if (mapping.isPrimitiveOrPointer(param.type) or isFunctionPointer(param.type)) { + try c.writeAll( + try allocPrint( + allocator, + "{s}", + .{param.name}, + ), + ); + } else { + try c.writeAll( + try allocPrint( + allocator, + "*{s}", + .{param.name}, + ), + ); + } + + if (i < params.len - 1) { + try c.writeAll(", "); + } + } + } + + try c.writeAll(");\n}\n\n"); + } +} + +fn writeStructs( + allocator: std.mem.Allocator, + file: *fs.File, + bindings: mapping.Intermediate, + inject: Injections, +) !void { + var buf: [51200]u8 = undefined; + var fba = std.heap.FixedBufferAllocator.init(&buf); + + for (bindings.structs) |s| { + if (inject.containsSymbol(s.name)) continue; + defer fba.reset(); + + try file.writeAll( + try allocPrint( + allocator, + "\n/// {?s}\npub const {s} = extern struct {{\n", + .{ s.description, s.name }, + ), + ); + + for (s.fields) |field| { + try file.writeAll(try allocPrint(allocator, "/// {?s}\n\t{s}: {s},\n", .{ + field.description, + field.name, + field.typ, + })); + } + + try file.writeAll("\n};\n"); + } + + std.log.info("generated structs", .{}); +} + +fn writeEnums( + allocator: std.mem.Allocator, + file: *fs.File, + bindings: mapping.Intermediate, + inject: Injections, +) !void { + var buf: [51200]u8 = undefined; + var fba = std.heap.FixedBufferAllocator.init(&buf); + + for (bindings.enums) |e| { + if (inject.containsSymbol(e.name)) continue; + defer fba.reset(); + + try file.writeAll( + try allocPrint( + allocator, + "\n/// {?s}\npub const {s} = enum(i32) {{\n", + .{ e.description, e.name }, + ), + ); + + for (e.values) |value| { + try file.writeAll(try allocPrint(allocator, "/// {?s}\n{s} = {d},\n", .{ + value.description, + value.name, + value.value, + })); + } + + try file.writeAll("\n};\n"); + } + + std.log.info("generated enums", .{}); +} + +fn writeDefines( + allocator: std.mem.Allocator, + file: *fs.File, + bindings: mapping.Intermediate, + inject: Injections, +) !void { + var buf: [51200]u8 = undefined; + var fba = std.heap.FixedBufferAllocator.init(&buf); + + for (bindings.defines) |d| { + if (inject.containsSymbol(d.name)) continue; + defer fba.reset(); + + try file.writeAll( + try allocPrint( + allocator, + "\n/// {?s}\npub const {s}: {s} = {s};\n", + .{ d.description, d.name, d.typ, d.value }, + ), + ); + } + + std.log.info("generated defines", .{}); +} + +fn writeInjections( + _: std.mem.Allocator, + file: *fs.File, + inject: Injections, +) !void { + var buf: [51200]u8 = undefined; + var fba = std.heap.FixedBufferAllocator.init(&buf); + + for (inject.lines) |line| { + defer fba.reset(); + + try file.writeAll(try allocPrint(fba.allocator(), "{s}\n", .{line})); + } + + std.log.info("written inject.zig", .{}); +} + +fn eql(a: []const u8, b: []const u8) bool { + return std.mem.eql(u8, a, b); +} + +fn startsWith(haystack: []const u8, needle: []const u8) bool { + return std.mem.startsWith(u8, haystack, needle); +} + +fn endsWith(haystack: []const u8, needle: []const u8) bool { + return std.mem.endsWith(u8, haystack, needle); +} + +/// is c pointer type +fn isPointer(z: []const u8) bool { + return pointerOffset(z) > 0; +} + +fn isFunctionPointer(z: []const u8) bool { + return std.mem.indexOf(u8, z, "fn(") != null or std.mem.endsWith(u8, z, "Callback"); +} + +fn pointerOffset(z: []const u8) usize { + if (startsWith(z, "*")) return 1; + if (startsWith(z, "?*")) return 2; + if (startsWith(z, "[*]")) return 3; + if (startsWith(z, "?[*]")) return 4; + if (startsWith(z, "[*c]")) return 4; + if (startsWith(z, "[*:0]")) return 5; + if (startsWith(z, "?[*:0]")) return 6; + + return 0; +} + +fn isConst(z: []const u8) bool { + return startsWith(z[pointerOffset(z)..], "const "); +} + +fn isVoid(z: []const u8) bool { + return eql(stripType(z), "void"); +} + +/// strips const and pointer annotations +/// *const TName -> TName +fn stripType(z: []const u8) []const u8 { + var name = z[pointerOffset(z)..]; + name = if (startsWith(name, "const ")) name["const ".len..] else name; + + return std.mem.trim(u8, name, " \t\n"); +} + +/// true if Zig type is primitive or a pointer to anything +/// this means we don't need to wrap it in a pointer +pub fn isPrimitiveOrPointer(z: []const u8) bool { + const primitiveTypes = std.ComptimeStringMap(void, .{ + // .{ "void", {} }, // zig void is zero sized while C void is >= 1 byte + .{ "bool", {} }, + .{ "u8", {} }, + .{ "i8", {} }, + .{ "i16", {} }, + .{ "u16", {} }, + .{ "i32", {} }, + .{ "u32", {} }, + .{ "i64", {} }, + .{ "u64", {} }, + .{ "f32", {} }, + .{ "f64", {} }, + }); + return primitiveTypes.has(stripType(z)) or pointerOffset(z) > 0; +} diff --git a/libs/raygui/gui_icons.h b/libs/raygui/gui_icons.h new file mode 100644 index 0000000..d8a9e45 --- /dev/null +++ b/libs/raygui/gui_icons.h @@ -0,0 +1,547 @@ +////////////////////////////////////////////////////////////////////////////////// +// // +// raygui Icons exporter v1.1 - Icons data exported as a values array // +// // +// more info and bugs-report: github.com/raysan5/raygui // +// feedback and support: ray[at]raylibtech.com // +// // +// Copyright (c) 2019-2021 raylib technologies (@raylibtech) // +// // +////////////////////////////////////////////////////////////////////////////////// + +//---------------------------------------------------------------------------------- +// Defines and Macros +//---------------------------------------------------------------------------------- +#define RAYGUI_ICON_SIZE 16 // Size of icons (squared) +#define RAYGUI_ICON_MAX_ICONS 256 // Maximum number of icons +#define RAYGUI_ICON_MAX_NAME_LENGTH 32 // Maximum length of icon name id + +// Icons data is defined by bit array (every bit represents one pixel) +// Those arrays are stored as unsigned int data arrays, so every array +// element defines 32 pixels (bits) of information +// Number of elemens depend on RAYGUI_ICON_SIZE (by default 16x16 pixels) +#define RAYGUI_ICON_DATA_ELEMENTS (RAYGUI_ICON_SIZE*RAYGUI_ICON_SIZE/32) + +//---------------------------------------------------------------------------------- +// Icons enumeration +//---------------------------------------------------------------------------------- +typedef enum { + RAYGUI_ICON_NONE = 0, + RAYGUI_ICON_FOLDER_FILE_OPEN = 1, + RAYGUI_ICON_FILE_SAVE_CLASSIC = 2, + RAYGUI_ICON_FOLDER_OPEN = 3, + RAYGUI_ICON_FOLDER_SAVE = 4, + RAYGUI_ICON_FILE_OPEN = 5, + RAYGUI_ICON_FILE_SAVE = 6, + RAYGUI_ICON_FILE_EXPORT = 7, + RAYGUI_ICON_FILE_NEW = 8, + RAYGUI_ICON_FILE_DELETE = 9, + RAYGUI_ICON_FILETYPE_TEXT = 10, + RAYGUI_ICON_FILETYPE_AUDIO = 11, + RAYGUI_ICON_FILETYPE_IMAGE = 12, + RAYGUI_ICON_FILETYPE_PLAY = 13, + RAYGUI_ICON_FILETYPE_VIDEO = 14, + RAYGUI_ICON_FILETYPE_INFO = 15, + RAYGUI_ICON_FILE_COPY = 16, + RAYGUI_ICON_FILE_CUT = 17, + RAYGUI_ICON_FILE_PASTE = 18, + RAYGUI_ICON_CURSOR_HAND = 19, + RAYGUI_ICON_CURSOR_POINTER = 20, + RAYGUI_ICON_CURSOR_CLASSIC = 21, + RAYGUI_ICON_PENCIL = 22, + RAYGUI_ICON_PENCIL_BIG = 23, + RAYGUI_ICON_BRUSH_CLASSIC = 24, + RAYGUI_ICON_BRUSH_PAINTER = 25, + RAYGUI_ICON_WATER_DROP = 26, + RAYGUI_ICON_COLOR_PICKER = 27, + RAYGUI_ICON_RUBBER = 28, + RAYGUI_ICON_COLOR_BUCKET = 29, + RAYGUI_ICON_TEXT_T = 30, + RAYGUI_ICON_TEXT_A = 31, + RAYGUI_ICON_SCALE = 32, + RAYGUI_ICON_RESIZE = 33, + RAYGUI_ICON_FILTER_POINT = 34, + RAYGUI_ICON_FILTER_BILINEAR = 35, + RAYGUI_ICON_CROP = 36, + RAYGUI_ICON_CROP_ALPHA = 37, + RAYGUI_ICON_SQUARE_TOGGLE = 38, + RAYGUI_ICON_SIMMETRY = 39, + RAYGUI_ICON_SIMMETRY_HORIZONTAL = 40, + RAYGUI_ICON_SIMMETRY_VERTICAL = 41, + RAYGUI_ICON_LENS = 42, + RAYGUI_ICON_LENS_BIG = 43, + RAYGUI_ICON_EYE_ON = 44, + RAYGUI_ICON_EYE_OFF = 45, + RAYGUI_ICON_FILTER_TOP = 46, + RAYGUI_ICON_FILTER = 47, + RAYGUI_ICON_TARGET_POINT = 48, + RAYGUI_ICON_TARGET_SMALL = 49, + RAYGUI_ICON_TARGET_BIG = 50, + RAYGUI_ICON_TARGET_MOVE = 51, + RAYGUI_ICON_CURSOR_MOVE = 52, + RAYGUI_ICON_CURSOR_SCALE = 53, + RAYGUI_ICON_CURSOR_SCALE_RIGHT = 54, + RAYGUI_ICON_CURSOR_SCALE_LEFT = 55, + RAYGUI_ICON_UNDO = 56, + RAYGUI_ICON_REDO = 57, + RAYGUI_ICON_REREDO = 58, + RAYGUI_ICON_MUTATE = 59, + RAYGUI_ICON_ROTATE = 60, + RAYGUI_ICON_REPEAT = 61, + RAYGUI_ICON_SHUFFLE = 62, + RAYGUI_ICON_EMPTYBOX = 63, + RAYGUI_ICON_TARGET = 64, + RAYGUI_ICON_TARGET_SMALL_FILL = 65, + RAYGUI_ICON_TARGET_BIG_FILL = 66, + RAYGUI_ICON_TARGET_MOVE_FILL = 67, + RAYGUI_ICON_CURSOR_MOVE_FILL = 68, + RAYGUI_ICON_CURSOR_SCALE_FILL = 69, + RAYGUI_ICON_CURSOR_SCALE_RIGHT_FILL = 70, + RAYGUI_ICON_CURSOR_SCALE_LEFT_FILL = 71, + RAYGUI_ICON_UNDO_FILL = 72, + RAYGUI_ICON_REDO_FILL = 73, + RAYGUI_ICON_REREDO_FILL = 74, + RAYGUI_ICON_MUTATE_FILL = 75, + RAYGUI_ICON_ROTATE_FILL = 76, + RAYGUI_ICON_REPEAT_FILL = 77, + RAYGUI_ICON_SHUFFLE_FILL = 78, + RAYGUI_ICON_EMPTYBOX_SMALL = 79, + RAYGUI_ICON_BOX = 80, + RAYGUI_ICON_BOX_TOP = 81, + RAYGUI_ICON_BOX_TOP_RIGHT = 82, + RAYGUI_ICON_BOX_RIGHT = 83, + RAYGUI_ICON_BOX_BOTTOM_RIGHT = 84, + RAYGUI_ICON_BOX_BOTTOM = 85, + RAYGUI_ICON_BOX_BOTTOM_LEFT = 86, + RAYGUI_ICON_BOX_LEFT = 87, + RAYGUI_ICON_BOX_TOP_LEFT = 88, + RAYGUI_ICON_BOX_CENTER = 89, + RAYGUI_ICON_BOX_CIRCLE_MASK = 90, + RAYGUI_ICON_POT = 91, + RAYGUI_ICON_ALPHA_MULTIPLY = 92, + RAYGUI_ICON_ALPHA_CLEAR = 93, + RAYGUI_ICON_DITHERING = 94, + RAYGUI_ICON_MIPMAPS = 95, + RAYGUI_ICON_BOX_GRID = 96, + RAYGUI_ICON_GRID = 97, + RAYGUI_ICON_BOX_CORNERS_SMALL = 98, + RAYGUI_ICON_BOX_CORNERS_BIG = 99, + RAYGUI_ICON_FOUR_BOXES = 100, + RAYGUI_ICON_GRID_FILL = 101, + RAYGUI_ICON_BOX_MULTISIZE = 102, + RAYGUI_ICON_ZOOM_SMALL = 103, + RAYGUI_ICON_ZOOM_MEDIUM = 104, + RAYGUI_ICON_ZOOM_BIG = 105, + RAYGUI_ICON_ZOOM_ALL = 106, + RAYGUI_ICON_ZOOM_CENTER = 107, + RAYGUI_ICON_BOX_DOTS_SMALL = 108, + RAYGUI_ICON_BOX_DOTS_BIG = 109, + RAYGUI_ICON_BOX_CONCENTRIC = 110, + RAYGUI_ICON_BOX_GRID_BIG = 111, + RAYGUI_ICON_OK_TICK = 112, + RAYGUI_ICON_CROSS = 113, + RAYGUI_ICON_ARROW_LEFT = 114, + RAYGUI_ICON_ARROW_RIGHT = 115, + RAYGUI_ICON_ARROW_BOTTOM = 116, + RAYGUI_ICON_ARROW_TOP = 117, + RAYGUI_ICON_ARROW_LEFT_FILL = 118, + RAYGUI_ICON_ARROW_RIGHT_FILL = 119, + RAYGUI_ICON_ARROW_BOTTOM_FILL = 120, + RAYGUI_ICON_ARROW_TOP_FILL = 121, + RAYGUI_ICON_AUDIO = 122, + RAYGUI_ICON_FX = 123, + RAYGUI_ICON_WAVE = 124, + RAYGUI_ICON_WAVE_SINUS = 125, + RAYGUI_ICON_WAVE_SQUARE = 126, + RAYGUI_ICON_WAVE_TRIANGULAR = 127, + RAYGUI_ICON_CROSS_SMALL = 128, + RAYGUI_ICON_PLAYER_PREVIOUS = 129, + RAYGUI_ICON_PLAYER_PLAY_BACK = 130, + RAYGUI_ICON_PLAYER_PLAY = 131, + RAYGUI_ICON_PLAYER_PAUSE = 132, + RAYGUI_ICON_PLAYER_STOP = 133, + RAYGUI_ICON_PLAYER_NEXT = 134, + RAYGUI_ICON_PLAYER_RECORD = 135, + RAYGUI_ICON_MAGNET = 136, + RAYGUI_ICON_LOCK_CLOSE = 137, + RAYGUI_ICON_LOCK_OPEN = 138, + RAYGUI_ICON_CLOCK = 139, + RAYGUI_ICON_TOOLS = 140, + RAYGUI_ICON_GEAR = 141, + RAYGUI_ICON_GEAR_BIG = 142, + RAYGUI_ICON_BIN = 143, + RAYGUI_ICON_HAND_POINTER = 144, + RAYGUI_ICON_LASER = 145, + RAYGUI_ICON_COIN = 146, + RAYGUI_ICON_EXPLOSION = 147, + RAYGUI_ICON_1UP = 148, + RAYGUI_ICON_PLAYER = 149, + RAYGUI_ICON_PLAYER_JUMP = 150, + RAYGUI_ICON_KEY = 151, + RAYGUI_ICON_DEMON = 152, + RAYGUI_ICON_TEXT_POPUP = 153, + RAYGUI_ICON_GEAR_EX = 154, + RAYGUI_ICON_CRACK = 155, + RAYGUI_ICON_CRACK_POINTS = 156, + RAYGUI_ICON_STAR = 157, + RAYGUI_ICON_DOOR = 158, + RAYGUI_ICON_EXIT = 159, + RAYGUI_ICON_MODE_2D = 160, + RAYGUI_ICON_MODE_3D = 161, + RAYGUI_ICON_CUBE = 162, + RAYGUI_ICON_CUBE_FACE_TOP = 163, + RAYGUI_ICON_CUBE_FACE_LEFT = 164, + RAYGUI_ICON_CUBE_FACE_FRONT = 165, + RAYGUI_ICON_CUBE_FACE_BOTTOM = 166, + RAYGUI_ICON_CUBE_FACE_RIGHT = 167, + RAYGUI_ICON_CUBE_FACE_BACK = 168, + RAYGUI_ICON_CAMERA = 169, + RAYGUI_ICON_SPECIAL = 170, + RAYGUI_ICON_LINK_NET = 171, + RAYGUI_ICON_LINK_BOXES = 172, + RAYGUI_ICON_LINK_MULTI = 173, + RAYGUI_ICON_LINK = 174, + RAYGUI_ICON_LINK_BROKE = 175, + RAYGUI_ICON_TEXT_NOTES = 176, + RAYGUI_ICON_NOTEBOOK = 177, + RAYGUI_ICON_SUITCASE = 178, + RAYGUI_ICON_SUITCASE_ZIP = 179, + RAYGUI_ICON_MAILBOX = 180, + RAYGUI_ICON_MONITOR = 181, + RAYGUI_ICON_PRINTER = 182, + RAYGUI_ICON_PHOTO_CAMERA = 183, + RAYGUI_ICON_PHOTO_CAMERA_FLASH = 184, + RAYGUI_ICON_HOUSE = 185, + RAYGUI_ICON_HEART = 186, + RAYGUI_ICON_CORNER = 187, + RAYGUI_ICON_VERTICAL_BARS = 188, + RAYGUI_ICON_VERTICAL_BARS_FILL = 189, + RAYGUI_ICON_LIFE_BARS = 190, + RAYGUI_ICON_INFO = 191, + RAYGUI_ICON_CROSSLINE = 192, + RAYGUI_ICON_HELP = 193, + RAYGUI_ICON_FILETYPE_ALPHA = 194, + RAYGUI_ICON_FILETYPE_HOME = 195, + RAYGUI_ICON_LAYERS_VISIBLE = 196, + RAYGUI_ICON_LAYERS = 197, + RAYGUI_ICON_WINDOW = 198, + RAYGUI_ICON_199 = 199, + RAYGUI_ICON_200 = 200, + RAYGUI_ICON_201 = 201, + RAYGUI_ICON_202 = 202, + RAYGUI_ICON_203 = 203, + RAYGUI_ICON_204 = 204, + RAYGUI_ICON_205 = 205, + RAYGUI_ICON_206 = 206, + RAYGUI_ICON_207 = 207, + RAYGUI_ICON_208 = 208, + RAYGUI_ICON_209 = 209, + RAYGUI_ICON_210 = 210, + RAYGUI_ICON_211 = 211, + RAYGUI_ICON_212 = 212, + RAYGUI_ICON_213 = 213, + RAYGUI_ICON_214 = 214, + RAYGUI_ICON_215 = 215, + RAYGUI_ICON_216 = 216, + RAYGUI_ICON_217 = 217, + RAYGUI_ICON_218 = 218, + RAYGUI_ICON_219 = 219, + RAYGUI_ICON_220 = 220, + RAYGUI_ICON_221 = 221, + RAYGUI_ICON_222 = 222, + RAYGUI_ICON_223 = 223, + RAYGUI_ICON_224 = 224, + RAYGUI_ICON_225 = 225, + RAYGUI_ICON_226 = 226, + RAYGUI_ICON_227 = 227, + RAYGUI_ICON_228 = 228, + RAYGUI_ICON_229 = 229, + RAYGUI_ICON_230 = 230, + RAYGUI_ICON_231 = 231, + RAYGUI_ICON_232 = 232, + RAYGUI_ICON_233 = 233, + RAYGUI_ICON_234 = 234, + RAYGUI_ICON_235 = 235, + RAYGUI_ICON_236 = 236, + RAYGUI_ICON_237 = 237, + RAYGUI_ICON_238 = 238, + RAYGUI_ICON_239 = 239, + RAYGUI_ICON_240 = 240, + RAYGUI_ICON_241 = 241, + RAYGUI_ICON_242 = 242, + RAYGUI_ICON_243 = 243, + RAYGUI_ICON_244 = 244, + RAYGUI_ICON_245 = 245, + RAYGUI_ICON_246 = 246, + RAYGUI_ICON_247 = 247, + RAYGUI_ICON_248 = 248, + RAYGUI_ICON_249 = 249, + RAYGUI_ICON_250 = 250, + RAYGUI_ICON_251 = 251, + RAYGUI_ICON_252 = 252, + RAYGUI_ICON_253 = 253, + RAYGUI_ICON_254 = 254, + RAYGUI_ICON_255 = 255, +} guiIconName; + +//---------------------------------------------------------------------------------- +// Icons data +//---------------------------------------------------------------------------------- +static unsigned int guiIcons[RAYGUI_ICON_MAX_ICONS*RAYGUI_ICON_DATA_ELEMENTS] = { + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_NONE + 0x3ff80000, 0x2f082008, 0x2042207e, 0x40027fc2, 0x40024002, 0x40024002, 0x40024002, 0x00007ffe, // RAYGUI_ICON_FOLDER_FILE_OPEN + 0x3ffe0000, 0x44226422, 0x400247e2, 0x5ffa4002, 0x57ea500a, 0x500a500a, 0x40025ffa, 0x00007ffe, // RAYGUI_ICON_FILE_SAVE_CLASSIC + 0x00000000, 0x0042007e, 0x40027fc2, 0x40024002, 0x41024002, 0x44424282, 0x793e4102, 0x00000100, // RAYGUI_ICON_FOLDER_OPEN + 0x00000000, 0x0042007e, 0x40027fc2, 0x40024002, 0x41024102, 0x44424102, 0x793e4282, 0x00000000, // RAYGUI_ICON_FOLDER_SAVE + 0x3ff00000, 0x201c2010, 0x20042004, 0x21042004, 0x24442284, 0x21042104, 0x20042104, 0x00003ffc, // RAYGUI_ICON_FILE_OPEN + 0x3ff00000, 0x201c2010, 0x20042004, 0x21042004, 0x21042104, 0x22842444, 0x20042104, 0x00003ffc, // RAYGUI_ICON_FILE_SAVE + 0x3ff00000, 0x201c2010, 0x00042004, 0x20041004, 0x20844784, 0x00841384, 0x20042784, 0x00003ffc, // RAYGUI_ICON_FILE_EXPORT + 0x3ff00000, 0x201c2010, 0x20042004, 0x20042004, 0x22042204, 0x22042f84, 0x20042204, 0x00003ffc, // RAYGUI_ICON_FILE_NEW + 0x3ff00000, 0x201c2010, 0x20042004, 0x20042004, 0x25042884, 0x25042204, 0x20042884, 0x00003ffc, // RAYGUI_ICON_FILE_DELETE + 0x3ff00000, 0x201c2010, 0x20042004, 0x20042ff4, 0x20042ff4, 0x20042ff4, 0x20042004, 0x00003ffc, // RAYGUI_ICON_FILETYPE_TEXT + 0x3ff00000, 0x201c2010, 0x27042004, 0x244424c4, 0x26442444, 0x20642664, 0x20042004, 0x00003ffc, // RAYGUI_ICON_FILETYPE_AUDIO + 0x3ff00000, 0x201c2010, 0x26042604, 0x20042004, 0x35442884, 0x2414222c, 0x20042004, 0x00003ffc, // RAYGUI_ICON_FILETYPE_IMAGE + 0x3ff00000, 0x201c2010, 0x20c42004, 0x22442144, 0x22442444, 0x20c42144, 0x20042004, 0x00003ffc, // RAYGUI_ICON_FILETYPE_PLAY + 0x3ff00000, 0x3ffc2ff0, 0x3f3c2ff4, 0x3dbc2eb4, 0x3dbc2bb4, 0x3f3c2eb4, 0x3ffc2ff4, 0x00002ff4, // RAYGUI_ICON_FILETYPE_VIDEO + 0x3ff00000, 0x201c2010, 0x21842184, 0x21842004, 0x21842184, 0x21842184, 0x20042184, 0x00003ffc, // RAYGUI_ICON_FILETYPE_INFO + 0x0ff00000, 0x381c0810, 0x28042804, 0x28042804, 0x28042804, 0x28042804, 0x20102ffc, 0x00003ff0, // RAYGUI_ICON_FILE_COPY + 0x00000000, 0x701c0000, 0x079c1e14, 0x55a000f0, 0x079c00f0, 0x701c1e14, 0x00000000, 0x00000000, // RAYGUI_ICON_FILE_CUT + 0x01c00000, 0x13e41bec, 0x3f841004, 0x204420c4, 0x20442044, 0x20442044, 0x207c2044, 0x00003fc0, // RAYGUI_ICON_FILE_PASTE + 0x00000000, 0x3aa00fe0, 0x2abc2aa0, 0x2aa42aa4, 0x20042aa4, 0x20042004, 0x3ffc2004, 0x00000000, // RAYGUI_ICON_CURSOR_HAND + 0x00000000, 0x003c000c, 0x030800c8, 0x30100c10, 0x10202020, 0x04400840, 0x01800280, 0x00000000, // RAYGUI_ICON_CURSOR_POINTER + 0x00000000, 0x00180000, 0x01f00078, 0x03e007f0, 0x07c003e0, 0x04000e40, 0x00000000, 0x00000000, // RAYGUI_ICON_CURSOR_CLASSIC + 0x00000000, 0x04000000, 0x11000a00, 0x04400a80, 0x01100220, 0x00580088, 0x00000038, 0x00000000, // RAYGUI_ICON_PENCIL + 0x04000000, 0x15000a00, 0x50402880, 0x14102820, 0x05040a08, 0x015c028c, 0x007c00bc, 0x00000000, // RAYGUI_ICON_PENCIL_BIG + 0x01c00000, 0x01400140, 0x01400140, 0x0ff80140, 0x0ff80808, 0x0aa80808, 0x0aa80aa8, 0x00000ff8, // RAYGUI_ICON_BRUSH_CLASSIC + 0x1ffc0000, 0x5ffc7ffe, 0x40004000, 0x00807f80, 0x01c001c0, 0x01c001c0, 0x01c001c0, 0x00000080, // RAYGUI_ICON_BRUSH_PAINTER + 0x00000000, 0x00800000, 0x01c00080, 0x03e001c0, 0x07f003e0, 0x036006f0, 0x000001c0, 0x00000000, // RAYGUI_ICON_WATER_DROP + 0x00000000, 0x3e003800, 0x1f803f80, 0x0c201e40, 0x02080c10, 0x00840104, 0x00380044, 0x00000000, // RAYGUI_ICON_COLOR_PICKER + 0x00000000, 0x07800300, 0x1fe00fc0, 0x3f883fd0, 0x0e021f04, 0x02040402, 0x00f00108, 0x00000000, // RAYGUI_ICON_RUBBER + 0x00c00000, 0x02800140, 0x08200440, 0x20081010, 0x2ffe3004, 0x03f807fc, 0x00e001f0, 0x00000040, // RAYGUI_ICON_COLOR_BUCKET + 0x00000000, 0x21843ffc, 0x01800180, 0x01800180, 0x01800180, 0x01800180, 0x03c00180, 0x00000000, // RAYGUI_ICON_TEXT_T + 0x00800000, 0x01400180, 0x06200340, 0x0c100620, 0x1ff80c10, 0x380c1808, 0x70067004, 0x0000f80f, // RAYGUI_ICON_TEXT_A + 0x78000000, 0x50004000, 0x00004800, 0x03c003c0, 0x03c003c0, 0x00100000, 0x0002000a, 0x0000000e, // RAYGUI_ICON_SCALE + 0x75560000, 0x5e004002, 0x54001002, 0x41001202, 0x408200fe, 0x40820082, 0x40820082, 0x00006afe, // RAYGUI_ICON_RESIZE + 0x00000000, 0x3f003f00, 0x3f003f00, 0x3f003f00, 0x00400080, 0x001c0020, 0x001c001c, 0x00000000, // RAYGUI_ICON_FILTER_POINT + 0x6d800000, 0x00004080, 0x40804080, 0x40800000, 0x00406d80, 0x001c0020, 0x001c001c, 0x00000000, // RAYGUI_ICON_FILTER_BILINEAR + 0x40080000, 0x1ffe2008, 0x14081008, 0x11081208, 0x10481088, 0x10081028, 0x10047ff8, 0x00001002, // RAYGUI_ICON_CROP + 0x00100000, 0x3ffc0010, 0x2ab03550, 0x22b02550, 0x20b02150, 0x20302050, 0x2000fff0, 0x00002000, // RAYGUI_ICON_CROP_ALPHA + 0x40000000, 0x1ff82000, 0x04082808, 0x01082208, 0x00482088, 0x00182028, 0x35542008, 0x00000002, // RAYGUI_ICON_SQUARE_TOGGLE + 0x00000000, 0x02800280, 0x06c006c0, 0x0ea00ee0, 0x1e901eb0, 0x3e883e98, 0x7efc7e8c, 0x00000000, // RAYGUI_ICON_SIMMETRY + 0x01000000, 0x05600100, 0x1d480d50, 0x7d423d44, 0x3d447d42, 0x0d501d48, 0x01000560, 0x00000100, // RAYGUI_ICON_SIMMETRY_HORIZONTAL + 0x01800000, 0x04200240, 0x10080810, 0x00001ff8, 0x00007ffe, 0x0ff01ff8, 0x03c007e0, 0x00000180, // RAYGUI_ICON_SIMMETRY_VERTICAL + 0x00000000, 0x010800f0, 0x02040204, 0x02040204, 0x07f00308, 0x1c000e00, 0x30003800, 0x00000000, // RAYGUI_ICON_LENS + 0x00000000, 0x061803f0, 0x08240c0c, 0x08040814, 0x0c0c0804, 0x23f01618, 0x18002400, 0x00000000, // RAYGUI_ICON_LENS_BIG + 0x00000000, 0x00000000, 0x1c7007c0, 0x638e3398, 0x1c703398, 0x000007c0, 0x00000000, 0x00000000, // RAYGUI_ICON_EYE_ON + 0x00000000, 0x10002000, 0x04700fc0, 0x610e3218, 0x1c703098, 0x001007a0, 0x00000008, 0x00000000, // RAYGUI_ICON_EYE_OFF + 0x00000000, 0x00007ffc, 0x40047ffc, 0x10102008, 0x04400820, 0x02800280, 0x02800280, 0x00000100, // RAYGUI_ICON_FILTER_TOP + 0x00000000, 0x40027ffe, 0x10082004, 0x04200810, 0x02400240, 0x02400240, 0x01400240, 0x000000c0, // RAYGUI_ICON_FILTER + 0x00800000, 0x00800080, 0x00000080, 0x3c9e0000, 0x00000000, 0x00800080, 0x00800080, 0x00000000, // RAYGUI_ICON_TARGET_POINT + 0x00800000, 0x00800080, 0x00800080, 0x3f7e01c0, 0x008001c0, 0x00800080, 0x00800080, 0x00000000, // RAYGUI_ICON_TARGET_SMALL + 0x00800000, 0x00800080, 0x03e00080, 0x3e3e0220, 0x03e00220, 0x00800080, 0x00800080, 0x00000000, // RAYGUI_ICON_TARGET_BIG + 0x01000000, 0x04400280, 0x01000100, 0x43842008, 0x43849ab2, 0x01002008, 0x04400100, 0x01000280, // RAYGUI_ICON_TARGET_MOVE + 0x01000000, 0x04400280, 0x01000100, 0x41042108, 0x41049ff2, 0x01002108, 0x04400100, 0x01000280, // RAYGUI_ICON_CURSOR_MOVE + 0x781e0000, 0x500a4002, 0x04204812, 0x00000240, 0x02400000, 0x48120420, 0x4002500a, 0x0000781e, // RAYGUI_ICON_CURSOR_SCALE + 0x00000000, 0x20003c00, 0x24002800, 0x01000200, 0x00400080, 0x00140024, 0x003c0004, 0x00000000, // RAYGUI_ICON_CURSOR_SCALE_RIGHT + 0x00000000, 0x0004003c, 0x00240014, 0x00800040, 0x02000100, 0x28002400, 0x3c002000, 0x00000000, // RAYGUI_ICON_CURSOR_SCALE_LEFT + 0x00000000, 0x00100020, 0x10101fc8, 0x10001020, 0x10001000, 0x10001000, 0x00001fc0, 0x00000000, // RAYGUI_ICON_UNDO + 0x00000000, 0x08000400, 0x080813f8, 0x00080408, 0x00080008, 0x00080008, 0x000003f8, 0x00000000, // RAYGUI_ICON_REDO + 0x00000000, 0x3ffc0000, 0x20042004, 0x20002000, 0x20402000, 0x3f902020, 0x00400020, 0x00000000, // RAYGUI_ICON_REREDO + 0x00000000, 0x3ffc0000, 0x20042004, 0x27fc2004, 0x20202000, 0x3fc82010, 0x00200010, 0x00000000, // RAYGUI_ICON_MUTATE + 0x00000000, 0x0ff00000, 0x10081818, 0x11801008, 0x10001180, 0x18101020, 0x00100fc8, 0x00000020, // RAYGUI_ICON_ROTATE + 0x00000000, 0x04000200, 0x240429fc, 0x20042204, 0x20442004, 0x3f942024, 0x00400020, 0x00000000, // RAYGUI_ICON_REPEAT + 0x00000000, 0x20001000, 0x22104c0e, 0x00801120, 0x11200040, 0x4c0e2210, 0x10002000, 0x00000000, // RAYGUI_ICON_SHUFFLE + 0x7ffe0000, 0x50024002, 0x44024802, 0x41024202, 0x40424082, 0x40124022, 0x4002400a, 0x00007ffe, // RAYGUI_ICON_EMPTYBOX + 0x00800000, 0x03e00080, 0x08080490, 0x3c9e0808, 0x08080808, 0x03e00490, 0x00800080, 0x00000000, // RAYGUI_ICON_TARGET + 0x00800000, 0x00800080, 0x00800080, 0x3ffe01c0, 0x008001c0, 0x00800080, 0x00800080, 0x00000000, // RAYGUI_ICON_TARGET_SMALL_FILL + 0x00800000, 0x00800080, 0x03e00080, 0x3ffe03e0, 0x03e003e0, 0x00800080, 0x00800080, 0x00000000, // RAYGUI_ICON_TARGET_BIG_FILL + 0x01000000, 0x07c00380, 0x01000100, 0x638c2008, 0x638cfbbe, 0x01002008, 0x07c00100, 0x01000380, // RAYGUI_ICON_TARGET_MOVE_FILL + 0x01000000, 0x07c00380, 0x01000100, 0x610c2108, 0x610cfffe, 0x01002108, 0x07c00100, 0x01000380, // RAYGUI_ICON_CURSOR_MOVE_FILL + 0x781e0000, 0x6006700e, 0x04204812, 0x00000240, 0x02400000, 0x48120420, 0x700e6006, 0x0000781e, // RAYGUI_ICON_CURSOR_SCALE_FILL + 0x00000000, 0x38003c00, 0x24003000, 0x01000200, 0x00400080, 0x000c0024, 0x003c001c, 0x00000000, // RAYGUI_ICON_CURSOR_SCALE_RIGHT_FILL + 0x00000000, 0x001c003c, 0x0024000c, 0x00800040, 0x02000100, 0x30002400, 0x3c003800, 0x00000000, // RAYGUI_ICON_CURSOR_SCALE_LEFT_FILL + 0x00000000, 0x00300020, 0x10301ff8, 0x10001020, 0x10001000, 0x10001000, 0x00001fc0, 0x00000000, // RAYGUI_ICON_UNDO_FILL + 0x00000000, 0x0c000400, 0x0c081ff8, 0x00080408, 0x00080008, 0x00080008, 0x000003f8, 0x00000000, // RAYGUI_ICON_REDO_FILL + 0x00000000, 0x3ffc0000, 0x20042004, 0x20002000, 0x20402000, 0x3ff02060, 0x00400060, 0x00000000, // RAYGUI_ICON_REREDO_FILL + 0x00000000, 0x3ffc0000, 0x20042004, 0x27fc2004, 0x20202000, 0x3ff82030, 0x00200030, 0x00000000, // RAYGUI_ICON_MUTATE_FILL + 0x00000000, 0x0ff00000, 0x10081818, 0x11801008, 0x10001180, 0x18301020, 0x00300ff8, 0x00000020, // RAYGUI_ICON_ROTATE_FILL + 0x00000000, 0x06000200, 0x26042ffc, 0x20042204, 0x20442004, 0x3ff42064, 0x00400060, 0x00000000, // RAYGUI_ICON_REPEAT_FILL + 0x00000000, 0x30001000, 0x32107c0e, 0x00801120, 0x11200040, 0x7c0e3210, 0x10003000, 0x00000000, // RAYGUI_ICON_SHUFFLE_FILL + 0x00000000, 0x30043ffc, 0x24042804, 0x21042204, 0x20442084, 0x20142024, 0x3ffc200c, 0x00000000, // RAYGUI_ICON_EMPTYBOX_SMALL + 0x00000000, 0x20043ffc, 0x20042004, 0x20042004, 0x20042004, 0x20042004, 0x3ffc2004, 0x00000000, // RAYGUI_ICON_BOX + 0x00000000, 0x23c43ffc, 0x23c423c4, 0x200423c4, 0x20042004, 0x20042004, 0x3ffc2004, 0x00000000, // RAYGUI_ICON_BOX_TOP + 0x00000000, 0x3e043ffc, 0x3e043e04, 0x20043e04, 0x20042004, 0x20042004, 0x3ffc2004, 0x00000000, // RAYGUI_ICON_BOX_TOP_RIGHT + 0x00000000, 0x20043ffc, 0x20042004, 0x3e043e04, 0x3e043e04, 0x20042004, 0x3ffc2004, 0x00000000, // RAYGUI_ICON_BOX_RIGHT + 0x00000000, 0x20043ffc, 0x20042004, 0x20042004, 0x3e042004, 0x3e043e04, 0x3ffc3e04, 0x00000000, // RAYGUI_ICON_BOX_BOTTOM_RIGHT + 0x00000000, 0x20043ffc, 0x20042004, 0x20042004, 0x23c42004, 0x23c423c4, 0x3ffc23c4, 0x00000000, // RAYGUI_ICON_BOX_BOTTOM + 0x00000000, 0x20043ffc, 0x20042004, 0x20042004, 0x207c2004, 0x207c207c, 0x3ffc207c, 0x00000000, // RAYGUI_ICON_BOX_BOTTOM_LEFT + 0x00000000, 0x20043ffc, 0x20042004, 0x207c207c, 0x207c207c, 0x20042004, 0x3ffc2004, 0x00000000, // RAYGUI_ICON_BOX_LEFT + 0x00000000, 0x207c3ffc, 0x207c207c, 0x2004207c, 0x20042004, 0x20042004, 0x3ffc2004, 0x00000000, // RAYGUI_ICON_BOX_TOP_LEFT + 0x00000000, 0x20043ffc, 0x20042004, 0x23c423c4, 0x23c423c4, 0x20042004, 0x3ffc2004, 0x00000000, // RAYGUI_ICON_BOX_CENTER + 0x7ffe0000, 0x40024002, 0x47e24182, 0x4ff247e2, 0x47e24ff2, 0x418247e2, 0x40024002, 0x00007ffe, // RAYGUI_ICON_BOX_CIRCLE_MASK + 0x7fff0000, 0x40014001, 0x40014001, 0x49555ddd, 0x4945495d, 0x400149c5, 0x40014001, 0x00007fff, // RAYGUI_ICON_POT + 0x7ffe0000, 0x53327332, 0x44ce4cce, 0x41324332, 0x404e40ce, 0x48125432, 0x4006540e, 0x00007ffe, // RAYGUI_ICON_ALPHA_MULTIPLY + 0x7ffe0000, 0x53327332, 0x44ce4cce, 0x41324332, 0x5c4e40ce, 0x44124432, 0x40065c0e, 0x00007ffe, // RAYGUI_ICON_ALPHA_CLEAR + 0x7ffe0000, 0x42fe417e, 0x42fe417e, 0x42fe417e, 0x42fe417e, 0x42fe417e, 0x42fe417e, 0x00007ffe, // RAYGUI_ICON_DITHERING + 0x07fe0000, 0x1ffa0002, 0x7fea000a, 0x402a402a, 0x5b2a512a, 0x5128552a, 0x40205128, 0x00007fe0, // RAYGUI_ICON_MIPMAPS + 0x00000000, 0x1ff80000, 0x12481248, 0x12481ff8, 0x1ff81248, 0x12481248, 0x00001ff8, 0x00000000, // RAYGUI_ICON_BOX_GRID + 0x12480000, 0x7ffe1248, 0x12481248, 0x12487ffe, 0x7ffe1248, 0x12481248, 0x12487ffe, 0x00001248, // RAYGUI_ICON_GRID + 0x00000000, 0x1c380000, 0x1c3817e8, 0x08100810, 0x08100810, 0x17e81c38, 0x00001c38, 0x00000000, // RAYGUI_ICON_BOX_CORNERS_SMALL + 0x700e0000, 0x700e5ffa, 0x20042004, 0x20042004, 0x20042004, 0x20042004, 0x5ffa700e, 0x0000700e, // RAYGUI_ICON_BOX_CORNERS_BIG + 0x3f7e0000, 0x21422142, 0x21422142, 0x00003f7e, 0x21423f7e, 0x21422142, 0x3f7e2142, 0x00000000, // RAYGUI_ICON_FOUR_BOXES + 0x00000000, 0x3bb80000, 0x3bb83bb8, 0x3bb80000, 0x3bb83bb8, 0x3bb80000, 0x3bb83bb8, 0x00000000, // RAYGUI_ICON_GRID_FILL + 0x7ffe0000, 0x7ffe7ffe, 0x77fe7000, 0x77fe77fe, 0x777e7700, 0x777e777e, 0x777e777e, 0x0000777e, // RAYGUI_ICON_BOX_MULTISIZE + 0x781e0000, 0x40024002, 0x00004002, 0x01800000, 0x00000180, 0x40020000, 0x40024002, 0x0000781e, // RAYGUI_ICON_ZOOM_SMALL + 0x781e0000, 0x40024002, 0x00004002, 0x03c003c0, 0x03c003c0, 0x40020000, 0x40024002, 0x0000781e, // RAYGUI_ICON_ZOOM_MEDIUM + 0x781e0000, 0x40024002, 0x07e04002, 0x07e007e0, 0x07e007e0, 0x400207e0, 0x40024002, 0x0000781e, // RAYGUI_ICON_ZOOM_BIG + 0x781e0000, 0x5ffa4002, 0x1ff85ffa, 0x1ff81ff8, 0x1ff81ff8, 0x5ffa1ff8, 0x40025ffa, 0x0000781e, // RAYGUI_ICON_ZOOM_ALL + 0x00000000, 0x2004381c, 0x00002004, 0x00000000, 0x00000000, 0x20040000, 0x381c2004, 0x00000000, // RAYGUI_ICON_ZOOM_CENTER + 0x00000000, 0x1db80000, 0x10081008, 0x10080000, 0x00001008, 0x10081008, 0x00001db8, 0x00000000, // RAYGUI_ICON_BOX_DOTS_SMALL + 0x35560000, 0x00002002, 0x00002002, 0x00002002, 0x00002002, 0x00002002, 0x35562002, 0x00000000, // RAYGUI_ICON_BOX_DOTS_BIG + 0x7ffe0000, 0x40024002, 0x48124ff2, 0x49924812, 0x48124992, 0x4ff24812, 0x40024002, 0x00007ffe, // RAYGUI_ICON_BOX_CONCENTRIC + 0x00000000, 0x10841ffc, 0x10841084, 0x1ffc1084, 0x10841084, 0x10841084, 0x00001ffc, 0x00000000, // RAYGUI_ICON_BOX_GRID_BIG + 0x00000000, 0x00000000, 0x10000000, 0x04000800, 0x01040200, 0x00500088, 0x00000020, 0x00000000, // RAYGUI_ICON_OK_TICK + 0x00000000, 0x10080000, 0x04200810, 0x01800240, 0x02400180, 0x08100420, 0x00001008, 0x00000000, // RAYGUI_ICON_CROSS + 0x00000000, 0x02000000, 0x00800100, 0x00200040, 0x00200010, 0x00800040, 0x02000100, 0x00000000, // RAYGUI_ICON_ARROW_LEFT + 0x00000000, 0x00400000, 0x01000080, 0x04000200, 0x04000800, 0x01000200, 0x00400080, 0x00000000, // RAYGUI_ICON_ARROW_RIGHT + 0x00000000, 0x00000000, 0x00000000, 0x08081004, 0x02200410, 0x00800140, 0x00000000, 0x00000000, // RAYGUI_ICON_ARROW_BOTTOM + 0x00000000, 0x00000000, 0x01400080, 0x04100220, 0x10040808, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_ARROW_TOP + 0x00000000, 0x02000000, 0x03800300, 0x03e003c0, 0x03e003f0, 0x038003c0, 0x02000300, 0x00000000, // RAYGUI_ICON_ARROW_LEFT_FILL + 0x00000000, 0x00400000, 0x01c000c0, 0x07c003c0, 0x07c00fc0, 0x01c003c0, 0x004000c0, 0x00000000, // RAYGUI_ICON_ARROW_RIGHT_FILL + 0x00000000, 0x00000000, 0x00000000, 0x0ff81ffc, 0x03e007f0, 0x008001c0, 0x00000000, 0x00000000, // RAYGUI_ICON_ARROW_BOTTOM_FILL + 0x00000000, 0x00000000, 0x01c00080, 0x07f003e0, 0x1ffc0ff8, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_ARROW_TOP_FILL + 0x00000000, 0x18a008c0, 0x32881290, 0x24822686, 0x26862482, 0x12903288, 0x08c018a0, 0x00000000, // RAYGUI_ICON_AUDIO + 0x00000000, 0x04800780, 0x004000c0, 0x662000f0, 0x08103c30, 0x130a0e18, 0x0000318e, 0x00000000, // RAYGUI_ICON_FX + 0x00000000, 0x00800000, 0x08880888, 0x2aaa0a8a, 0x0a8a2aaa, 0x08880888, 0x00000080, 0x00000000, // RAYGUI_ICON_WAVE + 0x00000000, 0x00600000, 0x01080090, 0x02040108, 0x42044204, 0x24022402, 0x00001800, 0x00000000, // RAYGUI_ICON_WAVE_SINUS + 0x00000000, 0x07f80000, 0x04080408, 0x04080408, 0x04080408, 0x7c0e0408, 0x00000000, 0x00000000, // RAYGUI_ICON_WAVE_SQUARE + 0x00000000, 0x00000000, 0x00a00040, 0x22084110, 0x08021404, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_WAVE_TRIANGULAR + 0x00000000, 0x00000000, 0x04200000, 0x01800240, 0x02400180, 0x00000420, 0x00000000, 0x00000000, // RAYGUI_ICON_CROSS_SMALL + 0x00000000, 0x18380000, 0x12281428, 0x10a81128, 0x112810a8, 0x14281228, 0x00001838, 0x00000000, // RAYGUI_ICON_PLAYER_PREVIOUS + 0x00000000, 0x18000000, 0x11801600, 0x10181060, 0x10601018, 0x16001180, 0x00001800, 0x00000000, // RAYGUI_ICON_PLAYER_PLAY_BACK + 0x00000000, 0x00180000, 0x01880068, 0x18080608, 0x06081808, 0x00680188, 0x00000018, 0x00000000, // RAYGUI_ICON_PLAYER_PLAY + 0x00000000, 0x1e780000, 0x12481248, 0x12481248, 0x12481248, 0x12481248, 0x00001e78, 0x00000000, // RAYGUI_ICON_PLAYER_PAUSE + 0x00000000, 0x1ff80000, 0x10081008, 0x10081008, 0x10081008, 0x10081008, 0x00001ff8, 0x00000000, // RAYGUI_ICON_PLAYER_STOP + 0x00000000, 0x1c180000, 0x14481428, 0x15081488, 0x14881508, 0x14281448, 0x00001c18, 0x00000000, // RAYGUI_ICON_PLAYER_NEXT + 0x00000000, 0x03c00000, 0x08100420, 0x10081008, 0x10081008, 0x04200810, 0x000003c0, 0x00000000, // RAYGUI_ICON_PLAYER_RECORD + 0x00000000, 0x0c3007e0, 0x13c81818, 0x14281668, 0x14281428, 0x1c381c38, 0x08102244, 0x00000000, // RAYGUI_ICON_MAGNET + 0x07c00000, 0x08200820, 0x3ff80820, 0x23882008, 0x21082388, 0x20082108, 0x1ff02008, 0x00000000, // RAYGUI_ICON_LOCK_CLOSE + 0x07c00000, 0x08000800, 0x3ff80800, 0x23882008, 0x21082388, 0x20082108, 0x1ff02008, 0x00000000, // RAYGUI_ICON_LOCK_OPEN + 0x01c00000, 0x0c180770, 0x3086188c, 0x60832082, 0x60034781, 0x30062002, 0x0c18180c, 0x01c00770, // RAYGUI_ICON_CLOCK + 0x0a200000, 0x1b201b20, 0x04200e20, 0x04200420, 0x04700420, 0x0e700e70, 0x0e700e70, 0x04200e70, // RAYGUI_ICON_TOOLS + 0x01800000, 0x3bdc318c, 0x0ff01ff8, 0x7c3e1e78, 0x1e787c3e, 0x1ff80ff0, 0x318c3bdc, 0x00000180, // RAYGUI_ICON_GEAR + 0x01800000, 0x3ffc318c, 0x1c381ff8, 0x781e1818, 0x1818781e, 0x1ff81c38, 0x318c3ffc, 0x00000180, // RAYGUI_ICON_GEAR_BIG + 0x00000000, 0x08080ff8, 0x08081ffc, 0x0aa80aa8, 0x0aa80aa8, 0x0aa80aa8, 0x08080aa8, 0x00000ff8, // RAYGUI_ICON_BIN + 0x00000000, 0x00000000, 0x20043ffc, 0x08043f84, 0x04040f84, 0x04040784, 0x000007fc, 0x00000000, // RAYGUI_ICON_HAND_POINTER + 0x00000000, 0x24400400, 0x00001480, 0x6efe0e00, 0x00000e00, 0x24401480, 0x00000400, 0x00000000, // RAYGUI_ICON_LASER + 0x00000000, 0x03c00000, 0x08300460, 0x11181118, 0x11181118, 0x04600830, 0x000003c0, 0x00000000, // RAYGUI_ICON_COIN + 0x00000000, 0x10880080, 0x06c00810, 0x366c07e0, 0x07e00240, 0x00001768, 0x04200240, 0x00000000, // RAYGUI_ICON_EXPLOSION + 0x00000000, 0x3d280000, 0x2528252c, 0x3d282528, 0x05280528, 0x05e80528, 0x00000000, 0x00000000, // RAYGUI_ICON_1UP + 0x01800000, 0x03c003c0, 0x018003c0, 0x0ff007e0, 0x0bd00bd0, 0x0a500bd0, 0x02400240, 0x02400240, // RAYGUI_ICON_PLAYER + 0x01800000, 0x03c003c0, 0x118013c0, 0x03c81ff8, 0x07c003c8, 0x04400440, 0x0c080478, 0x00000000, // RAYGUI_ICON_PLAYER_JUMP + 0x3ff80000, 0x30183ff8, 0x30183018, 0x3ff83ff8, 0x03000300, 0x03c003c0, 0x03e00300, 0x000003e0, // RAYGUI_ICON_KEY + 0x3ff80000, 0x3ff83ff8, 0x33983ff8, 0x3ff83398, 0x3ff83ff8, 0x00000540, 0x0fe00aa0, 0x00000fe0, // RAYGUI_ICON_DEMON + 0x00000000, 0x0ff00000, 0x20041008, 0x25442004, 0x10082004, 0x06000bf0, 0x00000300, 0x00000000, // RAYGUI_ICON_TEXT_POPUP + 0x00000000, 0x11440000, 0x07f00be8, 0x1c1c0e38, 0x1c1c0c18, 0x07f00e38, 0x11440be8, 0x00000000, // RAYGUI_ICON_GEAR_EX + 0x00000000, 0x20080000, 0x0c601010, 0x07c00fe0, 0x07c007c0, 0x0c600fe0, 0x20081010, 0x00000000, // RAYGUI_ICON_CRACK + 0x00000000, 0x20080000, 0x0c601010, 0x04400fe0, 0x04405554, 0x0c600fe0, 0x20081010, 0x00000000, // RAYGUI_ICON_CRACK_POINTS + 0x00000000, 0x00800080, 0x01c001c0, 0x1ffc3ffe, 0x03e007f0, 0x07f003e0, 0x0c180770, 0x00000808, // RAYGUI_ICON_STAR + 0x0ff00000, 0x08180810, 0x08100818, 0x0a100810, 0x08180810, 0x08100818, 0x08100810, 0x00001ff8, // RAYGUI_ICON_DOOR + 0x0ff00000, 0x08100810, 0x08100810, 0x10100010, 0x4f902010, 0x10102010, 0x08100010, 0x00000ff0, // RAYGUI_ICON_EXIT + 0x00040000, 0x001f000e, 0x0ef40004, 0x12f41284, 0x0ef41214, 0x10040004, 0x7ffc3004, 0x10003000, // RAYGUI_ICON_MODE_2D + 0x78040000, 0x501f600e, 0x0ef44004, 0x12f41284, 0x0ef41284, 0x10140004, 0x7ffc300c, 0x10003000, // RAYGUI_ICON_MODE_3D + 0x7fe00000, 0x50286030, 0x47fe4804, 0x44224402, 0x44224422, 0x241275e2, 0x0c06140a, 0x000007fe, // RAYGUI_ICON_CUBE + 0x7fe00000, 0x5ff87ff0, 0x47fe4ffc, 0x44224402, 0x44224422, 0x241275e2, 0x0c06140a, 0x000007fe, // RAYGUI_ICON_CUBE_FACE_TOP + 0x7fe00000, 0x50386030, 0x47fe483c, 0x443e443e, 0x443e443e, 0x241e75fe, 0x0c06140e, 0x000007fe, // RAYGUI_ICON_CUBE_FACE_LEFT + 0x7fe00000, 0x50286030, 0x47fe4804, 0x47fe47fe, 0x47fe47fe, 0x27fe77fe, 0x0ffe17fe, 0x000007fe, // RAYGUI_ICON_CUBE_FACE_FRONT + 0x7fe00000, 0x50286030, 0x47fe4804, 0x44224402, 0x44224422, 0x3ff27fe2, 0x0ffe1ffa, 0x000007fe, // RAYGUI_ICON_CUBE_FACE_BOTTOM + 0x7fe00000, 0x70286030, 0x7ffe7804, 0x7c227c02, 0x7c227c22, 0x3c127de2, 0x0c061c0a, 0x000007fe, // RAYGUI_ICON_CUBE_FACE_RIGHT + 0x7fe00000, 0x7fe87ff0, 0x7ffe7fe4, 0x7fe27fe2, 0x7fe27fe2, 0x24127fe2, 0x0c06140a, 0x000007fe, // RAYGUI_ICON_CUBE_FACE_BACK + 0x00000000, 0x2a0233fe, 0x22022602, 0x22022202, 0x2a022602, 0x00a033fe, 0x02080110, 0x00000000, // RAYGUI_ICON_CAMERA + 0x00000000, 0x200c3ffc, 0x000c000c, 0x3ffc000c, 0x30003000, 0x30003000, 0x3ffc3004, 0x00000000, // RAYGUI_ICON_SPECIAL + 0x00000000, 0x0022003e, 0x012201e2, 0x0100013e, 0x01000100, 0x79000100, 0x4f004900, 0x00007800, // RAYGUI_ICON_LINK_NET + 0x00000000, 0x44007c00, 0x45004600, 0x00627cbe, 0x00620022, 0x45007cbe, 0x44004600, 0x00007c00, // RAYGUI_ICON_LINK_BOXES + 0x00000000, 0x0044007c, 0x0010007c, 0x3f100010, 0x3f1021f0, 0x3f100010, 0x3f0021f0, 0x00000000, // RAYGUI_ICON_LINK_MULTI + 0x00000000, 0x0044007c, 0x00440044, 0x0010007c, 0x00100010, 0x44107c10, 0x440047f0, 0x00007c00, // RAYGUI_ICON_LINK + 0x00000000, 0x0044007c, 0x00440044, 0x0000007c, 0x00000010, 0x44007c10, 0x44004550, 0x00007c00, // RAYGUI_ICON_LINK_BROKE + 0x02a00000, 0x22a43ffc, 0x20042004, 0x20042ff4, 0x20042ff4, 0x20042ff4, 0x20042004, 0x00003ffc, // RAYGUI_ICON_TEXT_NOTES + 0x3ffc0000, 0x20042004, 0x245e27c4, 0x27c42444, 0x2004201e, 0x201e2004, 0x20042004, 0x00003ffc, // RAYGUI_ICON_NOTEBOOK + 0x00000000, 0x07e00000, 0x04200420, 0x24243ffc, 0x24242424, 0x24242424, 0x3ffc2424, 0x00000000, // RAYGUI_ICON_SUITCASE + 0x00000000, 0x0fe00000, 0x08200820, 0x40047ffc, 0x7ffc5554, 0x40045554, 0x7ffc4004, 0x00000000, // RAYGUI_ICON_SUITCASE_ZIP + 0x00000000, 0x20043ffc, 0x3ffc2004, 0x13c81008, 0x100813c8, 0x10081008, 0x1ff81008, 0x00000000, // RAYGUI_ICON_MAILBOX + 0x00000000, 0x40027ffe, 0x5ffa5ffa, 0x5ffa5ffa, 0x40025ffa, 0x03c07ffe, 0x1ff81ff8, 0x00000000, // RAYGUI_ICON_MONITOR + 0x0ff00000, 0x6bfe7ffe, 0x7ffe7ffe, 0x68167ffe, 0x08106816, 0x08100810, 0x0ff00810, 0x00000000, // RAYGUI_ICON_PRINTER + 0x3ff80000, 0xfffe2008, 0x870a8002, 0x904a888a, 0x904a904a, 0x870a888a, 0xfffe8002, 0x00000000, // RAYGUI_ICON_PHOTO_CAMERA + 0x0fc00000, 0xfcfe0cd8, 0x8002fffe, 0x84428382, 0x84428442, 0x80028382, 0xfffe8002, 0x00000000, // RAYGUI_ICON_PHOTO_CAMERA_FLASH + 0x00000000, 0x02400180, 0x08100420, 0x20041008, 0x23c42004, 0x22442244, 0x3ffc2244, 0x00000000, // RAYGUI_ICON_HOUSE + 0x00000000, 0x1c700000, 0x3ff83ef8, 0x3ff83ff8, 0x0fe01ff0, 0x038007c0, 0x00000100, 0x00000000, // RAYGUI_ICON_HEART + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x80000000, 0xe000c000, // RAYGUI_ICON_CORNER + 0x00000000, 0x14001c00, 0x15c01400, 0x15401540, 0x155c1540, 0x15541554, 0x1ddc1554, 0x00000000, // RAYGUI_ICON_VERTICAL_BARS + 0x00000000, 0x03000300, 0x1b001b00, 0x1b601b60, 0x1b6c1b60, 0x1b6c1b6c, 0x1b6c1b6c, 0x00000000, // RAYGUI_ICON_VERTICAL_BARS_FILL + 0x00000000, 0x00000000, 0x403e7ffe, 0x7ffe403e, 0x7ffe0000, 0x43fe43fe, 0x00007ffe, 0x00000000, // RAYGUI_ICON_LIFE_BARS + 0x7ffc0000, 0x43844004, 0x43844284, 0x43844004, 0x42844284, 0x42844284, 0x40044384, 0x00007ffc, // RAYGUI_ICON_INFO + 0x40008000, 0x10002000, 0x04000800, 0x01000200, 0x00400080, 0x00100020, 0x00040008, 0x00010002, // RAYGUI_ICON_CROSSLINE + 0x00000000, 0x1ff01ff0, 0x18301830, 0x1f001830, 0x03001f00, 0x00000300, 0x03000300, 0x00000000, // RAYGUI_ICON_HELP + 0x3ff00000, 0x2abc3550, 0x2aac3554, 0x2aac3554, 0x2aac3554, 0x2aac3554, 0x2aac3554, 0x00003ffc, // RAYGUI_ICON_FILETYPE_ALPHA + 0x3ff00000, 0x201c2010, 0x22442184, 0x28142424, 0x29942814, 0x2ff42994, 0x20042004, 0x00003ffc, // RAYGUI_ICON_FILETYPE_HOME + 0x07fe0000, 0x04020402, 0x7fe20402, 0x44224422, 0x44224422, 0x402047fe, 0x40204020, 0x00007fe0, // RAYGUI_ICON_LAYERS_VISIBLE + 0x07fe0000, 0x04020402, 0x7c020402, 0x44024402, 0x44024402, 0x402047fe, 0x40204020, 0x00007fe0, // RAYGUI_ICON_LAYERS + 0x00000000, 0x40027ffe, 0x7ffe4002, 0x40024002, 0x40024002, 0x40024002, 0x7ffe4002, 0x00000000, // RAYGUI_ICON_WINDOW + 0x09100000, 0x09f00910, 0x09100910, 0x00000910, 0x24a2779e, 0x27a224a2, 0x709e20a2, 0x00000000, // RAYGUI_ICON_199 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_200 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_201 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_202 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_203 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_204 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_205 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_206 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_207 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_208 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_209 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_210 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_211 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_212 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_213 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_214 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_215 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_216 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_217 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_218 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_219 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_220 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_221 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_222 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_223 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_224 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_225 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_226 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_227 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_228 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_229 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_230 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_231 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_232 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_233 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_234 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_235 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_236 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_237 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_238 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_239 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_240 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_241 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_242 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_243 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_244 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_245 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_246 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_247 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_248 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_249 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_250 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_251 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_252 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_253 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_254 + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, // RAYGUI_ICON_255 +}; diff --git a/libs/raygui/inject.c b/libs/raygui/inject.c new file mode 100644 index 0000000..d780d38 --- /dev/null +++ b/libs/raygui/inject.c @@ -0,0 +1,2 @@ +#include "raygui.h" + diff --git a/libs/raygui/inject.h b/libs/raygui/inject.h new file mode 100644 index 0000000..d780d38 --- /dev/null +++ b/libs/raygui/inject.h @@ -0,0 +1,2 @@ +#include "raygui.h" + diff --git a/libs/raygui/inject.zig b/libs/raygui/inject.zig new file mode 100644 index 0000000..94d6a08 --- /dev/null +++ b/libs/raygui/inject.zig @@ -0,0 +1,66 @@ +const std = @import("std"); +const raygui = @cImport({ + @cInclude("raygui.h"); + @cInclude("raygui_marshal.h"); +}); +const raylib = @import("raylib"); + +pub const Rectangle = raylib.Rectangle; +pub const Vector2 = raylib.Vector2; +pub const Color = raylib.Color; +pub const RICON_SIZE = 32; +pub const RICON_DATA_ELEMENTS = 255; + +pub fn textAlignPixelOffset(h: i32) i32 { + return h % 2; +} + +fn bitCheck(a: u32, b: u32) bool { + const r = @shlWithOverflow(1, @as(u5, @truncate(b))); + return (a & (r[0])) != 0; +} + +/// Draw selected icon using rectangles pixel-by-pixel +pub fn GuiDrawIcon( + icon: raygui.GuiIconName, + posX: i32, + posY: i32, + pixelSize: i32, + color: raylib.Color, +) void { + const iconId = @intFromEnum(icon); + + var i: i32 = 0; + var y: i32 = 0; + while (i < RICON_SIZE * RICON_SIZE / 32) : (i += 1) { + var k: u32 = 0; + while (k < 32) : (k += 1) { + if (bitCheck(raygui.guiIcons[@as(usize, @intCast(iconId * RICON_DATA_ELEMENTS + i))], k)) { + _ = raylib.DrawRectangle( + posX + @as(i32, @intCast(k % RICON_SIZE)) * pixelSize, + posY + y * pixelSize, + pixelSize, + pixelSize, + color, + ); + } + + if ((k == 15) or (k == 31)) { + y += 1; + } + } + } +} + +/// Draw button with icon centered +pub fn GuiDrawIconButton(bounds: raylib.Rectangle, icon: GuiIconName, iconTint: raylib.Color) bool { + const pressed = GuiButton(bounds, ""); + GuiDrawIcon( + icon, + @as(i32, @intFromFloat(bounds.x + bounds.width / 2 - @as(f32, @floatFromInt(RICON_SIZE)) / 2)), + @as(i32, @intFromFloat(bounds.y + (bounds.height / 2) - @as(f32, @floatFromInt(RICON_SIZE)) / 2)), + 1, + iconTint, + ); + return pressed; +} diff --git a/libs/raygui/intermediate.zig b/libs/raygui/intermediate.zig new file mode 100644 index 0000000..13957b5 --- /dev/null +++ b/libs/raygui/intermediate.zig @@ -0,0 +1,46 @@ +const std = @import("std"); +const fs = std.fs; +const mapping = @import("type_mapping.zig"); +const json = std.json; + +pub const jsonFiles: []const []const u8 = &.{ + "raygui.json", +}; +pub const bindingsJSON = "bindings.json"; + +pub fn main() !void { + std.log.info("updating bindings.json ...", .{}); + var gpa = std.heap.GeneralPurposeAllocator(.{}){}; + defer { + if (gpa.deinit() == .leak) { + std.log.err("memory leak detected", .{}); + } + } + const allocator = gpa.allocator(); + var arena = std.heap.ArenaAllocator.init(allocator); + defer arena.deinit(); + + const raylib: mapping.CombinedRaylib = try mapping.CombinedRaylib.load(arena.allocator(), jsonFiles); + + var bindings: mapping.Intermediate = mapping.Intermediate.loadCustoms(arena.allocator(), bindingsJSON) catch |err| Catch: { + std.log.warn("could not open {s}: {?}\n", .{ bindingsJSON, err }); + break :Catch mapping.Intermediate{ + .enums = &[_]mapping.Enum{}, + .structs = &[_]mapping.Struct{}, + .functions = &[_]mapping.Function{}, + .defines = &[_]mapping.Define{}, + }; + }; + + try bindings.addNonCustom(arena.allocator(), raylib); + + var file = try fs.cwd().createFile(bindingsJSON, .{}); + defer file.close(); + + try json.stringify(bindings, .{ + .emit_null_optional_fields = false, + .whitespace = .indent_2, + }, file.writer()); + + std.log.info("... done", .{}); +} diff --git a/libs/raygui/logo.png b/libs/raygui/logo.png new file mode 100644 index 0000000..339ea4b Binary files /dev/null and b/libs/raygui/logo.png differ diff --git a/libs/raygui/raygui b/libs/raygui/raygui new file mode 160000 index 0000000..e30a826 --- /dev/null +++ b/libs/raygui/raygui @@ -0,0 +1 @@ +Subproject commit e30a826909cefbce39bae4ceaee76da6b163e2b1 diff --git a/libs/raygui/raygui.json b/libs/raygui/raygui.json new file mode 100644 index 0000000..32f83e0 --- /dev/null +++ b/libs/raygui/raygui.json @@ -0,0 +1,3355 @@ +{ + "defines": [ + { + "name": "RAYGUI_H", + "type": "GUARD", + "value": "", + "description": "" + }, + { + "name": "RAYGUI_VERSION_MAJOR", + "type": "INT", + "value": "4", + "description": "" + }, + { + "name": "RAYGUI_VERSION_MINOR", + "type": "INT", + "value": "0", + "description": "" + }, + { + "name": "RAYGUI_VERSION_PATCH", + "type": "INT", + "value": "0", + "description": "" + }, + { + "name": "RAYGUI_VERSION", + "type": "STRING", + "value": "4.0", + "description": "" + }, + { + "name": "RAYGUIAPI", + "type": "UNKNOWN", + "value": "__declspec(dllexport)", + "description": "We are building the library as a Win32 shared library (.dll)" + }, + { + "name": "RAYGUI_MALLOC(sz)", + "type": "MACRO", + "value": "malloc(sz)", + "description": "" + }, + { + "name": "RAYGUI_CALLOC(n,sz)", + "type": "MACRO", + "value": "calloc(n,sz)", + "description": "" + }, + { + "name": "RAYGUI_FREE(p)", + "type": "MACRO", + "value": "free(p)", + "description": "" + }, + { + "name": "RAYGUI_SUPPORT_LOG_INFO", + "type": "GUARD", + "value": "", + "description": "" + }, + { + "name": "RAYGUI_LOG(...)", + "type": "MACRO", + "value": "printf(__VA_ARGS__)", + "description": "" + }, + { + "name": "SCROLLBAR_LEFT_SIDE", + "type": "INT", + "value": "0", + "description": "" + }, + { + "name": "SCROLLBAR_RIGHT_SIDE", + "type": "INT", + "value": "1", + "description": "" + }, + { + "name": "RAYGUI_CLITERAL(name)", + "type": "MACRO", + "value": "name", + "description": "" + }, + { + "name": "CHECK_BOUNDS_ID(src, dst)", + "type": "MACRO", + "value": "((src.x == dst.x) && (src.y == dst.y) && (src.width == dst.width) && (src.height == dst.height))", + "description": "" + }, + { + "name": "RAYGUI_ICON_SIZE", + "type": "INT", + "value": "16", + "description": "Size of icons in pixels (squared)" + }, + { + "name": "RAYGUI_ICON_MAX_ICONS", + "type": "INT", + "value": "256", + "description": "Maximum number of icons" + }, + { + "name": "RAYGUI_ICON_MAX_NAME_LENGTH", + "type": "INT", + "value": "32", + "description": "Maximum length of icon name id" + }, + { + "name": "RAYGUI_ICON_DATA_ELEMENTS", + "type": "INT_MATH", + "value": "(RAYGUI_ICON_SIZE*RAYGUI_ICON_SIZE/32)", + "description": "" + }, + { + "name": "RAYGUI_MAX_CONTROLS", + "type": "INT", + "value": "16", + "description": "Maximum number of controls" + }, + { + "name": "RAYGUI_MAX_PROPS_BASE", + "type": "INT", + "value": "16", + "description": "Maximum number of base properties" + }, + { + "name": "RAYGUI_MAX_PROPS_EXTENDED", + "type": "INT", + "value": "8", + "description": "Maximum number of extended properties" + }, + { + "name": "KEY_RIGHT", + "type": "INT", + "value": "262", + "description": "" + }, + { + "name": "KEY_LEFT", + "type": "INT", + "value": "263", + "description": "" + }, + { + "name": "KEY_DOWN", + "type": "INT", + "value": "264", + "description": "" + }, + { + "name": "KEY_UP", + "type": "INT", + "value": "265", + "description": "" + }, + { + "name": "KEY_BACKSPACE", + "type": "INT", + "value": "259", + "description": "" + }, + { + "name": "KEY_ENTER", + "type": "INT", + "value": "257", + "description": "" + }, + { + "name": "MOUSE_LEFT_BUTTON", + "type": "INT", + "value": "0", + "description": "" + }, + { + "name": "RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT", + "type": "INT", + "value": "24", + "description": "" + }, + { + "name": "RAYGUI_GROUPBOX_LINE_THICK", + "type": "INT", + "value": "1", + "description": "" + }, + { + "name": "RAYGUI_LINE_MARGIN_TEXT", + "type": "INT", + "value": "12", + "description": "" + }, + { + "name": "RAYGUI_LINE_TEXT_PADDING", + "type": "INT", + "value": "4", + "description": "" + }, + { + "name": "RAYGUI_PANEL_BORDER_WIDTH", + "type": "INT", + "value": "1", + "description": "" + }, + { + "name": "RAYGUI_TABBAR_ITEM_WIDTH", + "type": "INT", + "value": "160", + "description": "" + }, + { + "name": "RAYGUI_MIN_SCROLLBAR_WIDTH", + "type": "INT", + "value": "40", + "description": "" + }, + { + "name": "RAYGUI_MIN_SCROLLBAR_HEIGHT", + "type": "INT", + "value": "40", + "description": "" + }, + { + "name": "RAYGUI_TOGGLEGROUP_MAX_ITEMS", + "type": "INT", + "value": "32", + "description": "" + }, + { + "name": "RAYGUI_TEXTBOX_AUTO_CURSOR_COOLDOWN", + "type": "INT", + "value": "40", + "description": "Frames to wait for autocursor movement" + }, + { + "name": "RAYGUI_TEXTBOX_AUTO_CURSOR_DELAY", + "type": "INT", + "value": "1", + "description": "Frames delay for autocursor movement" + }, + { + "name": "RAYGUI_VALUEBOX_MAX_CHARS", + "type": "INT", + "value": "32", + "description": "" + }, + { + "name": "RAYGUI_COLORBARALPHA_CHECKED_SIZE", + "type": "INT", + "value": "10", + "description": "" + }, + { + "name": "RAYGUI_MESSAGEBOX_BUTTON_HEIGHT", + "type": "INT", + "value": "24", + "description": "" + }, + { + "name": "RAYGUI_MESSAGEBOX_BUTTON_PADDING", + "type": "INT", + "value": "12", + "description": "" + }, + { + "name": "RAYGUI_TEXTINPUTBOX_BUTTON_HEIGHT", + "type": "INT", + "value": "24", + "description": "" + }, + { + "name": "RAYGUI_TEXTINPUTBOX_BUTTON_PADDING", + "type": "INT", + "value": "12", + "description": "" + }, + { + "name": "RAYGUI_TEXTINPUTBOX_HEIGHT", + "type": "INT", + "value": "26", + "description": "" + }, + { + "name": "RAYGUI_GRID_ALPHA", + "type": "FLOAT", + "value": "0.15", + "description": "" + }, + { + "name": "MAX_LINE_BUFFER_SIZE", + "type": "INT", + "value": "256", + "description": "" + }, + { + "name": "BIT_CHECK(a,b)", + "type": "MACRO", + "value": "((a) & (1u<<(b)))", + "description": "" + }, + { + "name": "ICON_TEXT_PADDING", + "type": "INT", + "value": "4", + "description": "" + }, + { + "name": "RAYGUI_MAX_TEXT_LINES", + "type": "INT", + "value": "128", + "description": "" + }, + { + "name": "TEXT_VALIGN_PIXEL_OFFSET(h)", + "type": "MACRO", + "value": "((int)h%2)", + "description": "Vertical alignment for pixel perfect" + }, + { + "name": "RAYGUI_TEXTSPLIT_MAX_ITEMS", + "type": "INT", + "value": "128", + "description": "" + }, + { + "name": "RAYGUI_TEXTSPLIT_MAX_TEXT_SIZE", + "type": "INT", + "value": "1024", + "description": "" + }, + { + "name": "RAYGUI_TEXTFORMAT_MAX_SIZE", + "type": "INT", + "value": "256", + "description": "" + } + ], + "structs": [ + { + "name": "Vector2", + "description": "Vector2 type", + "fields": [ + { + "type": "float", + "name": "x", + "description": "" + }, + { + "type": "float", + "name": "y", + "description": "" + } + ] + }, + { + "name": "Vector3", + "description": "Vector3 type // -- ConvertHSVtoRGB(), ConvertRGBtoHSV()", + "fields": [ + { + "type": "float", + "name": "x", + "description": "" + }, + { + "type": "float", + "name": "y", + "description": "" + }, + { + "type": "float", + "name": "z", + "description": "" + } + ] + }, + { + "name": "Color", + "description": "Color type, RGBA (32bit)", + "fields": [ + { + "type": "unsigned char", + "name": "r", + "description": "" + }, + { + "type": "unsigned char", + "name": "g", + "description": "" + }, + { + "type": "unsigned char", + "name": "b", + "description": "" + }, + { + "type": "unsigned char", + "name": "a", + "description": "" + } + ] + }, + { + "name": "Rectangle", + "description": "Rectangle type", + "fields": [ + { + "type": "float", + "name": "x", + "description": "" + }, + { + "type": "float", + "name": "y", + "description": "" + }, + { + "type": "float", + "name": "width", + "description": "" + }, + { + "type": "float", + "name": "height", + "description": "" + } + ] + }, + { + "name": "Texture2D", + "description": "It should be redesigned to be provided by user", + "fields": [ + { + "type": "unsigned int", + "name": "id", + "description": "OpenGL texture id" + }, + { + "type": "int", + "name": "width", + "description": "Texture base width" + }, + { + "type": "int", + "name": "height", + "description": "Texture base height" + }, + { + "type": "int", + "name": "mipmaps", + "description": "Mipmap levels, 1 by default" + }, + { + "type": "int", + "name": "format", + "description": "Data format (PixelFormat type)" + } + ] + }, + { + "name": "Image", + "description": "Image, pixel data stored in CPU memory (RAM)", + "fields": [ + { + "type": "void *", + "name": "data", + "description": "Image raw data" + }, + { + "type": "int", + "name": "width", + "description": "Image base width" + }, + { + "type": "int", + "name": "height", + "description": "Image base height" + }, + { + "type": "int", + "name": "mipmaps", + "description": "Mipmap levels, 1 by default" + }, + { + "type": "int", + "name": "format", + "description": "Data format (PixelFormat type)" + } + ] + }, + { + "name": "GlyphInfo", + "description": "GlyphInfo, font characters glyphs info", + "fields": [ + { + "type": "int", + "name": "value", + "description": "Character value (Unicode)" + }, + { + "type": "int", + "name": "offsetX", + "description": "Character offset X when drawing" + }, + { + "type": "int", + "name": "offsetY", + "description": "Character offset Y when drawing" + }, + { + "type": "int", + "name": "advanceX", + "description": "Character advance position X" + }, + { + "type": "Image", + "name": "image", + "description": "Character image data" + } + ] + }, + { + "name": "Font", + "description": "It should be redesigned to be provided by user", + "fields": [ + { + "type": "int", + "name": "baseSize", + "description": "Base size (default chars height)" + }, + { + "type": "int", + "name": "glyphCount", + "description": "Number of glyph characters" + }, + { + "type": "int", + "name": "glyphPadding", + "description": "Padding around the glyph characters" + }, + { + "type": "Texture2D", + "name": "texture", + "description": "Texture atlas containing the glyphs" + }, + { + "type": "Rectangle *", + "name": "recs", + "description": "Rectangles in texture for the glyphs" + }, + { + "type": "GlyphInfo *", + "name": "glyphs", + "description": "Glyphs info data" + } + ] + }, + { + "name": "GuiStyleProp", + "description": "NOTE: Used when exporting style as code for convenience", + "fields": [ + { + "type": "unsigned short", + "name": "controlId", + "description": "Control identifier" + }, + { + "type": "unsigned short", + "name": "propertyId", + "description": "Property identifier" + }, + { + "type": "int", + "name": "propertyValue", + "description": "Property value" + } + ] + }, + { + "name": "GuiTextStyle", + "description": "NOTE: Text style is defined by control", + "fields": [ + { + "type": "unsigned int", + "name": "size", + "description": "" + }, + { + "type": "int", + "name": "charSpacing", + "description": "" + }, + { + "type": "int", + "name": "lineSpacing", + "description": "" + }, + { + "type": "int", + "name": "alignmentH", + "description": "" + }, + { + "type": "int", + "name": "alignmentV", + "description": "" + }, + { + "type": "int", + "name": "padding", + "description": "" + } + ] + } + ], + "aliases": [ + ], + "enums": [ + { + "name": "GuiState", + "description": "Gui control state", + "values": [ + { + "name": "STATE_NORMAL", + "value": 0, + "description": "" + }, + { + "name": "STATE_FOCUSED", + "value": 1, + "description": "" + }, + { + "name": "STATE_PRESSED", + "value": 2, + "description": "" + }, + { + "name": "STATE_DISABLED", + "value": 3, + "description": "" + } + ] + }, + { + "name": "GuiTextAlignment", + "description": "Gui control text alignment", + "values": [ + { + "name": "TEXT_ALIGN_LEFT", + "value": 0, + "description": "" + }, + { + "name": "TEXT_ALIGN_CENTER", + "value": 1, + "description": "" + }, + { + "name": "TEXT_ALIGN_RIGHT", + "value": 2, + "description": "" + } + ] + }, + { + "name": "GuiTextAlignmentVertical", + "description": "Gui control text alignment vertical", + "values": [ + { + "name": "TEXT_ALIGN_TOP", + "value": 0, + "description": "" + }, + { + "name": "TEXT_ALIGN_MIDDLE", + "value": 1, + "description": "" + }, + { + "name": "TEXT_ALIGN_BOTTOM", + "value": 2, + "description": "" + } + ] + }, + { + "name": "GuiTextWrapMode", + "description": "Gui control text wrap mode", + "values": [ + { + "name": "TEXT_WRAP_NONE", + "value": 0, + "description": "" + }, + { + "name": "TEXT_WRAP_CHAR", + "value": 1, + "description": "" + }, + { + "name": "TEXT_WRAP_WORD", + "value": 2, + "description": "" + } + ] + }, + { + "name": "GuiControl", + "description": "Gui controls", + "values": [ + { + "name": "DEFAULT", + "value": 0, + "description": "" + }, + { + "name": "LABEL", + "value": 1, + "description": "Used also for: LABELBUTTON" + }, + { + "name": "BUTTON", + "value": 2, + "description": "" + }, + { + "name": "TOGGLE", + "value": 3, + "description": "Used also for: TOGGLEGROUP" + }, + { + "name": "SLIDER", + "value": 4, + "description": "Used also for: SLIDERBAR, TOGGLESLIDER" + }, + { + "name": "PROGRESSBAR", + "value": 5, + "description": "" + }, + { + "name": "CHECKBOX", + "value": 6, + "description": "" + }, + { + "name": "COMBOBOX", + "value": 7, + "description": "" + }, + { + "name": "DROPDOWNBOX", + "value": 8, + "description": "" + }, + { + "name": "TEXTBOX", + "value": 9, + "description": "Used also for: TEXTBOXMULTI" + }, + { + "name": "VALUEBOX", + "value": 10, + "description": "" + }, + { + "name": "SPINNER", + "value": 11, + "description": "Uses: BUTTON, VALUEBOX" + }, + { + "name": "LISTVIEW", + "value": 12, + "description": "" + }, + { + "name": "COLORPICKER", + "value": 13, + "description": "" + }, + { + "name": "SCROLLBAR", + "value": 14, + "description": "" + }, + { + "name": "STATUSBAR", + "value": 15, + "description": "" + } + ] + }, + { + "name": "GuiControlProperty", + "description": "Gui base properties for every control", + "values": [ + { + "name": "BORDER_COLOR_NORMAL", + "value": 0, + "description": "Control border color in STATE_NORMAL" + }, + { + "name": "BASE_COLOR_NORMAL", + "value": 1, + "description": "Control base color in STATE_NORMAL" + }, + { + "name": "TEXT_COLOR_NORMAL", + "value": 2, + "description": "Control text color in STATE_NORMAL" + }, + { + "name": "BORDER_COLOR_FOCUSED", + "value": 3, + "description": "Control border color in STATE_FOCUSED" + }, + { + "name": "BASE_COLOR_FOCUSED", + "value": 4, + "description": "Control base color in STATE_FOCUSED" + }, + { + "name": "TEXT_COLOR_FOCUSED", + "value": 5, + "description": "Control text color in STATE_FOCUSED" + }, + { + "name": "BORDER_COLOR_PRESSED", + "value": 6, + "description": "Control border color in STATE_PRESSED" + }, + { + "name": "BASE_COLOR_PRESSED", + "value": 7, + "description": "Control base color in STATE_PRESSED" + }, + { + "name": "TEXT_COLOR_PRESSED", + "value": 8, + "description": "Control text color in STATE_PRESSED" + }, + { + "name": "BORDER_COLOR_DISABLED", + "value": 9, + "description": "Control border color in STATE_DISABLED" + }, + { + "name": "BASE_COLOR_DISABLED", + "value": 10, + "description": "Control base color in STATE_DISABLED" + }, + { + "name": "TEXT_COLOR_DISABLED", + "value": 11, + "description": "Control text color in STATE_DISABLED" + }, + { + "name": "BORDER_WIDTH", + "value": 12, + "description": "Control border size, 0 for no border" + }, + { + "name": "TEXT_PADDING", + "value": 13, + "description": "Control text padding, not considering border" + }, + { + "name": "TEXT_ALIGNMENT", + "value": 14, + "description": "Control text horizontal alignment inside control text bound (after border and padding)" + } + ] + }, + { + "name": "GuiDefaultProperty", + "description": "DEFAULT extended properties", + "values": [ + { + "name": "TEXT_SIZE", + "value": 16, + "description": "Text size (glyphs max height)" + }, + { + "name": "TEXT_SPACING", + "value": 17, + "description": "Text spacing between glyphs" + }, + { + "name": "LINE_COLOR", + "value": 18, + "description": "Line control color" + }, + { + "name": "BACKGROUND_COLOR", + "value": 19, + "description": "Background color" + }, + { + "name": "TEXT_LINE_SPACING", + "value": 20, + "description": "Text spacing between lines" + }, + { + "name": "TEXT_ALIGNMENT_VERTICAL", + "value": 21, + "description": "Text vertical alignment inside text bounds (after border and padding)" + }, + { + "name": "TEXT_WRAP_MODE", + "value": 22, + "description": "Text wrap-mode inside text bounds" + } + ] + }, + { + "name": "GuiToggleProperty", + "description": "Toggle/ToggleGroup", + "values": [ + { + "name": "GROUP_PADDING", + "value": 16, + "description": "ToggleGroup separation between toggles" + } + ] + }, + { + "name": "GuiSliderProperty", + "description": "Slider/SliderBar", + "values": [ + { + "name": "SLIDER_WIDTH", + "value": 16, + "description": "Slider size of internal bar" + }, + { + "name": "SLIDER_PADDING", + "value": 17, + "description": "Slider/SliderBar internal bar padding" + } + ] + }, + { + "name": "GuiProgressBarProperty", + "description": "ProgressBar", + "values": [ + { + "name": "PROGRESS_PADDING", + "value": 16, + "description": "ProgressBar internal padding" + } + ] + }, + { + "name": "GuiScrollBarProperty", + "description": "ScrollBar", + "values": [ + { + "name": "ARROWS_SIZE", + "value": 16, + "description": "ScrollBar arrows size" + }, + { + "name": "ARROWS_VISIBLE", + "value": 17, + "description": "ScrollBar arrows visible" + }, + { + "name": "SCROLL_SLIDER_PADDING", + "value": 18, + "description": "ScrollBar slider internal padding" + }, + { + "name": "SCROLL_SLIDER_SIZE", + "value": 19, + "description": "ScrollBar slider size" + }, + { + "name": "SCROLL_PADDING", + "value": 20, + "description": "ScrollBar scroll padding from arrows" + }, + { + "name": "SCROLL_SPEED", + "value": 21, + "description": "ScrollBar scrolling speed" + } + ] + }, + { + "name": "GuiCheckBoxProperty", + "description": "CheckBox", + "values": [ + { + "name": "CHECK_PADDING", + "value": 16, + "description": "CheckBox internal check padding" + } + ] + }, + { + "name": "GuiComboBoxProperty", + "description": "ComboBox", + "values": [ + { + "name": "COMBO_BUTTON_WIDTH", + "value": 16, + "description": "ComboBox right button width" + }, + { + "name": "COMBO_BUTTON_SPACING", + "value": 17, + "description": "ComboBox button separation" + } + ] + }, + { + "name": "GuiDropdownBoxProperty", + "description": "DropdownBox", + "values": [ + { + "name": "ARROW_PADDING", + "value": 16, + "description": "DropdownBox arrow separation from border and items" + }, + { + "name": "DROPDOWN_ITEMS_SPACING", + "value": 17, + "description": "DropdownBox items separation" + } + ] + }, + { + "name": "GuiTextBoxProperty", + "description": "TextBox/TextBoxMulti/ValueBox/Spinner", + "values": [ + { + "name": "TEXT_READONLY", + "value": 16, + "description": "TextBox in read-only mode: 0-text editable, 1-text no-editable" + } + ] + }, + { + "name": "GuiSpinnerProperty", + "description": "Spinner", + "values": [ + { + "name": "SPIN_BUTTON_WIDTH", + "value": 16, + "description": "Spinner left/right buttons width" + }, + { + "name": "SPIN_BUTTON_SPACING", + "value": 17, + "description": "Spinner buttons separation" + } + ] + }, + { + "name": "GuiListViewProperty", + "description": "ListView", + "values": [ + { + "name": "LIST_ITEMS_HEIGHT", + "value": 16, + "description": "ListView items height" + }, + { + "name": "LIST_ITEMS_SPACING", + "value": 17, + "description": "ListView items separation" + }, + { + "name": "SCROLLBAR_WIDTH", + "value": 18, + "description": "ListView scrollbar size (usually width)" + }, + { + "name": "SCROLLBAR_SIDE", + "value": 19, + "description": "ListView scrollbar side (0-SCROLLBAR_LEFT_SIDE, 1-SCROLLBAR_RIGHT_SIDE)" + } + ] + }, + { + "name": "GuiColorPickerProperty", + "description": "ColorPicker", + "values": [ + { + "name": "COLOR_SELECTOR_SIZE", + "value": 16, + "description": "" + }, + { + "name": "HUEBAR_WIDTH", + "value": 17, + "description": "ColorPicker right hue bar width" + }, + { + "name": "HUEBAR_PADDING", + "value": 18, + "description": "ColorPicker right hue bar separation from panel" + }, + { + "name": "HUEBAR_SELECTOR_HEIGHT", + "value": 19, + "description": "ColorPicker right hue bar selector height" + }, + { + "name": "HUEBAR_SELECTOR_OVERFLOW", + "value": 20, + "description": "ColorPicker right hue bar selector overflow" + } + ] + }, + { + "name": "GuiIconName", + "description": "", + "values": [ + { + "name": "ICON_NONE", + "value": 0, + "description": "" + }, + { + "name": "ICON_FOLDER_FILE_OPEN", + "value": 1, + "description": "" + }, + { + "name": "ICON_FILE_SAVE_CLASSIC", + "value": 2, + "description": "" + }, + { + "name": "ICON_FOLDER_OPEN", + "value": 3, + "description": "" + }, + { + "name": "ICON_FOLDER_SAVE", + "value": 4, + "description": "" + }, + { + "name": "ICON_FILE_OPEN", + "value": 5, + "description": "" + }, + { + "name": "ICON_FILE_SAVE", + "value": 6, + "description": "" + }, + { + "name": "ICON_FILE_EXPORT", + "value": 7, + "description": "" + }, + { + "name": "ICON_FILE_ADD", + "value": 8, + "description": "" + }, + { + "name": "ICON_FILE_DELETE", + "value": 9, + "description": "" + }, + { + "name": "ICON_FILETYPE_TEXT", + "value": 10, + "description": "" + }, + { + "name": "ICON_FILETYPE_AUDIO", + "value": 11, + "description": "" + }, + { + "name": "ICON_FILETYPE_IMAGE", + "value": 12, + "description": "" + }, + { + "name": "ICON_FILETYPE_PLAY", + "value": 13, + "description": "" + }, + { + "name": "ICON_FILETYPE_VIDEO", + "value": 14, + "description": "" + }, + { + "name": "ICON_FILETYPE_INFO", + "value": 15, + "description": "" + }, + { + "name": "ICON_FILE_COPY", + "value": 16, + "description": "" + }, + { + "name": "ICON_FILE_CUT", + "value": 17, + "description": "" + }, + { + "name": "ICON_FILE_PASTE", + "value": 18, + "description": "" + }, + { + "name": "ICON_CURSOR_HAND", + "value": 19, + "description": "" + }, + { + "name": "ICON_CURSOR_POINTER", + "value": 20, + "description": "" + }, + { + "name": "ICON_CURSOR_CLASSIC", + "value": 21, + "description": "" + }, + { + "name": "ICON_PENCIL", + "value": 22, + "description": "" + }, + { + "name": "ICON_PENCIL_BIG", + "value": 23, + "description": "" + }, + { + "name": "ICON_BRUSH_CLASSIC", + "value": 24, + "description": "" + }, + { + "name": "ICON_BRUSH_PAINTER", + "value": 25, + "description": "" + }, + { + "name": "ICON_WATER_DROP", + "value": 26, + "description": "" + }, + { + "name": "ICON_COLOR_PICKER", + "value": 27, + "description": "" + }, + { + "name": "ICON_RUBBER", + "value": 28, + "description": "" + }, + { + "name": "ICON_COLOR_BUCKET", + "value": 29, + "description": "" + }, + { + "name": "ICON_TEXT_T", + "value": 30, + "description": "" + }, + { + "name": "ICON_TEXT_A", + "value": 31, + "description": "" + }, + { + "name": "ICON_SCALE", + "value": 32, + "description": "" + }, + { + "name": "ICON_RESIZE", + "value": 33, + "description": "" + }, + { + "name": "ICON_FILTER_POINT", + "value": 34, + "description": "" + }, + { + "name": "ICON_FILTER_BILINEAR", + "value": 35, + "description": "" + }, + { + "name": "ICON_CROP", + "value": 36, + "description": "" + }, + { + "name": "ICON_CROP_ALPHA", + "value": 37, + "description": "" + }, + { + "name": "ICON_SQUARE_TOGGLE", + "value": 38, + "description": "" + }, + { + "name": "ICON_SYMMETRY", + "value": 39, + "description": "" + }, + { + "name": "ICON_SYMMETRY_HORIZONTAL", + "value": 40, + "description": "" + }, + { + "name": "ICON_SYMMETRY_VERTICAL", + "value": 41, + "description": "" + }, + { + "name": "ICON_LENS", + "value": 42, + "description": "" + }, + { + "name": "ICON_LENS_BIG", + "value": 43, + "description": "" + }, + { + "name": "ICON_EYE_ON", + "value": 44, + "description": "" + }, + { + "name": "ICON_EYE_OFF", + "value": 45, + "description": "" + }, + { + "name": "ICON_FILTER_TOP", + "value": 46, + "description": "" + }, + { + "name": "ICON_FILTER", + "value": 47, + "description": "" + }, + { + "name": "ICON_TARGET_POINT", + "value": 48, + "description": "" + }, + { + "name": "ICON_TARGET_SMALL", + "value": 49, + "description": "" + }, + { + "name": "ICON_TARGET_BIG", + "value": 50, + "description": "" + }, + { + "name": "ICON_TARGET_MOVE", + "value": 51, + "description": "" + }, + { + "name": "ICON_CURSOR_MOVE", + "value": 52, + "description": "" + }, + { + "name": "ICON_CURSOR_SCALE", + "value": 53, + "description": "" + }, + { + "name": "ICON_CURSOR_SCALE_RIGHT", + "value": 54, + "description": "" + }, + { + "name": "ICON_CURSOR_SCALE_LEFT", + "value": 55, + "description": "" + }, + { + "name": "ICON_UNDO", + "value": 56, + "description": "" + }, + { + "name": "ICON_REDO", + "value": 57, + "description": "" + }, + { + "name": "ICON_REREDO", + "value": 58, + "description": "" + }, + { + "name": "ICON_MUTATE", + "value": 59, + "description": "" + }, + { + "name": "ICON_ROTATE", + "value": 60, + "description": "" + }, + { + "name": "ICON_REPEAT", + "value": 61, + "description": "" + }, + { + "name": "ICON_SHUFFLE", + "value": 62, + "description": "" + }, + { + "name": "ICON_EMPTYBOX", + "value": 63, + "description": "" + }, + { + "name": "ICON_TARGET", + "value": 64, + "description": "" + }, + { + "name": "ICON_TARGET_SMALL_FILL", + "value": 65, + "description": "" + }, + { + "name": "ICON_TARGET_BIG_FILL", + "value": 66, + "description": "" + }, + { + "name": "ICON_TARGET_MOVE_FILL", + "value": 67, + "description": "" + }, + { + "name": "ICON_CURSOR_MOVE_FILL", + "value": 68, + "description": "" + }, + { + "name": "ICON_CURSOR_SCALE_FILL", + "value": 69, + "description": "" + }, + { + "name": "ICON_CURSOR_SCALE_RIGHT_FILL", + "value": 70, + "description": "" + }, + { + "name": "ICON_CURSOR_SCALE_LEFT_FILL", + "value": 71, + "description": "" + }, + { + "name": "ICON_UNDO_FILL", + "value": 72, + "description": "" + }, + { + "name": "ICON_REDO_FILL", + "value": 73, + "description": "" + }, + { + "name": "ICON_REREDO_FILL", + "value": 74, + "description": "" + }, + { + "name": "ICON_MUTATE_FILL", + "value": 75, + "description": "" + }, + { + "name": "ICON_ROTATE_FILL", + "value": 76, + "description": "" + }, + { + "name": "ICON_REPEAT_FILL", + "value": 77, + "description": "" + }, + { + "name": "ICON_SHUFFLE_FILL", + "value": 78, + "description": "" + }, + { + "name": "ICON_EMPTYBOX_SMALL", + "value": 79, + "description": "" + }, + { + "name": "ICON_BOX", + "value": 80, + "description": "" + }, + { + "name": "ICON_BOX_TOP", + "value": 81, + "description": "" + }, + { + "name": "ICON_BOX_TOP_RIGHT", + "value": 82, + "description": "" + }, + { + "name": "ICON_BOX_RIGHT", + "value": 83, + "description": "" + }, + { + "name": "ICON_BOX_BOTTOM_RIGHT", + "value": 84, + "description": "" + }, + { + "name": "ICON_BOX_BOTTOM", + "value": 85, + "description": "" + }, + { + "name": "ICON_BOX_BOTTOM_LEFT", + "value": 86, + "description": "" + }, + { + "name": "ICON_BOX_LEFT", + "value": 87, + "description": "" + }, + { + "name": "ICON_BOX_TOP_LEFT", + "value": 88, + "description": "" + }, + { + "name": "ICON_BOX_CENTER", + "value": 89, + "description": "" + }, + { + "name": "ICON_BOX_CIRCLE_MASK", + "value": 90, + "description": "" + }, + { + "name": "ICON_POT", + "value": 91, + "description": "" + }, + { + "name": "ICON_ALPHA_MULTIPLY", + "value": 92, + "description": "" + }, + { + "name": "ICON_ALPHA_CLEAR", + "value": 93, + "description": "" + }, + { + "name": "ICON_DITHERING", + "value": 94, + "description": "" + }, + { + "name": "ICON_MIPMAPS", + "value": 95, + "description": "" + }, + { + "name": "ICON_BOX_GRID", + "value": 96, + "description": "" + }, + { + "name": "ICON_GRID", + "value": 97, + "description": "" + }, + { + "name": "ICON_BOX_CORNERS_SMALL", + "value": 98, + "description": "" + }, + { + "name": "ICON_BOX_CORNERS_BIG", + "value": 99, + "description": "" + }, + { + "name": "ICON_FOUR_BOXES", + "value": 100, + "description": "" + }, + { + "name": "ICON_GRID_FILL", + "value": 101, + "description": "" + }, + { + "name": "ICON_BOX_MULTISIZE", + "value": 102, + "description": "" + }, + { + "name": "ICON_ZOOM_SMALL", + "value": 103, + "description": "" + }, + { + "name": "ICON_ZOOM_MEDIUM", + "value": 104, + "description": "" + }, + { + "name": "ICON_ZOOM_BIG", + "value": 105, + "description": "" + }, + { + "name": "ICON_ZOOM_ALL", + "value": 106, + "description": "" + }, + { + "name": "ICON_ZOOM_CENTER", + "value": 107, + "description": "" + }, + { + "name": "ICON_BOX_DOTS_SMALL", + "value": 108, + "description": "" + }, + { + "name": "ICON_BOX_DOTS_BIG", + "value": 109, + "description": "" + }, + { + "name": "ICON_BOX_CONCENTRIC", + "value": 110, + "description": "" + }, + { + "name": "ICON_BOX_GRID_BIG", + "value": 111, + "description": "" + }, + { + "name": "ICON_OK_TICK", + "value": 112, + "description": "" + }, + { + "name": "ICON_CROSS", + "value": 113, + "description": "" + }, + { + "name": "ICON_ARROW_LEFT", + "value": 114, + "description": "" + }, + { + "name": "ICON_ARROW_RIGHT", + "value": 115, + "description": "" + }, + { + "name": "ICON_ARROW_DOWN", + "value": 116, + "description": "" + }, + { + "name": "ICON_ARROW_UP", + "value": 117, + "description": "" + }, + { + "name": "ICON_ARROW_LEFT_FILL", + "value": 118, + "description": "" + }, + { + "name": "ICON_ARROW_RIGHT_FILL", + "value": 119, + "description": "" + }, + { + "name": "ICON_ARROW_DOWN_FILL", + "value": 120, + "description": "" + }, + { + "name": "ICON_ARROW_UP_FILL", + "value": 121, + "description": "" + }, + { + "name": "ICON_AUDIO", + "value": 122, + "description": "" + }, + { + "name": "ICON_FX", + "value": 123, + "description": "" + }, + { + "name": "ICON_WAVE", + "value": 124, + "description": "" + }, + { + "name": "ICON_WAVE_SINUS", + "value": 125, + "description": "" + }, + { + "name": "ICON_WAVE_SQUARE", + "value": 126, + "description": "" + }, + { + "name": "ICON_WAVE_TRIANGULAR", + "value": 127, + "description": "" + }, + { + "name": "ICON_CROSS_SMALL", + "value": 128, + "description": "" + }, + { + "name": "ICON_PLAYER_PREVIOUS", + "value": 129, + "description": "" + }, + { + "name": "ICON_PLAYER_PLAY_BACK", + "value": 130, + "description": "" + }, + { + "name": "ICON_PLAYER_PLAY", + "value": 131, + "description": "" + }, + { + "name": "ICON_PLAYER_PAUSE", + "value": 132, + "description": "" + }, + { + "name": "ICON_PLAYER_STOP", + "value": 133, + "description": "" + }, + { + "name": "ICON_PLAYER_NEXT", + "value": 134, + "description": "" + }, + { + "name": "ICON_PLAYER_RECORD", + "value": 135, + "description": "" + }, + { + "name": "ICON_MAGNET", + "value": 136, + "description": "" + }, + { + "name": "ICON_LOCK_CLOSE", + "value": 137, + "description": "" + }, + { + "name": "ICON_LOCK_OPEN", + "value": 138, + "description": "" + }, + { + "name": "ICON_CLOCK", + "value": 139, + "description": "" + }, + { + "name": "ICON_TOOLS", + "value": 140, + "description": "" + }, + { + "name": "ICON_GEAR", + "value": 141, + "description": "" + }, + { + "name": "ICON_GEAR_BIG", + "value": 142, + "description": "" + }, + { + "name": "ICON_BIN", + "value": 143, + "description": "" + }, + { + "name": "ICON_HAND_POINTER", + "value": 144, + "description": "" + }, + { + "name": "ICON_LASER", + "value": 145, + "description": "" + }, + { + "name": "ICON_COIN", + "value": 146, + "description": "" + }, + { + "name": "ICON_EXPLOSION", + "value": 147, + "description": "" + }, + { + "name": "ICON_1UP", + "value": 148, + "description": "" + }, + { + "name": "ICON_PLAYER", + "value": 149, + "description": "" + }, + { + "name": "ICON_PLAYER_JUMP", + "value": 150, + "description": "" + }, + { + "name": "ICON_KEY", + "value": 151, + "description": "" + }, + { + "name": "ICON_DEMON", + "value": 152, + "description": "" + }, + { + "name": "ICON_TEXT_POPUP", + "value": 153, + "description": "" + }, + { + "name": "ICON_GEAR_EX", + "value": 154, + "description": "" + }, + { + "name": "ICON_CRACK", + "value": 155, + "description": "" + }, + { + "name": "ICON_CRACK_POINTS", + "value": 156, + "description": "" + }, + { + "name": "ICON_STAR", + "value": 157, + "description": "" + }, + { + "name": "ICON_DOOR", + "value": 158, + "description": "" + }, + { + "name": "ICON_EXIT", + "value": 159, + "description": "" + }, + { + "name": "ICON_MODE_2D", + "value": 160, + "description": "" + }, + { + "name": "ICON_MODE_3D", + "value": 161, + "description": "" + }, + { + "name": "ICON_CUBE", + "value": 162, + "description": "" + }, + { + "name": "ICON_CUBE_FACE_TOP", + "value": 163, + "description": "" + }, + { + "name": "ICON_CUBE_FACE_LEFT", + "value": 164, + "description": "" + }, + { + "name": "ICON_CUBE_FACE_FRONT", + "value": 165, + "description": "" + }, + { + "name": "ICON_CUBE_FACE_BOTTOM", + "value": 166, + "description": "" + }, + { + "name": "ICON_CUBE_FACE_RIGHT", + "value": 167, + "description": "" + }, + { + "name": "ICON_CUBE_FACE_BACK", + "value": 168, + "description": "" + }, + { + "name": "ICON_CAMERA", + "value": 169, + "description": "" + }, + { + "name": "ICON_SPECIAL", + "value": 170, + "description": "" + }, + { + "name": "ICON_LINK_NET", + "value": 171, + "description": "" + }, + { + "name": "ICON_LINK_BOXES", + "value": 172, + "description": "" + }, + { + "name": "ICON_LINK_MULTI", + "value": 173, + "description": "" + }, + { + "name": "ICON_LINK", + "value": 174, + "description": "" + }, + { + "name": "ICON_LINK_BROKE", + "value": 175, + "description": "" + }, + { + "name": "ICON_TEXT_NOTES", + "value": 176, + "description": "" + }, + { + "name": "ICON_NOTEBOOK", + "value": 177, + "description": "" + }, + { + "name": "ICON_SUITCASE", + "value": 178, + "description": "" + }, + { + "name": "ICON_SUITCASE_ZIP", + "value": 179, + "description": "" + }, + { + "name": "ICON_MAILBOX", + "value": 180, + "description": "" + }, + { + "name": "ICON_MONITOR", + "value": 181, + "description": "" + }, + { + "name": "ICON_PRINTER", + "value": 182, + "description": "" + }, + { + "name": "ICON_PHOTO_CAMERA", + "value": 183, + "description": "" + }, + { + "name": "ICON_PHOTO_CAMERA_FLASH", + "value": 184, + "description": "" + }, + { + "name": "ICON_HOUSE", + "value": 185, + "description": "" + }, + { + "name": "ICON_HEART", + "value": 186, + "description": "" + }, + { + "name": "ICON_CORNER", + "value": 187, + "description": "" + }, + { + "name": "ICON_VERTICAL_BARS", + "value": 188, + "description": "" + }, + { + "name": "ICON_VERTICAL_BARS_FILL", + "value": 189, + "description": "" + }, + { + "name": "ICON_LIFE_BARS", + "value": 190, + "description": "" + }, + { + "name": "ICON_INFO", + "value": 191, + "description": "" + }, + { + "name": "ICON_CROSSLINE", + "value": 192, + "description": "" + }, + { + "name": "ICON_HELP", + "value": 193, + "description": "" + }, + { + "name": "ICON_FILETYPE_ALPHA", + "value": 194, + "description": "" + }, + { + "name": "ICON_FILETYPE_HOME", + "value": 195, + "description": "" + }, + { + "name": "ICON_LAYERS_VISIBLE", + "value": 196, + "description": "" + }, + { + "name": "ICON_LAYERS", + "value": 197, + "description": "" + }, + { + "name": "ICON_WINDOW", + "value": 198, + "description": "" + }, + { + "name": "ICON_HIDPI", + "value": 199, + "description": "" + }, + { + "name": "ICON_FILETYPE_BINARY", + "value": 200, + "description": "" + }, + { + "name": "ICON_HEX", + "value": 201, + "description": "" + }, + { + "name": "ICON_SHIELD", + "value": 202, + "description": "" + }, + { + "name": "ICON_FILE_NEW", + "value": 203, + "description": "" + }, + { + "name": "ICON_FOLDER_ADD", + "value": 204, + "description": "" + }, + { + "name": "ICON_ALARM", + "value": 205, + "description": "" + }, + { + "name": "ICON_CPU", + "value": 206, + "description": "" + }, + { + "name": "ICON_ROM", + "value": 207, + "description": "" + }, + { + "name": "ICON_STEP_OVER", + "value": 208, + "description": "" + }, + { + "name": "ICON_STEP_INTO", + "value": 209, + "description": "" + }, + { + "name": "ICON_STEP_OUT", + "value": 210, + "description": "" + }, + { + "name": "ICON_RESTART", + "value": 211, + "description": "" + }, + { + "name": "ICON_BREAKPOINT_ON", + "value": 212, + "description": "" + }, + { + "name": "ICON_BREAKPOINT_OFF", + "value": 213, + "description": "" + }, + { + "name": "ICON_BURGER_MENU", + "value": 214, + "description": "" + }, + { + "name": "ICON_CASE_SENSITIVE", + "value": 215, + "description": "" + }, + { + "name": "ICON_REG_EXP", + "value": 216, + "description": "" + }, + { + "name": "ICON_FOLDER", + "value": 217, + "description": "" + }, + { + "name": "ICON_FILE", + "value": 218, + "description": "" + }, + { + "name": "ICON_SAND_TIMER", + "value": 219, + "description": "" + }, + { + "name": "ICON_220", + "value": 220, + "description": "" + }, + { + "name": "ICON_221", + "value": 221, + "description": "" + }, + { + "name": "ICON_222", + "value": 222, + "description": "" + }, + { + "name": "ICON_223", + "value": 223, + "description": "" + }, + { + "name": "ICON_224", + "value": 224, + "description": "" + }, + { + "name": "ICON_225", + "value": 225, + "description": "" + }, + { + "name": "ICON_226", + "value": 226, + "description": "" + }, + { + "name": "ICON_227", + "value": 227, + "description": "" + }, + { + "name": "ICON_228", + "value": 228, + "description": "" + }, + { + "name": "ICON_229", + "value": 229, + "description": "" + }, + { + "name": "ICON_230", + "value": 230, + "description": "" + }, + { + "name": "ICON_231", + "value": 231, + "description": "" + }, + { + "name": "ICON_232", + "value": 232, + "description": "" + }, + { + "name": "ICON_233", + "value": 233, + "description": "" + }, + { + "name": "ICON_234", + "value": 234, + "description": "" + }, + { + "name": "ICON_235", + "value": 235, + "description": "" + }, + { + "name": "ICON_236", + "value": 236, + "description": "" + }, + { + "name": "ICON_237", + "value": 237, + "description": "" + }, + { + "name": "ICON_238", + "value": 238, + "description": "" + }, + { + "name": "ICON_239", + "value": 239, + "description": "" + }, + { + "name": "ICON_240", + "value": 240, + "description": "" + }, + { + "name": "ICON_241", + "value": 241, + "description": "" + }, + { + "name": "ICON_242", + "value": 242, + "description": "" + }, + { + "name": "ICON_243", + "value": 243, + "description": "" + }, + { + "name": "ICON_244", + "value": 244, + "description": "" + }, + { + "name": "ICON_245", + "value": 245, + "description": "" + }, + { + "name": "ICON_246", + "value": 246, + "description": "" + }, + { + "name": "ICON_247", + "value": 247, + "description": "" + }, + { + "name": "ICON_248", + "value": 248, + "description": "" + }, + { + "name": "ICON_249", + "value": 249, + "description": "" + }, + { + "name": "ICON_250", + "value": 250, + "description": "" + }, + { + "name": "ICON_251", + "value": 251, + "description": "" + }, + { + "name": "ICON_252", + "value": 252, + "description": "" + }, + { + "name": "ICON_253", + "value": 253, + "description": "" + }, + { + "name": "ICON_254", + "value": 254, + "description": "" + }, + { + "name": "ICON_255", + "value": 255, + "description": "" + } + ] + } + ], + "callbacks": [ + ], + "functions": [ + { + "name": "GuiEnable", + "description": "Enable gui controls (global state)", + "returnType": "void" + }, + { + "name": "GuiDisable", + "description": "Disable gui controls (global state)", + "returnType": "void" + }, + { + "name": "GuiLock", + "description": "Lock gui controls (global state)", + "returnType": "void" + }, + { + "name": "GuiUnlock", + "description": "Unlock gui controls (global state)", + "returnType": "void" + }, + { + "name": "GuiIsLocked", + "description": "Check if gui is locked (global state)", + "returnType": "bool" + }, + { + "name": "GuiSetAlpha", + "description": "Set gui controls alpha (global state), alpha goes from 0.0f to 1.0f", + "returnType": "void", + "params": [ + { + "type": "float", + "name": "alpha" + } + ] + }, + { + "name": "GuiSetState", + "description": "Set gui state (global state)", + "returnType": "void", + "params": [ + { + "type": "int", + "name": "state" + } + ] + }, + { + "name": "GuiGetState", + "description": "Get gui state (global state)", + "returnType": "int" + }, + { + "name": "GuiSetFont", + "description": "Set gui custom font (global state)", + "returnType": "void", + "params": [ + { + "type": "Font", + "name": "font" + } + ] + }, + { + "name": "GuiGetFont", + "description": "Get gui custom font (global state)", + "returnType": "Font" + }, + { + "name": "GuiSetStyle", + "description": "Set one style property", + "returnType": "void", + "params": [ + { + "type": "int", + "name": "control" + }, + { + "type": "int", + "name": "property" + }, + { + "type": "int", + "name": "value" + } + ] + }, + { + "name": "GuiGetStyle", + "description": "Get one style property", + "returnType": "int", + "params": [ + { + "type": "int", + "name": "control" + }, + { + "type": "int", + "name": "property" + } + ] + }, + { + "name": "GuiLoadStyle", + "description": "Load style file over global style variable (.rgs)", + "returnType": "void", + "params": [ + { + "type": "const char *", + "name": "fileName" + } + ] + }, + { + "name": "GuiLoadStyleDefault", + "description": "Load style default over global style", + "returnType": "void" + }, + { + "name": "GuiEnableTooltip", + "description": "Enable gui tooltips (global state)", + "returnType": "void" + }, + { + "name": "GuiDisableTooltip", + "description": "Disable gui tooltips (global state)", + "returnType": "void" + }, + { + "name": "GuiSetTooltip", + "description": "Set tooltip string", + "returnType": "void", + "params": [ + { + "type": "const char *", + "name": "tooltip" + } + ] + }, + { + "name": "GuiIconText", + "description": "Get text with icon id prepended (if supported)", + "returnType": "const char *", + "params": [ + { + "type": "int", + "name": "iconId" + }, + { + "type": "const char *", + "name": "text" + } + ] + }, + { + "name": "GuiSetIconScale", + "description": "Set default icon drawing size", + "returnType": "void", + "params": [ + { + "type": "int", + "name": "scale" + } + ] + }, + { + "name": "GuiGetIcons", + "description": "Get raygui icons data pointer", + "returnType": "unsigned int *" + }, + { + "name": "GuiLoadIcons", + "description": "Load raygui icons file (.rgi) into internal icons data", + "returnType": "char **", + "params": [ + { + "type": "const char *", + "name": "fileName" + }, + { + "type": "bool", + "name": "loadIconsName" + } + ] + }, + { + "name": "GuiDrawIcon", + "description": "Draw icon using pixel size at specified position", + "returnType": "void", + "params": [ + { + "type": "int", + "name": "iconId" + }, + { + "type": "int", + "name": "posX" + }, + { + "type": "int", + "name": "posY" + }, + { + "type": "int", + "name": "pixelSize" + }, + { + "type": "Color", + "name": "color" + } + ] + }, + { + "name": "GuiWindowBox", + "description": "Window Box control, shows a window that can be closed", + "returnType": "int", + "params": [ + { + "type": "Rectangle", + "name": "bounds" + }, + { + "type": "const char *", + "name": "title" + } + ] + }, + { + "name": "GuiGroupBox", + "description": "Group Box control with text name", + "returnType": "int", + "params": [ + { + "type": "Rectangle", + "name": "bounds" + }, + { + "type": "const char *", + "name": "text" + } + ] + }, + { + "name": "GuiLine", + "description": "Line separator control, could contain text", + "returnType": "int", + "params": [ + { + "type": "Rectangle", + "name": "bounds" + }, + { + "type": "const char *", + "name": "text" + } + ] + }, + { + "name": "GuiPanel", + "description": "Panel control, useful to group controls", + "returnType": "int", + "params": [ + { + "type": "Rectangle", + "name": "bounds" + }, + { + "type": "const char *", + "name": "text" + } + ] + }, + { + "name": "GuiTabBar", + "description": "Tab Bar control, returns TAB to be closed or -1", + "returnType": "int", + "params": [ + { + "type": "Rectangle", + "name": "bounds" + }, + { + "type": "const char **", + "name": "text" + }, + { + "type": "int", + "name": "count" + }, + { + "type": "int *", + "name": "active" + } + ] + }, + { + "name": "GuiScrollPanel", + "description": "Scroll Panel control", + "returnType": "int", + "params": [ + { + "type": "Rectangle", + "name": "bounds" + }, + { + "type": "const char *", + "name": "text" + }, + { + "type": "Rectangle", + "name": "content" + }, + { + "type": "Vector2 *", + "name": "scroll" + }, + { + "type": "Rectangle *", + "name": "view" + } + ] + }, + { + "name": "GuiLabel", + "description": "Label control, shows text", + "returnType": "int", + "params": [ + { + "type": "Rectangle", + "name": "bounds" + }, + { + "type": "const char *", + "name": "text" + } + ] + }, + { + "name": "GuiButton", + "description": "Button control, returns true when clicked", + "returnType": "int", + "params": [ + { + "type": "Rectangle", + "name": "bounds" + }, + { + "type": "const char *", + "name": "text" + } + ] + }, + { + "name": "GuiLabelButton", + "description": "Label button control, show true when clicked", + "returnType": "int", + "params": [ + { + "type": "Rectangle", + "name": "bounds" + }, + { + "type": "const char *", + "name": "text" + } + ] + }, + { + "name": "GuiToggle", + "description": "Toggle Button control, returns true when active", + "returnType": "int", + "params": [ + { + "type": "Rectangle", + "name": "bounds" + }, + { + "type": "const char *", + "name": "text" + }, + { + "type": "bool *", + "name": "active" + } + ] + }, + { + "name": "GuiToggleGroup", + "description": "Toggle Group control, returns active toggle index", + "returnType": "int", + "params": [ + { + "type": "Rectangle", + "name": "bounds" + }, + { + "type": "const char *", + "name": "text" + }, + { + "type": "int *", + "name": "active" + } + ] + }, + { + "name": "GuiToggleSlider", + "description": "Toggle Slider control, returns true when clicked", + "returnType": "int", + "params": [ + { + "type": "Rectangle", + "name": "bounds" + }, + { + "type": "const char *", + "name": "text" + }, + { + "type": "int *", + "name": "active" + } + ] + }, + { + "name": "GuiCheckBox", + "description": "Check Box control, returns true when active", + "returnType": "int", + "params": [ + { + "type": "Rectangle", + "name": "bounds" + }, + { + "type": "const char *", + "name": "text" + }, + { + "type": "bool *", + "name": "checked" + } + ] + }, + { + "name": "GuiComboBox", + "description": "Combo Box control, returns selected item index", + "returnType": "int", + "params": [ + { + "type": "Rectangle", + "name": "bounds" + }, + { + "type": "const char *", + "name": "text" + }, + { + "type": "int *", + "name": "active" + } + ] + }, + { + "name": "GuiDropdownBox", + "description": "Dropdown Box control, returns selected item", + "returnType": "int", + "params": [ + { + "type": "Rectangle", + "name": "bounds" + }, + { + "type": "const char *", + "name": "text" + }, + { + "type": "int *", + "name": "active" + }, + { + "type": "bool", + "name": "editMode" + } + ] + }, + { + "name": "GuiSpinner", + "description": "Spinner control, returns selected value", + "returnType": "int", + "params": [ + { + "type": "Rectangle", + "name": "bounds" + }, + { + "type": "const char *", + "name": "text" + }, + { + "type": "int *", + "name": "value" + }, + { + "type": "int", + "name": "minValue" + }, + { + "type": "int", + "name": "maxValue" + }, + { + "type": "bool", + "name": "editMode" + } + ] + }, + { + "name": "GuiValueBox", + "description": "Value Box control, updates input text with numbers", + "returnType": "int", + "params": [ + { + "type": "Rectangle", + "name": "bounds" + }, + { + "type": "const char *", + "name": "text" + }, + { + "type": "int *", + "name": "value" + }, + { + "type": "int", + "name": "minValue" + }, + { + "type": "int", + "name": "maxValue" + }, + { + "type": "bool", + "name": "editMode" + } + ] + }, + { + "name": "GuiTextBox", + "description": "Text Box control, updates input text", + "returnType": "int", + "params": [ + { + "type": "Rectangle", + "name": "bounds" + }, + { + "type": "char *", + "name": "text" + }, + { + "type": "int", + "name": "textSize" + }, + { + "type": "bool", + "name": "editMode" + } + ] + }, + { + "name": "GuiSlider", + "description": "Slider control, returns selected value", + "returnType": "int", + "params": [ + { + "type": "Rectangle", + "name": "bounds" + }, + { + "type": "const char *", + "name": "textLeft" + }, + { + "type": "const char *", + "name": "textRight" + }, + { + "type": "float *", + "name": "value" + }, + { + "type": "float", + "name": "minValue" + }, + { + "type": "float", + "name": "maxValue" + } + ] + }, + { + "name": "GuiSliderBar", + "description": "Slider Bar control, returns selected value", + "returnType": "int", + "params": [ + { + "type": "Rectangle", + "name": "bounds" + }, + { + "type": "const char *", + "name": "textLeft" + }, + { + "type": "const char *", + "name": "textRight" + }, + { + "type": "float *", + "name": "value" + }, + { + "type": "float", + "name": "minValue" + }, + { + "type": "float", + "name": "maxValue" + } + ] + }, + { + "name": "GuiProgressBar", + "description": "Progress Bar control, shows current progress value", + "returnType": "int", + "params": [ + { + "type": "Rectangle", + "name": "bounds" + }, + { + "type": "const char *", + "name": "textLeft" + }, + { + "type": "const char *", + "name": "textRight" + }, + { + "type": "float *", + "name": "value" + }, + { + "type": "float", + "name": "minValue" + }, + { + "type": "float", + "name": "maxValue" + } + ] + }, + { + "name": "GuiStatusBar", + "description": "Status Bar control, shows info text", + "returnType": "int", + "params": [ + { + "type": "Rectangle", + "name": "bounds" + }, + { + "type": "const char *", + "name": "text" + } + ] + }, + { + "name": "GuiDummyRec", + "description": "Dummy control for placeholders", + "returnType": "int", + "params": [ + { + "type": "Rectangle", + "name": "bounds" + }, + { + "type": "const char *", + "name": "text" + } + ] + }, + { + "name": "GuiGrid", + "description": "Grid control, returns mouse cell position", + "returnType": "int", + "params": [ + { + "type": "Rectangle", + "name": "bounds" + }, + { + "type": "const char *", + "name": "text" + }, + { + "type": "float", + "name": "spacing" + }, + { + "type": "int", + "name": "subdivs" + }, + { + "type": "Vector2 *", + "name": "mouseCell" + } + ] + }, + { + "name": "GuiListView", + "description": "List View control, returns selected list item index", + "returnType": "int", + "params": [ + { + "type": "Rectangle", + "name": "bounds" + }, + { + "type": "const char *", + "name": "text" + }, + { + "type": "int *", + "name": "scrollIndex" + }, + { + "type": "int *", + "name": "active" + } + ] + }, + { + "name": "GuiListViewEx", + "description": "List View with extended parameters", + "returnType": "int", + "params": [ + { + "type": "Rectangle", + "name": "bounds" + }, + { + "type": "const char **", + "name": "text" + }, + { + "type": "int", + "name": "count" + }, + { + "type": "int *", + "name": "scrollIndex" + }, + { + "type": "int *", + "name": "active" + }, + { + "type": "int *", + "name": "focus" + } + ] + }, + { + "name": "GuiMessageBox", + "description": "Message Box control, displays a message", + "returnType": "int", + "params": [ + { + "type": "Rectangle", + "name": "bounds" + }, + { + "type": "const char *", + "name": "title" + }, + { + "type": "const char *", + "name": "message" + }, + { + "type": "const char *", + "name": "buttons" + } + ] + }, + { + "name": "GuiTextInputBox", + "description": "Text Input Box control, ask for text, supports secret", + "returnType": "int", + "params": [ + { + "type": "Rectangle", + "name": "bounds" + }, + { + "type": "const char *", + "name": "title" + }, + { + "type": "const char *", + "name": "message" + }, + { + "type": "const char *", + "name": "buttons" + }, + { + "type": "char *", + "name": "text" + }, + { + "type": "int", + "name": "textMaxSize" + }, + { + "type": "bool *", + "name": "secretViewActive" + } + ] + }, + { + "name": "GuiColorPicker", + "description": "Color Picker control (multiple color controls)", + "returnType": "int", + "params": [ + { + "type": "Rectangle", + "name": "bounds" + }, + { + "type": "const char *", + "name": "text" + }, + { + "type": "Color *", + "name": "color" + } + ] + }, + { + "name": "GuiColorPanel", + "description": "Color Panel control", + "returnType": "int", + "params": [ + { + "type": "Rectangle", + "name": "bounds" + }, + { + "type": "const char *", + "name": "text" + }, + { + "type": "Color *", + "name": "color" + } + ] + }, + { + "name": "GuiColorBarAlpha", + "description": "Color Bar Alpha control", + "returnType": "int", + "params": [ + { + "type": "Rectangle", + "name": "bounds" + }, + { + "type": "const char *", + "name": "text" + }, + { + "type": "float *", + "name": "alpha" + } + ] + }, + { + "name": "GuiColorBarHue", + "description": "Color Bar Hue control", + "returnType": "int", + "params": [ + { + "type": "Rectangle", + "name": "bounds" + }, + { + "type": "const char *", + "name": "text" + }, + { + "type": "float *", + "name": "value" + } + ] + }, + { + "name": "GuiColorPickerHSV", + "description": "Color Picker control that avoids conversion to RGB on each call (multiple color controls)", + "returnType": "int", + "params": [ + { + "type": "Rectangle", + "name": "bounds" + }, + { + "type": "const char *", + "name": "text" + }, + { + "type": "Vector3 *", + "name": "colorHsv" + } + ] + }, + { + "name": "GuiColorPanelHSV", + "description": "Color Panel control that returns HSV color value, used by GuiColorPickerHSV()", + "returnType": "int", + "params": [ + { + "type": "Rectangle", + "name": "bounds" + }, + { + "type": "const char *", + "name": "text" + }, + { + "type": "Vector3 *", + "name": "colorHsv" + } + ] + } + ] +} diff --git a/libs/raygui/raygui.zig b/libs/raygui/raygui.zig new file mode 100644 index 0000000..0363212 --- /dev/null +++ b/libs/raygui/raygui.zig @@ -0,0 +1,1694 @@ +const std = @import("std"); +const raygui = @cImport({ + @cInclude("raygui.h"); + @cInclude("raygui_marshal.h"); +}); +const raylib = @import("raylib"); + +pub const Rectangle = raylib.Rectangle; +pub const Vector2 = raylib.Vector2; +pub const Color = raylib.Color; +pub const RICON_SIZE = 32; +pub const RICON_DATA_ELEMENTS = 255; + +pub fn textAlignPixelOffset(h: i32) i32 { + return h % 2; +} + +fn bitCheck(a: u32, b: u32) bool { + const r = @shlWithOverflow(1, @as(u5, @truncate(b))); + return (a & (r[0])) != 0; +} + +/// Draw selected icon using rectangles pixel-by-pixel +pub fn GuiDrawIcon( + icon: raygui.GuiIconName, + posX: i32, + posY: i32, + pixelSize: i32, + color: raylib.Color, +) void { + const iconId = @intFromEnum(icon); + + var i: i32 = 0; + var y: i32 = 0; + while (i < RICON_SIZE * RICON_SIZE / 32) : (i += 1) { + var k: u32 = 0; + while (k < 32) : (k += 1) { + if (bitCheck(raygui.guiIcons[@as(usize, @intCast(iconId * RICON_DATA_ELEMENTS + i))], k)) { + _ = raylib.DrawRectangle( + posX + @as(i32, @intCast(k % RICON_SIZE)) * pixelSize, + posY + y * pixelSize, + pixelSize, + pixelSize, + color, + ); + } + + if ((k == 15) or (k == 31)) { + y += 1; + } + } + } +} + +/// Draw button with icon centered +pub fn GuiDrawIconButton(bounds: raylib.Rectangle, icon: GuiIconName, iconTint: raylib.Color) bool { + const pressed = GuiButton(bounds, ""); + GuiDrawIcon( + icon, + @as(i32, @intFromFloat(bounds.x + bounds.width / 2 - @as(f32, @floatFromInt(RICON_SIZE)) / 2)), + @as(i32, @intFromFloat(bounds.y + (bounds.height / 2) - @as(f32, @floatFromInt(RICON_SIZE)) / 2)), + 1, + iconTint, + ); + return pressed; +} + +/// Enable gui controls (global state) +pub fn GuiEnable() void { + raygui.mGuiEnable(); +} + +/// Disable gui controls (global state) +pub fn GuiDisable() void { + raygui.mGuiDisable(); +} + +/// Lock gui controls (global state) +pub fn GuiLock() void { + raygui.mGuiLock(); +} + +/// Unlock gui controls (global state) +pub fn GuiUnlock() void { + raygui.mGuiUnlock(); +} + +/// Check if gui is locked (global state) +pub fn GuiIsLocked() bool { + return raygui.mGuiIsLocked(); +} + +/// Set gui controls alpha (global state), alpha goes from 0.0f to 1.0f +pub fn GuiSetAlpha( + alpha: f32, +) void { + raygui.mGuiSetAlpha( + alpha, + ); +} + +/// Set gui state (global state) +pub fn GuiSetState( + state: GuiState, +) void { + raygui.mGuiSetState( + @intFromEnum(state), + ); +} + +/// Get gui state (global state) +pub fn GuiGetState() GuiState { + var out: GuiState = undefined; + raygui.mGuiGetState( + @as([*c]GuiState, @ptrCast(&out)), + ); + return out; +} + +/// Set gui custom font (global state) +pub fn GuiSetFont( + font: Font, +) void { + raygui.mGuiSetFont( + @as([*c]raygui.Font, @ptrFromInt(@intFromPtr(&font))), + ); +} + +/// Get gui custom font (global state) +pub fn GuiGetFont() Font { + var out: Font = undefined; + raygui.mGuiGetFont( + @as([*c]raygui.Font, @ptrCast(&out)), + ); + return out; +} + +/// Set one style property +pub fn GuiSetStyle( + control: i32, + property: i32, + value: i32, +) void { + raygui.mGuiSetStyle( + control, + property, + value, + ); +} + +/// Get one style property +pub fn GuiGetStyle( + control: GuiControl, + property: i32, +) i32 { + return raygui.mGuiGetStyle( + @intFromEnum(control), + property, + ); +} + +/// Load style file over global style variable (.rgs) +pub fn GuiLoadStyle( + fileName: [*:0]const u8, +) void { + raygui.mGuiLoadStyle( + @as([*c]const u8, @ptrFromInt(@intFromPtr(fileName))), + ); +} + +/// Load style default over global style +pub fn GuiLoadStyleDefault() void { + raygui.mGuiLoadStyleDefault(); +} + +/// Enable gui tooltips (global state) +pub fn GuiEnableTooltip() void { + raygui.mGuiEnableTooltip(); +} + +/// Disable gui tooltips (global state) +pub fn GuiDisableTooltip() void { + raygui.mGuiDisableTooltip(); +} + +/// Set tooltip string +pub fn GuiSetTooltip( + tooltip: [*:0]const u8, +) void { + raygui.mGuiSetTooltip( + @as([*c]const u8, @ptrFromInt(@intFromPtr(tooltip))), + ); +} + +/// Get text with icon id prepended (if supported) +pub fn GuiIconText( + iconId: i32, + text: [*:0]const u8, +) [*:0]const u8 { + return @as( + [*:0]const u8, + @ptrCast(raygui.mGuiIconText( + iconId, + @as([*c]const u8, @ptrFromInt(@intFromPtr(text))), + )), + ); +} + +/// Set default icon drawing size +pub fn GuiSetIconScale( + scale: i32, +) void { + raygui.mGuiSetIconScale( + scale, + ); +} + +/// Get raygui icons data pointer +pub fn GuiGetIcons() *u32 { + return @as( + *u32, + @ptrCast(raygui.mGuiGetIcons()), + ); +} + +/// Load raygui icons file (.rgi) into internal icons data +pub fn GuiLoadIcons( + fileName: [*:0]const u8, + loadIconsName: bool, +) [*][*:0]u8 { + return @as( + [*][*:0]u8, + @ptrCast(raygui.mGuiLoadIcons( + @as([*c]const u8, @ptrFromInt(@intFromPtr(fileName))), + loadIconsName, + )), + ); +} + +/// Window Box control, shows a window that can be closed +pub fn GuiWindowBox( + bounds: Rectangle, + title: [*:0]const u8, +) i32 { + return raygui.mGuiWindowBox( + @as([*c]raygui.Rectangle, @ptrFromInt(@intFromPtr(&bounds))), + @as([*c]const u8, @ptrFromInt(@intFromPtr(title))), + ); +} + +/// Group Box control with text name +pub fn GuiGroupBox( + bounds: Rectangle, + text: [*:0]const u8, +) i32 { + return raygui.mGuiGroupBox( + @as([*c]raygui.Rectangle, @ptrFromInt(@intFromPtr(&bounds))), + @as([*c]const u8, @ptrFromInt(@intFromPtr(text))), + ); +} + +/// Line separator control, could contain text +pub fn GuiLine( + bounds: Rectangle, + text: [*:0]const u8, +) i32 { + return raygui.mGuiLine( + @as([*c]raygui.Rectangle, @ptrFromInt(@intFromPtr(&bounds))), + @as([*c]const u8, @ptrFromInt(@intFromPtr(text))), + ); +} + +/// Panel control, useful to group controls +pub fn GuiPanel( + bounds: Rectangle, + text: [*:0]const u8, +) i32 { + return raygui.mGuiPanel( + @as([*c]raygui.Rectangle, @ptrFromInt(@intFromPtr(&bounds))), + @as([*c]const u8, @ptrFromInt(@intFromPtr(text))), + ); +} + +/// Tab Bar control, returns TAB to be closed or -1 +pub fn GuiTabBar( + bounds: Rectangle, + text: [*]const [*:0]const u8, + count: i32, + active: *i32, +) i32 { + return raygui.mGuiTabBar( + @as([*c]raygui.Rectangle, @ptrFromInt(@intFromPtr(&bounds))), + @as([*c]const [*:0]const u8, @ptrFromInt(@intFromPtr(text))), + count, + @as([*c]i32, @ptrCast(active)), + ); +} + +/// Scroll Panel control +pub fn GuiScrollPanel( + bounds: Rectangle, + text: [*:0]const u8, + content: Rectangle, + scroll: *Vector2, + view: *Rectangle, +) i32 { + return raygui.mGuiScrollPanel( + @as([*c]raygui.Rectangle, @ptrFromInt(@intFromPtr(&bounds))), + @as([*c]const u8, @ptrFromInt(@intFromPtr(text))), + @as([*c]raygui.Rectangle, @ptrFromInt(@intFromPtr(&content))), + @as([*c]raygui.Vector2, @ptrFromInt(@intFromPtr(scroll))), + @as([*c]raygui.Rectangle, @ptrFromInt(@intFromPtr(view))), + ); +} + +/// Label control, shows text +pub fn GuiLabel( + bounds: Rectangle, + text: [*:0]const u8, +) i32 { + return raygui.mGuiLabel( + @as([*c]raygui.Rectangle, @ptrFromInt(@intFromPtr(&bounds))), + @as([*c]const u8, @ptrFromInt(@intFromPtr(text))), + ); +} + +/// Button control, returns true when clicked +pub fn GuiButton( + bounds: Rectangle, + text: [*:0]const u8, +) i32 { + return raygui.mGuiButton( + @as([*c]raygui.Rectangle, @ptrFromInt(@intFromPtr(&bounds))), + @as([*c]const u8, @ptrFromInt(@intFromPtr(text))), + ); +} + +/// Label button control, show true when clicked +pub fn GuiLabelButton( + bounds: Rectangle, + text: [*:0]const u8, +) i32 { + return raygui.mGuiLabelButton( + @as([*c]raygui.Rectangle, @ptrFromInt(@intFromPtr(&bounds))), + @as([*c]const u8, @ptrFromInt(@intFromPtr(text))), + ); +} + +/// Toggle Button control, returns true when active +pub fn GuiToggle( + bounds: Rectangle, + text: [*:0]const u8, + active: *bool, +) i32 { + return raygui.mGuiToggle( + @as([*c]raygui.Rectangle, @ptrFromInt(@intFromPtr(&bounds))), + @as([*c]const u8, @ptrFromInt(@intFromPtr(text))), + @as([*c]bool, @ptrCast(active)), + ); +} + +/// Toggle Group control, returns active toggle index +pub fn GuiToggleGroup( + bounds: Rectangle, + text: [*:0]const u8, + active: *i32, +) i32 { + return raygui.mGuiToggleGroup( + @as([*c]raygui.Rectangle, @ptrFromInt(@intFromPtr(&bounds))), + @as([*c]const u8, @ptrFromInt(@intFromPtr(text))), + @as([*c]i32, @ptrCast(active)), + ); +} + +/// Toggle Slider control, returns true when clicked +pub fn GuiToggleSlider( + bounds: Rectangle, + text: [*:0]const u8, + active: *i32, +) i32 { + return raygui.mGuiToggleSlider( + @as([*c]raygui.Rectangle, @ptrFromInt(@intFromPtr(&bounds))), + @as([*c]const u8, @ptrFromInt(@intFromPtr(text))), + @as([*c]i32, @ptrCast(active)), + ); +} + +/// Check Box control, returns true when active +pub fn GuiCheckBox( + bounds: Rectangle, + text: [*:0]const u8, + checked: *bool, +) i32 { + return raygui.mGuiCheckBox( + @as([*c]raygui.Rectangle, @ptrFromInt(@intFromPtr(&bounds))), + @as([*c]const u8, @ptrFromInt(@intFromPtr(text))), + @as([*c]bool, @ptrCast(checked)), + ); +} + +/// Combo Box control, returns selected item index +pub fn GuiComboBox( + bounds: Rectangle, + text: [*:0]const u8, + active: *i32, +) i32 { + return raygui.mGuiComboBox( + @as([*c]raygui.Rectangle, @ptrFromInt(@intFromPtr(&bounds))), + @as([*c]const u8, @ptrFromInt(@intFromPtr(text))), + @as([*c]i32, @ptrCast(active)), + ); +} + +/// Dropdown Box control, returns selected item +pub fn GuiDropdownBox( + bounds: Rectangle, + text: [*:0]const u8, + active: *i32, + editMode: bool, +) i32 { + return raygui.mGuiDropdownBox( + @as([*c]raygui.Rectangle, @ptrFromInt(@intFromPtr(&bounds))), + @as([*c]const u8, @ptrFromInt(@intFromPtr(text))), + @as([*c]i32, @ptrCast(active)), + editMode, + ); +} + +/// Spinner control, returns selected value +pub fn GuiSpinner( + bounds: Rectangle, + text: [*:0]const u8, + value: *i32, + minValue: i32, + maxValue: i32, + editMode: bool, +) i32 { + return raygui.mGuiSpinner( + @as([*c]raygui.Rectangle, @ptrFromInt(@intFromPtr(&bounds))), + @as([*c]const u8, @ptrFromInt(@intFromPtr(text))), + @as([*c]i32, @ptrCast(value)), + minValue, + maxValue, + editMode, + ); +} + +/// Value Box control, updates input text with numbers +pub fn GuiValueBox( + bounds: Rectangle, + text: [*:0]const u8, + value: *i32, + minValue: i32, + maxValue: i32, + editMode: bool, +) i32 { + return raygui.mGuiValueBox( + @as([*c]raygui.Rectangle, @ptrFromInt(@intFromPtr(&bounds))), + @as([*c]const u8, @ptrFromInt(@intFromPtr(text))), + @as([*c]i32, @ptrCast(value)), + minValue, + maxValue, + editMode, + ); +} + +/// Text Box control, updates input text +pub fn GuiTextBox( + bounds: Rectangle, + text: ?[*:0]u8, + textSize: i32, + editMode: bool, +) i32 { + return raygui.mGuiTextBox( + @as([*c]raygui.Rectangle, @ptrFromInt(@intFromPtr(&bounds))), + @as([*c]u8, @ptrCast(text)), + textSize, + editMode, + ); +} + +/// Slider control, returns selected value +pub fn GuiSlider( + bounds: Rectangle, + textLeft: [*:0]const u8, + textRight: [*:0]const u8, + value: *f32, + minValue: f32, + maxValue: f32, +) i32 { + return raygui.mGuiSlider( + @as([*c]raygui.Rectangle, @ptrFromInt(@intFromPtr(&bounds))), + @as([*c]const u8, @ptrFromInt(@intFromPtr(textLeft))), + @as([*c]const u8, @ptrFromInt(@intFromPtr(textRight))), + @as([*c]f32, @ptrCast(value)), + minValue, + maxValue, + ); +} + +/// Slider Bar control, returns selected value +pub fn GuiSliderBar( + bounds: Rectangle, + textLeft: [*:0]const u8, + textRight: [*:0]const u8, + value: *f32, + minValue: f32, + maxValue: f32, +) i32 { + return raygui.mGuiSliderBar( + @as([*c]raygui.Rectangle, @ptrFromInt(@intFromPtr(&bounds))), + @as([*c]const u8, @ptrFromInt(@intFromPtr(textLeft))), + @as([*c]const u8, @ptrFromInt(@intFromPtr(textRight))), + @as([*c]f32, @ptrCast(value)), + minValue, + maxValue, + ); +} + +/// Progress Bar control, shows current progress value +pub fn GuiProgressBar( + bounds: Rectangle, + textLeft: [*:0]const u8, + textRight: [*:0]const u8, + value: *f32, + minValue: f32, + maxValue: f32, +) i32 { + return raygui.mGuiProgressBar( + @as([*c]raygui.Rectangle, @ptrFromInt(@intFromPtr(&bounds))), + @as([*c]const u8, @ptrFromInt(@intFromPtr(textLeft))), + @as([*c]const u8, @ptrFromInt(@intFromPtr(textRight))), + @as([*c]f32, @ptrCast(value)), + minValue, + maxValue, + ); +} + +/// Status Bar control, shows info text +pub fn GuiStatusBar( + bounds: Rectangle, + text: [*:0]const u8, +) i32 { + return raygui.mGuiStatusBar( + @as([*c]raygui.Rectangle, @ptrFromInt(@intFromPtr(&bounds))), + @as([*c]const u8, @ptrFromInt(@intFromPtr(text))), + ); +} + +/// Dummy control for placeholders +pub fn GuiDummyRec( + bounds: Rectangle, + text: [*:0]const u8, +) i32 { + return raygui.mGuiDummyRec( + @as([*c]raygui.Rectangle, @ptrFromInt(@intFromPtr(&bounds))), + @as([*c]const u8, @ptrFromInt(@intFromPtr(text))), + ); +} + +/// Grid control, returns mouse cell position +pub fn GuiGrid( + bounds: Rectangle, + text: [*:0]const u8, + spacing: f32, + subdivs: i32, + mouseCell: *Vector2, +) i32 { + return raygui.mGuiGrid( + @as([*c]raygui.Rectangle, @ptrFromInt(@intFromPtr(&bounds))), + @as([*c]const u8, @ptrFromInt(@intFromPtr(text))), + spacing, + subdivs, + @as([*c]raygui.Vector2, @ptrFromInt(@intFromPtr(mouseCell))), + ); +} + +/// List View control, returns selected list item index +pub fn GuiListView( + bounds: Rectangle, + text: [*:0]const u8, + scrollIndex: *i32, + active: *i32, +) i32 { + return raygui.mGuiListView( + @as([*c]raygui.Rectangle, @ptrFromInt(@intFromPtr(&bounds))), + @as([*c]const u8, @ptrFromInt(@intFromPtr(text))), + @as([*c]i32, @ptrCast(scrollIndex)), + @as([*c]i32, @ptrCast(active)), + ); +} + +/// List View with extended parameters +pub fn GuiListViewEx( + bounds: Rectangle, + text: [*]const [*:0]const u8, + count: i32, + scrollIndex: *i32, + active: *i32, + focus: *i32, +) i32 { + return raygui.mGuiListViewEx( + @as([*c]raygui.Rectangle, @ptrFromInt(@intFromPtr(&bounds))), + @as([*c]const [*:0]const u8, @ptrFromInt(@intFromPtr(text))), + count, + @as([*c]i32, @ptrCast(scrollIndex)), + @as([*c]i32, @ptrCast(active)), + @as([*c]i32, @ptrCast(focus)), + ); +} + +/// Message Box control, displays a message +pub fn GuiMessageBox( + bounds: Rectangle, + title: [*:0]const u8, + message: [*:0]const u8, + buttons: [*:0]const u8, +) i32 { + return raygui.mGuiMessageBox( + @as([*c]raygui.Rectangle, @ptrFromInt(@intFromPtr(&bounds))), + @as([*c]const u8, @ptrFromInt(@intFromPtr(title))), + @as([*c]const u8, @ptrFromInt(@intFromPtr(message))), + @as([*c]const u8, @ptrFromInt(@intFromPtr(buttons))), + ); +} + +/// Text Input Box control, ask for text, supports secret +pub fn GuiTextInputBox( + bounds: Rectangle, + title: [*:0]const u8, + message: [*:0]const u8, + buttons: [*:0]const u8, + text: ?[*:0]u8, + textMaxSize: i32, + secretViewActive: *bool, +) i32 { + return raygui.mGuiTextInputBox( + @as([*c]raygui.Rectangle, @ptrFromInt(@intFromPtr(&bounds))), + @as([*c]const u8, @ptrFromInt(@intFromPtr(title))), + @as([*c]const u8, @ptrFromInt(@intFromPtr(message))), + @as([*c]const u8, @ptrFromInt(@intFromPtr(buttons))), + @as([*c]u8, @ptrCast(text)), + textMaxSize, + @as([*c]bool, @ptrCast(secretViewActive)), + ); +} + +/// Color Picker control (multiple color controls) +pub fn GuiColorPicker( + bounds: Rectangle, + text: [*:0]const u8, + color: *Color, +) i32 { + return raygui.mGuiColorPicker( + @as([*c]raygui.Rectangle, @ptrFromInt(@intFromPtr(&bounds))), + @as([*c]const u8, @ptrFromInt(@intFromPtr(text))), + @as([*c]raygui.Color, @ptrFromInt(@intFromPtr(color))), + ); +} + +/// Color Panel control +pub fn GuiColorPanel( + bounds: Rectangle, + text: [*:0]const u8, + color: *Color, +) i32 { + return raygui.mGuiColorPanel( + @as([*c]raygui.Rectangle, @ptrFromInt(@intFromPtr(&bounds))), + @as([*c]const u8, @ptrFromInt(@intFromPtr(text))), + @as([*c]raygui.Color, @ptrFromInt(@intFromPtr(color))), + ); +} + +/// Color Bar Alpha control +pub fn GuiColorBarAlpha( + bounds: Rectangle, + text: [*:0]const u8, + alpha: *f32, +) i32 { + return raygui.mGuiColorBarAlpha( + @as([*c]raygui.Rectangle, @ptrFromInt(@intFromPtr(&bounds))), + @as([*c]const u8, @ptrFromInt(@intFromPtr(text))), + @as([*c]f32, @ptrCast(alpha)), + ); +} + +/// Color Bar Hue control +pub fn GuiColorBarHue( + bounds: Rectangle, + text: [*:0]const u8, + value: *f32, +) i32 { + return raygui.mGuiColorBarHue( + @as([*c]raygui.Rectangle, @ptrFromInt(@intFromPtr(&bounds))), + @as([*c]const u8, @ptrFromInt(@intFromPtr(text))), + @as([*c]f32, @ptrCast(value)), + ); +} + +/// Color Picker control that avoids conversion to RGB on each call (multiple color controls) +pub fn GuiColorPickerHSV( + bounds: Rectangle, + text: [*:0]const u8, + colorHsv: *Vector3, +) i32 { + return raygui.mGuiColorPickerHSV( + @as([*c]raygui.Rectangle, @ptrFromInt(@intFromPtr(&bounds))), + @as([*c]const u8, @ptrFromInt(@intFromPtr(text))), + @as([*c]raygui.Vector3, @ptrFromInt(@intFromPtr(colorHsv))), + ); +} + +/// Color Panel control that returns HSV color value, used by GuiColorPickerHSV() +pub fn GuiColorPanelHSV( + bounds: Rectangle, + text: [*:0]const u8, + colorHsv: *Vector3, +) i32 { + return raygui.mGuiColorPanelHSV( + @as([*c]raygui.Rectangle, @ptrFromInt(@intFromPtr(&bounds))), + @as([*c]const u8, @ptrFromInt(@intFromPtr(text))), + @as([*c]raygui.Vector3, @ptrFromInt(@intFromPtr(colorHsv))), + ); +} + +/// Vector3 type // -- ConvertHSVtoRGB(), ConvertRGBtoHSV() +pub const Vector3 = extern struct { + /// + x: f32, + /// + y: f32, + /// + z: f32, +}; + +/// It should be redesigned to be provided by user +pub const Texture2D = extern struct { + /// OpenGL texture id + id: u32, + /// Texture base width + width: i32, + /// Texture base height + height: i32, + /// Mipmap levels, 1 by default + mipmaps: i32, + /// Data format (PixelFormat type) + format: i32, +}; + +/// Image, pixel data stored in CPU memory (RAM) +pub const Image = extern struct { + /// Image raw data + data: *anyopaque, + /// Image base width + width: i32, + /// Image base height + height: i32, + /// Mipmap levels, 1 by default + mipmaps: i32, + /// Data format (PixelFormat type) + format: i32, +}; + +/// GlyphInfo, font characters glyphs info +pub const GlyphInfo = extern struct { + /// Character value (Unicode) + value: i32, + /// Character offset X when drawing + offsetX: i32, + /// Character offset Y when drawing + offsetY: i32, + /// Character advance position X + advanceX: i32, + /// Character image data + image: Image, +}; + +/// It should be redesigned to be provided by user +pub const Font = extern struct { + /// Base size (default chars height) + baseSize: i32, + /// Number of glyph characters + glyphCount: i32, + /// Padding around the glyph characters + glyphPadding: i32, + /// Texture atlas containing the glyphs + texture: Texture2D, + /// Rectangles in texture for the glyphs + recs: *Rectangle, + /// Glyphs info data + glyphs: *GlyphInfo, +}; + +/// NOTE: Used when exporting style as code for convenience +pub const GuiStyleProp = extern struct { + /// Control identifier + controlId: u16, + /// Property identifier + propertyId: u16, + /// Property value + propertyValue: i32, +}; + +/// NOTE: Text style is defined by control +pub const GuiTextStyle = extern struct { + /// + size: u32, + /// + charSpacing: i32, + /// + lineSpacing: i32, + /// + alignmentH: i32, + /// + alignmentV: i32, + /// + padding: i32, +}; + +/// Gui control state +pub const GuiState = enum(i32) { + /// + STATE_NORMAL = 0, + /// + STATE_FOCUSED = 1, + /// + STATE_PRESSED = 2, + /// + STATE_DISABLED = 3, +}; + +/// Gui control text alignment +pub const GuiTextAlignment = enum(i32) { + /// + TEXT_ALIGN_LEFT = 0, + /// + TEXT_ALIGN_CENTER = 1, + /// + TEXT_ALIGN_RIGHT = 2, +}; + +/// Gui control text alignment vertical +pub const GuiTextAlignmentVertical = enum(i32) { + /// + TEXT_ALIGN_TOP = 0, + /// + TEXT_ALIGN_MIDDLE = 1, + /// + TEXT_ALIGN_BOTTOM = 2, +}; + +/// Gui control text wrap mode +pub const GuiTextWrapMode = enum(i32) { + /// + TEXT_WRAP_NONE = 0, + /// + TEXT_WRAP_CHAR = 1, + /// + TEXT_WRAP_WORD = 2, +}; + +/// Gui controls +pub const GuiControl = enum(i32) { + /// + DEFAULT = 0, + /// Used also for: LABELBUTTON + LABEL = 1, + /// + BUTTON = 2, + /// Used also for: TOGGLEGROUP + TOGGLE = 3, + /// Used also for: SLIDERBAR, TOGGLESLIDER + SLIDER = 4, + /// + PROGRESSBAR = 5, + /// + CHECKBOX = 6, + /// + COMBOBOX = 7, + /// + DROPDOWNBOX = 8, + /// Used also for: TEXTBOXMULTI + TEXTBOX = 9, + /// + VALUEBOX = 10, + /// Uses: BUTTON, VALUEBOX + SPINNER = 11, + /// + LISTVIEW = 12, + /// + COLORPICKER = 13, + /// + SCROLLBAR = 14, + /// + STATUSBAR = 15, +}; + +/// Gui base properties for every control +pub const GuiControlProperty = enum(i32) { + /// Control border color in STATE_NORMAL + BORDER_COLOR_NORMAL = 0, + /// Control base color in STATE_NORMAL + BASE_COLOR_NORMAL = 1, + /// Control text color in STATE_NORMAL + TEXT_COLOR_NORMAL = 2, + /// Control border color in STATE_FOCUSED + BORDER_COLOR_FOCUSED = 3, + /// Control base color in STATE_FOCUSED + BASE_COLOR_FOCUSED = 4, + /// Control text color in STATE_FOCUSED + TEXT_COLOR_FOCUSED = 5, + /// Control border color in STATE_PRESSED + BORDER_COLOR_PRESSED = 6, + /// Control base color in STATE_PRESSED + BASE_COLOR_PRESSED = 7, + /// Control text color in STATE_PRESSED + TEXT_COLOR_PRESSED = 8, + /// Control border color in STATE_DISABLED + BORDER_COLOR_DISABLED = 9, + /// Control base color in STATE_DISABLED + BASE_COLOR_DISABLED = 10, + /// Control text color in STATE_DISABLED + TEXT_COLOR_DISABLED = 11, + /// Control border size, 0 for no border + BORDER_WIDTH = 12, + /// Control text padding, not considering border + TEXT_PADDING = 13, + /// Control text horizontal alignment inside control text bound (after border and padding) + TEXT_ALIGNMENT = 14, +}; + +/// DEFAULT extended properties +pub const GuiDefaultProperty = enum(i32) { + /// Text size (glyphs max height) + TEXT_SIZE = 16, + /// Text spacing between glyphs + TEXT_SPACING = 17, + /// Line control color + LINE_COLOR = 18, + /// Background color + BACKGROUND_COLOR = 19, + /// Text spacing between lines + TEXT_LINE_SPACING = 20, + /// Text vertical alignment inside text bounds (after border and padding) + TEXT_ALIGNMENT_VERTICAL = 21, + /// Text wrap-mode inside text bounds + TEXT_WRAP_MODE = 22, +}; + +/// Toggle/ToggleGroup +pub const GuiToggleProperty = enum(i32) { + /// ToggleGroup separation between toggles + GROUP_PADDING = 16, +}; + +/// Slider/SliderBar +pub const GuiSliderProperty = enum(i32) { + /// Slider size of internal bar + SLIDER_WIDTH = 16, + /// Slider/SliderBar internal bar padding + SLIDER_PADDING = 17, +}; + +/// ProgressBar +pub const GuiProgressBarProperty = enum(i32) { + /// ProgressBar internal padding + PROGRESS_PADDING = 16, +}; + +/// ScrollBar +pub const GuiScrollBarProperty = enum(i32) { + /// ScrollBar arrows size + ARROWS_SIZE = 16, + /// ScrollBar arrows visible + ARROWS_VISIBLE = 17, + /// ScrollBar slider internal padding + SCROLL_SLIDER_PADDING = 18, + /// ScrollBar slider size + SCROLL_SLIDER_SIZE = 19, + /// ScrollBar scroll padding from arrows + SCROLL_PADDING = 20, + /// ScrollBar scrolling speed + SCROLL_SPEED = 21, +}; + +/// CheckBox +pub const GuiCheckBoxProperty = enum(i32) { + /// CheckBox internal check padding + CHECK_PADDING = 16, +}; + +/// ComboBox +pub const GuiComboBoxProperty = enum(i32) { + /// ComboBox right button width + COMBO_BUTTON_WIDTH = 16, + /// ComboBox button separation + COMBO_BUTTON_SPACING = 17, +}; + +/// DropdownBox +pub const GuiDropdownBoxProperty = enum(i32) { + /// DropdownBox arrow separation from border and items + ARROW_PADDING = 16, + /// DropdownBox items separation + DROPDOWN_ITEMS_SPACING = 17, +}; + +/// TextBox/TextBoxMulti/ValueBox/Spinner +pub const GuiTextBoxProperty = enum(i32) { + /// TextBox in read-only mode: 0-text editable, 1-text no-editable + TEXT_READONLY = 16, +}; + +/// Spinner +pub const GuiSpinnerProperty = enum(i32) { + /// Spinner left/right buttons width + SPIN_BUTTON_WIDTH = 16, + /// Spinner buttons separation + SPIN_BUTTON_SPACING = 17, +}; + +/// ListView +pub const GuiListViewProperty = enum(i32) { + /// ListView items height + LIST_ITEMS_HEIGHT = 16, + /// ListView items separation + LIST_ITEMS_SPACING = 17, + /// ListView scrollbar size (usually width) + SCROLLBAR_WIDTH = 18, + /// ListView scrollbar side (0-SCROLLBAR_LEFT_SIDE, 1-SCROLLBAR_RIGHT_SIDE) + SCROLLBAR_SIDE = 19, +}; + +/// ColorPicker +pub const GuiColorPickerProperty = enum(i32) { + /// + COLOR_SELECTOR_SIZE = 16, + /// ColorPicker right hue bar width + HUEBAR_WIDTH = 17, + /// ColorPicker right hue bar separation from panel + HUEBAR_PADDING = 18, + /// ColorPicker right hue bar selector height + HUEBAR_SELECTOR_HEIGHT = 19, + /// ColorPicker right hue bar selector overflow + HUEBAR_SELECTOR_OVERFLOW = 20, +}; + +/// +pub const GuiIconName = enum(i32) { + /// + 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, +}; + +/// +pub const RAYGUI_VERSION_MAJOR: i32 = 4; + +/// +pub const RAYGUI_VERSION_MINOR: i32 = 0; + +/// +pub const RAYGUI_VERSION_PATCH: i32 = 0; + +/// +pub const RAYGUI_VERSION: []const u8 = "4.0"; + +/// +pub const SCROLLBAR_LEFT_SIDE: i32 = 0; + +/// +pub const SCROLLBAR_RIGHT_SIDE: i32 = 1; + +/// Size of icons in pixels (squared) +pub const RAYGUI_ICON_SIZE: i32 = 16; + +/// Maximum number of icons +pub const RAYGUI_ICON_MAX_ICONS: i32 = 256; + +/// Maximum length of icon name id +pub const RAYGUI_ICON_MAX_NAME_LENGTH: i32 = 32; + +/// Maximum number of controls +pub const RAYGUI_MAX_CONTROLS: i32 = 16; + +/// Maximum number of base properties +pub const RAYGUI_MAX_PROPS_BASE: i32 = 16; + +/// Maximum number of extended properties +pub const RAYGUI_MAX_PROPS_EXTENDED: i32 = 8; + +/// +pub const KEY_RIGHT: i32 = 262; + +/// +pub const KEY_LEFT: i32 = 263; + +/// +pub const KEY_DOWN: i32 = 264; + +/// +pub const KEY_UP: i32 = 265; + +/// +pub const KEY_BACKSPACE: i32 = 259; + +/// +pub const KEY_ENTER: i32 = 257; + +/// +pub const MOUSE_LEFT_BUTTON: i32 = 0; + +/// +pub const RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT: i32 = 24; + +/// +pub const RAYGUI_GROUPBOX_LINE_THICK: i32 = 1; + +/// +pub const RAYGUI_LINE_MARGIN_TEXT: i32 = 12; + +/// +pub const RAYGUI_LINE_TEXT_PADDING: i32 = 4; + +/// +pub const RAYGUI_PANEL_BORDER_WIDTH: i32 = 1; + +/// +pub const RAYGUI_TABBAR_ITEM_WIDTH: i32 = 160; + +/// +pub const RAYGUI_MIN_SCROLLBAR_WIDTH: i32 = 40; + +/// +pub const RAYGUI_MIN_SCROLLBAR_HEIGHT: i32 = 40; + +/// +pub const RAYGUI_TOGGLEGROUP_MAX_ITEMS: i32 = 32; + +/// Frames to wait for autocursor movement +pub const RAYGUI_TEXTBOX_AUTO_CURSOR_COOLDOWN: i32 = 40; + +/// Frames delay for autocursor movement +pub const RAYGUI_TEXTBOX_AUTO_CURSOR_DELAY: i32 = 1; + +/// +pub const RAYGUI_VALUEBOX_MAX_CHARS: i32 = 32; + +/// +pub const RAYGUI_COLORBARALPHA_CHECKED_SIZE: i32 = 10; + +/// +pub const RAYGUI_MESSAGEBOX_BUTTON_HEIGHT: i32 = 24; + +/// +pub const RAYGUI_MESSAGEBOX_BUTTON_PADDING: i32 = 12; + +/// +pub const RAYGUI_TEXTINPUTBOX_BUTTON_HEIGHT: i32 = 24; + +/// +pub const RAYGUI_TEXTINPUTBOX_BUTTON_PADDING: i32 = 12; + +/// +pub const RAYGUI_TEXTINPUTBOX_HEIGHT: i32 = 26; + +/// +pub const RAYGUI_GRID_ALPHA: f32 = 0.15; + +/// +pub const MAX_LINE_BUFFER_SIZE: i32 = 256; + +/// +pub const ICON_TEXT_PADDING: i32 = 4; + +/// +pub const RAYGUI_MAX_TEXT_LINES: i32 = 128; + +/// +pub const RAYGUI_TEXTSPLIT_MAX_ITEMS: i32 = 128; + +/// +pub const RAYGUI_TEXTSPLIT_MAX_TEXT_SIZE: i32 = 1024; + +/// +pub const RAYGUI_TEXTFORMAT_MAX_SIZE: i32 = 256; diff --git a/libs/raygui/raygui_marshal.c b/libs/raygui/raygui_marshal.c new file mode 100644 index 0000000..3967324 --- /dev/null +++ b/libs/raygui/raygui_marshal.c @@ -0,0 +1,277 @@ +#include "raygui.h" + +void mGuiEnable(void) +{ + GuiEnable(); +} + +void mGuiDisable(void) +{ + GuiDisable(); +} + +void mGuiLock(void) +{ + GuiLock(); +} + +void mGuiUnlock(void) +{ + GuiUnlock(); +} + +bool mGuiIsLocked(void) +{ + return GuiIsLocked(); +} + +void mGuiSetAlpha(float alpha) +{ + GuiSetAlpha(alpha); +} + +void mGuiSetState(int state) +{ + GuiSetState(state); +} + +int mGuiGetState(void) +{ + return GuiGetState(); +} + +void mGuiSetFont(Font *font) +{ + GuiSetFont(*font); +} + +void mGuiGetFont(Font *out) +{ + *out = GuiGetFont(); +} + +void mGuiSetStyle(int control, int property, int value) +{ + GuiSetStyle(control, property, value); +} + +int mGuiGetStyle(int control, int property) +{ + return GuiGetStyle(control, property); +} + +void mGuiLoadStyle(const char * fileName) +{ + GuiLoadStyle(fileName); +} + +void mGuiLoadStyleDefault(void) +{ + GuiLoadStyleDefault(); +} + +void mGuiEnableTooltip(void) +{ + GuiEnableTooltip(); +} + +void mGuiDisableTooltip(void) +{ + GuiDisableTooltip(); +} + +void mGuiSetTooltip(const char * tooltip) +{ + GuiSetTooltip(tooltip); +} + +const char * mGuiIconText(int iconId, const char * text) +{ + return GuiIconText(iconId, text); +} + +void mGuiSetIconScale(int scale) +{ + GuiSetIconScale(scale); +} + +unsigned int * mGuiGetIcons(void) +{ + return GuiGetIcons(); +} + +char ** mGuiLoadIcons(const char * fileName, bool loadIconsName) +{ + return GuiLoadIcons(fileName, loadIconsName); +} + +int mGuiWindowBox(Rectangle *bounds, const char * title) +{ + return GuiWindowBox(*bounds, title); +} + +int mGuiGroupBox(Rectangle *bounds, const char * text) +{ + return GuiGroupBox(*bounds, text); +} + +int mGuiLine(Rectangle *bounds, const char * text) +{ + return GuiLine(*bounds, text); +} + +int mGuiPanel(Rectangle *bounds, const char * text) +{ + return GuiPanel(*bounds, text); +} + +int mGuiTabBar(Rectangle *bounds, const char ** text, int count, int * active) +{ + return GuiTabBar(*bounds, text, count, active); +} + +int mGuiScrollPanel(Rectangle *bounds, const char * text, Rectangle *content, Vector2 * scroll, Rectangle * view) +{ + return GuiScrollPanel(*bounds, text, *content, scroll, view); +} + +int mGuiLabel(Rectangle *bounds, const char * text) +{ + return GuiLabel(*bounds, text); +} + +int mGuiButton(Rectangle *bounds, const char * text) +{ + return GuiButton(*bounds, text); +} + +int mGuiLabelButton(Rectangle *bounds, const char * text) +{ + return GuiLabelButton(*bounds, text); +} + +int mGuiToggle(Rectangle *bounds, const char * text, bool * active) +{ + return GuiToggle(*bounds, text, active); +} + +int mGuiToggleGroup(Rectangle *bounds, const char * text, int * active) +{ + return GuiToggleGroup(*bounds, text, active); +} + +int mGuiToggleSlider(Rectangle *bounds, const char * text, int * active) +{ + return GuiToggleSlider(*bounds, text, active); +} + +int mGuiCheckBox(Rectangle *bounds, const char * text, bool * checked) +{ + return GuiCheckBox(*bounds, text, checked); +} + +int mGuiComboBox(Rectangle *bounds, const char * text, int * active) +{ + return GuiComboBox(*bounds, text, active); +} + +int mGuiDropdownBox(Rectangle *bounds, const char * text, int * active, bool editMode) +{ + return GuiDropdownBox(*bounds, text, active, editMode); +} + +int mGuiSpinner(Rectangle *bounds, const char * text, int * value, int minValue, int maxValue, bool editMode) +{ + return GuiSpinner(*bounds, text, value, minValue, maxValue, editMode); +} + +int mGuiValueBox(Rectangle *bounds, const char * text, int * value, int minValue, int maxValue, bool editMode) +{ + return GuiValueBox(*bounds, text, value, minValue, maxValue, editMode); +} + +int mGuiTextBox(Rectangle *bounds, char * text, int textSize, bool editMode) +{ + return GuiTextBox(*bounds, text, textSize, editMode); +} + +int mGuiSlider(Rectangle *bounds, const char * textLeft, const char * textRight, float * value, float minValue, float maxValue) +{ + return GuiSlider(*bounds, textLeft, textRight, value, minValue, maxValue); +} + +int mGuiSliderBar(Rectangle *bounds, const char * textLeft, const char * textRight, float * value, float minValue, float maxValue) +{ + return GuiSliderBar(*bounds, textLeft, textRight, value, minValue, maxValue); +} + +int mGuiProgressBar(Rectangle *bounds, const char * textLeft, const char * textRight, float * value, float minValue, float maxValue) +{ + return GuiProgressBar(*bounds, textLeft, textRight, value, minValue, maxValue); +} + +int mGuiStatusBar(Rectangle *bounds, const char * text) +{ + return GuiStatusBar(*bounds, text); +} + +int mGuiDummyRec(Rectangle *bounds, const char * text) +{ + return GuiDummyRec(*bounds, text); +} + +int mGuiGrid(Rectangle *bounds, const char * text, float spacing, int subdivs, Vector2 * mouseCell) +{ + return GuiGrid(*bounds, text, spacing, subdivs, mouseCell); +} + +int mGuiListView(Rectangle *bounds, const char * text, int * scrollIndex, int * active) +{ + return GuiListView(*bounds, text, scrollIndex, active); +} + +int mGuiListViewEx(Rectangle *bounds, const char ** text, int count, int * scrollIndex, int * active, int * focus) +{ + return GuiListViewEx(*bounds, text, count, scrollIndex, active, focus); +} + +int mGuiMessageBox(Rectangle *bounds, const char * title, const char * message, const char * buttons) +{ + return GuiMessageBox(*bounds, title, message, buttons); +} + +int mGuiTextInputBox(Rectangle *bounds, const char * title, const char * message, const char * buttons, char * text, int textMaxSize, bool * secretViewActive) +{ + return GuiTextInputBox(*bounds, title, message, buttons, text, textMaxSize, secretViewActive); +} + +int mGuiColorPicker(Rectangle *bounds, const char * text, Color * color) +{ + return GuiColorPicker(*bounds, text, color); +} + +int mGuiColorPanel(Rectangle *bounds, const char * text, Color * color) +{ + return GuiColorPanel(*bounds, text, color); +} + +int mGuiColorBarAlpha(Rectangle *bounds, const char * text, float * alpha) +{ + return GuiColorBarAlpha(*bounds, text, alpha); +} + +int mGuiColorBarHue(Rectangle *bounds, const char * text, float * value) +{ + return GuiColorBarHue(*bounds, text, value); +} + +int mGuiColorPickerHSV(Rectangle *bounds, const char * text, Vector3 * colorHsv) +{ + return GuiColorPickerHSV(*bounds, text, colorHsv); +} + +int mGuiColorPanelHSV(Rectangle *bounds, const char * text, Vector3 * colorHsv) +{ + return GuiColorPanelHSV(*bounds, text, colorHsv); +} + diff --git a/libs/raygui/raygui_marshal.h b/libs/raygui/raygui_marshal.h new file mode 100644 index 0000000..f4cfd77 --- /dev/null +++ b/libs/raygui/raygui_marshal.h @@ -0,0 +1,167 @@ +#include "raygui.h" + +// Enable gui controls (global state) +void mGuiEnable(void); + +// Disable gui controls (global state) +void mGuiDisable(void); + +// Lock gui controls (global state) +void mGuiLock(void); + +// Unlock gui controls (global state) +void mGuiUnlock(void); + +// Check if gui is locked (global state) +bool mGuiIsLocked(void); + +// Set gui controls alpha (global state), alpha goes from 0.0f to 1.0f +void mGuiSetAlpha(float alpha); + +// Set gui state (global state) +void mGuiSetState(int state); + +// Get gui state (global state) +int mGuiGetState(void); + +// Set gui custom font (global state) +void mGuiSetFont(Font *font); + +// Get gui custom font (global state) +void mGuiGetFont(Font *out); + +// Set one style property +void mGuiSetStyle(int control, int property, int value); + +// Get one style property +int mGuiGetStyle(int control, int property); + +// Load style file over global style variable (.rgs) +void mGuiLoadStyle(const char * fileName); + +// Load style default over global style +void mGuiLoadStyleDefault(void); + +// Enable gui tooltips (global state) +void mGuiEnableTooltip(void); + +// Disable gui tooltips (global state) +void mGuiDisableTooltip(void); + +// Set tooltip string +void mGuiSetTooltip(const char * tooltip); + +// Get text with icon id prepended (if supported) +const char * mGuiIconText(int iconId, const char * text); + +// Set default icon drawing size +void mGuiSetIconScale(int scale); + +// Get raygui icons data pointer +unsigned int * mGuiGetIcons(void); + +// Load raygui icons file (.rgi) into internal icons data +char ** mGuiLoadIcons(const char * fileName, bool loadIconsName); + +// Window Box control, shows a window that can be closed +int mGuiWindowBox(Rectangle *bounds, const char * title); + +// Group Box control with text name +int mGuiGroupBox(Rectangle *bounds, const char * text); + +// Line separator control, could contain text +int mGuiLine(Rectangle *bounds, const char * text); + +// Panel control, useful to group controls +int mGuiPanel(Rectangle *bounds, const char * text); + +// Tab Bar control, returns TAB to be closed or -1 +int mGuiTabBar(Rectangle *bounds, const char ** text, int count, int * active); + +// Scroll Panel control +int mGuiScrollPanel(Rectangle *bounds, const char * text, Rectangle *content, Vector2 * scroll, Rectangle * view); + +// Label control, shows text +int mGuiLabel(Rectangle *bounds, const char * text); + +// Button control, returns true when clicked +int mGuiButton(Rectangle *bounds, const char * text); + +// Label button control, show true when clicked +int mGuiLabelButton(Rectangle *bounds, const char * text); + +// Toggle Button control, returns true when active +int mGuiToggle(Rectangle *bounds, const char * text, bool * active); + +// Toggle Group control, returns active toggle index +int mGuiToggleGroup(Rectangle *bounds, const char * text, int * active); + +// Toggle Slider control, returns true when clicked +int mGuiToggleSlider(Rectangle *bounds, const char * text, int * active); + +// Check Box control, returns true when active +int mGuiCheckBox(Rectangle *bounds, const char * text, bool * checked); + +// Combo Box control, returns selected item index +int mGuiComboBox(Rectangle *bounds, const char * text, int * active); + +// Dropdown Box control, returns selected item +int mGuiDropdownBox(Rectangle *bounds, const char * text, int * active, bool editMode); + +// Spinner control, returns selected value +int mGuiSpinner(Rectangle *bounds, const char * text, int * value, int minValue, int maxValue, bool editMode); + +// Value Box control, updates input text with numbers +int mGuiValueBox(Rectangle *bounds, const char * text, int * value, int minValue, int maxValue, bool editMode); + +// Text Box control, updates input text +int mGuiTextBox(Rectangle *bounds, char * text, int textSize, bool editMode); + +// Slider control, returns selected value +int mGuiSlider(Rectangle *bounds, const char * textLeft, const char * textRight, float * value, float minValue, float maxValue); + +// Slider Bar control, returns selected value +int mGuiSliderBar(Rectangle *bounds, const char * textLeft, const char * textRight, float * value, float minValue, float maxValue); + +// Progress Bar control, shows current progress value +int mGuiProgressBar(Rectangle *bounds, const char * textLeft, const char * textRight, float * value, float minValue, float maxValue); + +// Status Bar control, shows info text +int mGuiStatusBar(Rectangle *bounds, const char * text); + +// Dummy control for placeholders +int mGuiDummyRec(Rectangle *bounds, const char * text); + +// Grid control, returns mouse cell position +int mGuiGrid(Rectangle *bounds, const char * text, float spacing, int subdivs, Vector2 * mouseCell); + +// List View control, returns selected list item index +int mGuiListView(Rectangle *bounds, const char * text, int * scrollIndex, int * active); + +// List View with extended parameters +int mGuiListViewEx(Rectangle *bounds, const char ** text, int count, int * scrollIndex, int * active, int * focus); + +// Message Box control, displays a message +int mGuiMessageBox(Rectangle *bounds, const char * title, const char * message, const char * buttons); + +// Text Input Box control, ask for text, supports secret +int mGuiTextInputBox(Rectangle *bounds, const char * title, const char * message, const char * buttons, char * text, int textMaxSize, bool * secretViewActive); + +// Color Picker control (multiple color controls) +int mGuiColorPicker(Rectangle *bounds, const char * text, Color * color); + +// Color Panel control +int mGuiColorPanel(Rectangle *bounds, const char * text, Color * color); + +// Color Bar Alpha control +int mGuiColorBarAlpha(Rectangle *bounds, const char * text, float * alpha); + +// Color Bar Hue control +int mGuiColorBarHue(Rectangle *bounds, const char * text, float * value); + +// Color Picker control that avoids conversion to RGB on each call (multiple color controls) +int mGuiColorPickerHSV(Rectangle *bounds, const char * text, Vector3 * colorHsv); + +// Color Panel control that returns HSV color value, used by GuiColorPickerHSV() +int mGuiColorPanelHSV(Rectangle *bounds, const char * text, Vector3 * colorHsv); + diff --git a/libs/raygui/raylib_parser.zig b/libs/raygui/raylib_parser.zig new file mode 100644 index 0000000..0190fc3 --- /dev/null +++ b/libs/raygui/raylib_parser.zig @@ -0,0 +1,6 @@ +//! run 'zig build jsons' to generate bindings for raylib +//! run 'zig build raylib_parser' to build the raylib_parser.exe + +/// this needs to be here so the zig compiler won't complain that there is no entry point +/// but actually we are using main() of 'raylib/src/parser/raylib_parser.c' +pub extern fn main() c_int; diff --git a/libs/raygui/type_mapping.zig b/libs/raygui/type_mapping.zig new file mode 100644 index 0000000..f53f7c9 --- /dev/null +++ b/libs/raygui/type_mapping.zig @@ -0,0 +1,694 @@ +//! Strategy: +//! 1. generate raylib JSONs +//! 2. combine in a union RaylibJson +//! 3. convert to intermediate representation +//! 4. read adjusted intermediate JSONs +//! 5. generate raylib.zig // wrap paramters and pass them to marshall versions of the raylib functions +//! 6. generate marshall.c // unwrap parameters from zig function and call the actual raylib function +//! 7. generate marshall.h // C signatures for all marshalled functions + +const std = @import("std"); +const json = std.json; +const memoryConstrain: usize = 1024 * 1024 * 1024; // 1 GiB +const Allocator = std.mem.Allocator; +const fmt = std.fmt.allocPrint; +const talloc = std.testing.allocator; +const expect = std.testing.expect; +const expectEqualStrings = std.testing.expectEqualStrings; + +//--- Intermediate Format ------------------------------------------------------------------------- + +pub const Intermediate = struct { + functions: []Function, + enums: []Enum, + structs: []Struct, + defines: []Define, + + pub fn loadCustoms(allocator: Allocator, jsonFile: []const u8) !@This() { + var enums = std.ArrayList(Enum).init(allocator); + var structs = std.ArrayList(Struct).init(allocator); + var functions = std.ArrayList(Function).init(allocator); + var defines = std.ArrayList(Define).init(allocator); + + const jsonData = try std.fs.cwd().readFileAlloc(allocator, jsonFile, memoryConstrain); + + const bindingJson = try json.parseFromSliceLeaky(Intermediate, allocator, jsonData, .{ + .ignore_unknown_fields = true, + }); + + for (bindingJson.enums) |t| { + if (t.custom) { + try enums.append(t); + } + } + + for (bindingJson.structs) |t| { + if (t.custom) { + try structs.append(t); + } + } + + for (bindingJson.functions) |f| { + if (f.custom) { + try functions.append(f); + } + } + + for (bindingJson.defines) |f| { + if (f.custom) { + try defines.append(f); + } + } + + return @This(){ + .enums = try enums.toOwnedSlice(), + .structs = try structs.toOwnedSlice(), + .functions = try functions.toOwnedSlice(), + .defines = try defines.toOwnedSlice(), + }; + } + + pub fn addNonCustom(self: *@This(), allocator: Allocator, rlJson: CombinedRaylib) !void { + var enums = std.ArrayList(Enum).init(allocator); + try enums.appendSlice(self.enums); + var structs = std.ArrayList(Struct).init(allocator); + try structs.appendSlice(self.structs); + var functions = std.ArrayList(Function).init(allocator); + try functions.appendSlice(self.functions); + var defines = std.ArrayList(Define).init(allocator); + try defines.appendSlice(self.defines); + + outer: for (rlJson.defines.values(), 0..) |d, i| { + for (defines.items) |added| { + if (eql(added.name, d.name)) { + std.log.debug("{s} is customized", .{d.name}); + continue :outer; + } + } + const define = parseRaylibDefine(allocator, d) orelse continue :outer; + + if (i < defines.items.len) { + try defines.insert(i, define); + } else { + try defines.append(define); + } + } + outer: for (rlJson.enums.values(), 0..) |e, i| { + const name = if (alias.get(e.name)) |n| n else e.name; + for (enums.items) |added| { + if (eql(added.name, name)) { + std.log.debug("{s} is customized", .{name}); + continue :outer; + } + } + + if (i < enums.items.len) { + try enums.insert(i, try parseRaylibEnum(allocator, e)); + } else { + try enums.append(try parseRaylibEnum(allocator, e)); + } + } + outer: for (rlJson.structs.values(), 0..) |s, i| { + const name = if (alias.get(s.name)) |n| n else s.name; + for (structs.items) |added| { + if (eql(added.name, name)) { + std.log.debug("{s} is customized", .{name}); + continue :outer; + } + } + if (i < structs.items.len) { + try structs.insert(i, try parseRaylibStruct(allocator, s)); + } else { + try structs.append(try parseRaylibStruct(allocator, s)); + } + } + for (rlJson.defines.values()) |_| {} + + outer: for (rlJson.functions.values(), 0..) |f, i| { + for (functions.items) |added| { + if (eql(added.name, f.name)) { + std.log.debug("{s} is customized", .{f.name}); + continue :outer; + } + } + if (i < functions.items.len) { + try functions.insert(i, try parseRaylibFunction(allocator, f)); + } else { + try functions.append(try parseRaylibFunction(allocator, f)); + } + } + + self.enums = try enums.toOwnedSlice(); + self.structs = try structs.toOwnedSlice(); + self.functions = try functions.toOwnedSlice(); + self.defines = try defines.toOwnedSlice(); + } + + pub fn containsStruct(self: @This(), name: []const u8) bool { + for (self.structs) |s| { + if (eql(s.name, name)) return true; + } + return false; + } + + pub fn containsEnum(self: @This(), name: []const u8) bool { + for (self.enums) |e| { + if (eql(e.name, name)) return true; + } + return false; + } + + pub fn containsDefine(self: @This(), name: []const u8) bool { + for (self.defines) |d| { + if (eql(d.name, name)) return true; + } + return false; + } +}; + +pub const Function = struct { + name: []const u8, + params: []FunctionParameter, + returnType: []const u8, + description: ?[]const u8 = null, + custom: bool = false, +}; + +pub const FunctionParameter = struct { + name: []const u8, + typ: []const u8, + description: ?[]const u8 = null, +}; + +pub fn parseRaylibFunction(allocator: Allocator, func: RaylibFunction) !Function { + var args = std.ArrayList(FunctionParameter).init(allocator); + if (func.params) |params| { + for (params) |p| { + const t = try toZig(allocator, p.type); + + try args.append(.{ + .name = p.name, + .typ = t, + .description = p.description, + }); + } + } + + const returnType = try toZig(allocator, func.returnType); + + return Function{ + .name = func.name, + .params = try args.toOwnedSlice(), + .returnType = returnType, + .description = func.description, + }; +} + +pub const Struct = struct { + name: []const u8, + fields: []const StructField, + description: ?[]const u8 = null, + custom: bool = false, +}; + +pub const StructField = struct { + name: []const u8, + typ: []const u8, + description: ?[]const u8 = null, +}; + +pub fn parseRaylibStruct(allocator: Allocator, s: RaylibStruct) !Struct { + var fields = std.ArrayList(StructField).init(allocator); + for (s.fields) |field| { + var typ = try toZig(allocator, getTypeWithoutArrayNotation(field.type)); + + if (getArraySize(field.type)) |size| { + typ = try std.fmt.allocPrint(allocator, "[{d}]{s}", .{ size, typ }); + } + + try fields.append(.{ + .name = field.name, + .typ = typ, + .description = field.description, + }); + } + + return Struct{ + .name = if (alias.get(s.name)) |a| a else s.name, + .fields = try fields.toOwnedSlice(), + .description = s.description, + }; +} + +pub const Define = struct { + name: []const u8, + typ: []const u8, + value: []const u8, + description: ?[]const u8 = null, + custom: bool = false, +}; + +pub fn parseRaylibDefine(allocator: Allocator, s: RaylibDefine) ?Define { + var typ: []const u8 = undefined; + var value: []const u8 = undefined; + + if (eql("INT", s.type)) { + typ = "i32"; + value = std.fmt.allocPrint(allocator, "{s}", .{s.value}) catch return null; + } else if (eql("LONG", s.type)) { + typ = "i64"; + value = std.fmt.allocPrint(allocator, "{s}", .{s.value}) catch return null; + } else if (eql("FLOAT", s.type)) { + typ = "f32"; + value = std.fmt.allocPrint(allocator, "{s}", .{s.value}) catch return null; + } else if (eql("DOUBLE", s.type)) { + typ = "f64"; + value = std.fmt.allocPrint(allocator, "{s}", .{s.value}) catch return null; + } else if (eql("STRING", s.type)) { + typ = "[]const u8"; + value = std.fmt.allocPrint(allocator, "\"{s}\"", .{s.value}) catch return null; + } else if (eql("COLOR", s.type)) { + typ = "Color"; + std.debug.assert(startsWith(s.value, "CLITERAL(Color){")); + std.debug.assert(endsWith(s.value, "}")); + + const componentString = s.value["CLITERAL(Color){".len .. s.value.len - 1]; + var spliterator = std.mem.split(u8, componentString, ","); + var r = spliterator.next() orelse return null; + r = std.mem.trim(u8, r, " \t\r\n"); + var g = spliterator.next() orelse return null; + g = std.mem.trim(u8, g, " \t\r\n"); + var b = spliterator.next() orelse return null; + b = std.mem.trim(u8, b, " \t\r\n"); + var a = spliterator.next() orelse return null; + a = std.mem.trim(u8, a, " \t\r\n"); + value = std.fmt.allocPrint(allocator, ".{{.r={s}, .g={s}, .b={s}, .a={s}}}", .{ r, g, b, a }) catch return null; + } else { + return null; + } + + return Define{ + .name = s.name, + .typ = typ, + .value = value, + .description = s.description, + }; +} + +pub const Enum = struct { + name: []const u8, + values: []const EnumValue, + description: ?[]const u8 = null, + custom: bool = false, +}; + +pub const EnumValue = struct { + name: []const u8, + value: c_int, + description: ?[]const u8 = null, +}; + +pub fn parseRaylibEnum(allocator: Allocator, e: RaylibEnum) !Enum { + var values = std.ArrayList(EnumValue).init(allocator); + for (e.values) |value| { + try values.append(.{ + .name = value.name, + .value = value.value, + .description = value.description, + }); + } + + return Enum{ + .name = e.name, + .values = try values.toOwnedSlice(), + .description = e.description, + }; +} + +/// is c const type +pub fn isConst(c: []const u8) bool { + return startsWith(c, "const "); +} +test "isConst" { + try expect(!isConst("char *")); + try expect(!isConst("unsigned char *")); + try expect(isConst("const unsigned char *")); + try expect(isConst("const unsigned int *")); + try expect(isConst("const void *")); + try expect(!isConst("Vector2 *")); + try expect(!isConst("Vector2")); + try expect(!isConst("int")); +} + +/// is c pointer type +pub fn isPointer(c: []const u8) bool { + return endsWith(c, "*"); +} +test "isPointer" { + try expect(isPointer("char *")); + try expect(isPointer("unsigned char *")); + try expect(isPointer("const unsigned char *")); + try expect(isPointer("const unsigned int *")); + try expect(isPointer("Vector2 *")); + try expect(!isPointer("Vector2")); + try expect(!isPointer("int")); +} + +pub fn isPointerToPointer(c: []const u8) bool { + return endsWith(c, "**"); +} +test "isPointerToPointer" { + try expect(!isPointerToPointer("char *")); + try expect(!isPointerToPointer("unsigned char *")); + try expect(isPointerToPointer("const unsigned char **")); + try expect(isPointerToPointer("const unsigned int **")); + try expect(isPointerToPointer("Vector2 **")); + try expect(!isPointerToPointer("Vector2*")); + try expect(!isPointerToPointer("int")); +} + +pub fn isVoid(c: []const u8) bool { + return eql(stripType(c), "void"); +} +test "isVoid" { + try expect(!isVoid("char *")); + try expect(!isVoid("unsigned char *")); + try expect(!isVoid("const unsigned char *")); + try expect(isVoid("const void *")); + try expect(isVoid("void *")); + try expect(isVoid("void")); + try expect(isVoid("void **")); +} + +/// strips const and pointer annotations +/// const TName * -> TName +pub fn stripType(c: []const u8) []const u8 { + var name = if (isConst(c)) c["const ".len..] else c; + name = if (isPointer(name)) name[0 .. name.len - 1] else name; + // double pointer? + name = if (isPointer(name)) name[0 .. name.len - 1] else name; + name = std.mem.trim(u8, name, " \t\n"); + if (alias.get(name)) |ali| { + name = ali; + } + return name; +} +test "stripType" { + try expectEqualStrings("void", stripType("const void *")); + try expectEqualStrings("unsinged int", stripType("unsinged int *")); + try expectEqualStrings("Vector2", stripType("const Vector2 *")); +} + +pub fn getArraySize(typ: []const u8) ?usize { + if (std.mem.indexOf(u8, typ, "[")) |open| { + if (std.mem.indexOf(u8, typ, "]")) |close| { + return std.fmt.parseInt(usize, typ[open + 1 .. close], 10) catch null; + } + } + return null; +} +test "getArraySize" { + const expectEqual = std.testing.expectEqual; + + try expectEqual(@as(?usize, 4), getArraySize("float[4]")); + try expectEqual(@as(?usize, 44), getArraySize("int[44]")); + try expectEqual(@as(?usize, 123456), getArraySize("a[123456]")); + try expectEqual(@as(?usize, 1), getArraySize("test[1] ")); + try expectEqual(@as(?usize, null), getArraySize("foo[]")); + try expectEqual(@as(?usize, null), getArraySize("bar")); + try expectEqual(@as(?usize, null), getArraySize("foo[")); + try expectEqual(@as(?usize, null), getArraySize("bar]")); + try expectEqual(@as(?usize, 42), getArraySize(" lol this is ok[42] ")); +} + +pub fn getTypeWithoutArrayNotation(typ: []const u8) []const u8 { + if (std.mem.indexOf(u8, typ, "[")) |open| { + return typ[0..open]; + } + return typ; +} + +fn toZig(allocator: Allocator, c: []const u8) ![]const u8 { + if (fixedMapping.get(c)) |fixed| { + return fixed; + } + + const consT = if (isConst(c)) "const " else ""; + const stripped = stripType(c); + const pointeR = if (isPointer(c)) + if (eql(stripped, "unsigned char") or eql(stripped, "char")) "?[*:0]" else "*" + else + ""; + + const name = if (raylibToZigType.get(stripped)) |primitive| primitive else stripped; + + if (isPointer(c)) { + return try fmt(allocator, "{s}{s}{s}", .{ pointeR, consT, name }); + } + return name; +} +test "toZig" { + var arena = std.heap.ArenaAllocator.init(talloc); + defer arena.deinit(); + const a = arena.allocator(); + + try expectEqualStrings("i32", try toZig(a, "int")); + try expectEqualStrings("const i32", try toZig(a, "const int")); + try expectEqualStrings("?[*]Vector2", try toZig(a, "Vector2 *")); +} + +const raylibToZigType = std.ComptimeStringMap([]const u8, .{ + .{ "void", "void" }, + .{ "bool", "bool" }, + .{ "char", "u8" }, + .{ "unsigned char", "u8" }, + .{ "short", "i16" }, + .{ "unsigned short", "u16" }, + .{ "int", "i32" }, + .{ "unsigned int", "u32" }, + .{ "long", "i64" }, + .{ "unsigned long", "u64" }, + .{ "unsigned long long", "u64" }, + .{ "float", "f32" }, + .{ "double", "f64" }, +}); + +const fixedMapping = std.ComptimeStringMap([]const u8, .{ + .{ "void *", "*anyopaque" }, + .{ "const void *", "*const anyopaque" }, + .{ "const unsigned char *", "[*:0]const u8" }, + .{ "const char *", "[*:0]const u8" }, + .{ "const char **", "[*]const [*:0]const u8" }, + .{ "char **", "[*][*:0]u8" }, + .{ "rAudioBuffer *", "*anyopaque" }, + .{ "rAudioProcessor *", "*anyopaque" }, + .{ "Image *", "*Image" }, +}); + +//--- Raylib parser JSONs ------------------------------------------------------------------------- + +const alias = std.ComptimeStringMap([]const u8, .{ + .{ "Camera", "Camera3D" }, + .{ "Texture", "Texture2D" }, + .{ "TextureCubemap", "Texture2D" }, + .{ "RenderTexture", "RenderTexture2D" }, + .{ "GuiStyle", "u32" }, + .{ "Quaternion", "Vector4" }, + .{ "PhysicsBody", "*PhysicsBodyData" }, +}); + +const cAlias = std.ComptimeStringMap([]const u8, .{ + .{ "Camera", "Camera3D" }, + .{ "Texture", "Texture2D" }, + .{ "TextureCubemap", "Texture2D" }, + .{ "RenderTexture", "RenderTexture2D" }, + .{ "Quaternion", "Vector4" }, + .{ "PhysicsBody", "PhysicsBodyData *" }, +}); + +pub const CombinedRaylib = struct { + structs: std.StringArrayHashMap(RaylibStruct), + enums: std.StringArrayHashMap(RaylibEnum), + defines: std.StringArrayHashMap(RaylibDefine), + functions: std.StringArrayHashMap(RaylibFunction), + + pub fn load(allocator: Allocator, jsonFiles: []const []const u8) !@This() { + var structs = std.StringArrayHashMap(RaylibStruct).init(allocator); + var enums = std.StringArrayHashMap(RaylibEnum).init(allocator); + var defines = std.StringArrayHashMap(RaylibDefine).init(allocator); + var functions = std.StringArrayHashMap(RaylibFunction).init(allocator); + + for (jsonFiles) |jsonFile| { + std.log.info("parsing {s}", .{jsonFile}); + const jsonData = try std.fs.cwd().readFileAlloc(allocator, jsonFile, memoryConstrain); + + const bindingJson = try json.parseFromSliceLeaky(RaylibJson, allocator, jsonData, .{ + .ignore_unknown_fields = true, + .duplicate_field_behavior = .use_last, + }); + + for (bindingJson.structs) |*s| { + for (s.fields) |*f| { + f.type = cAlias.get(f.type) orelse f.type; + } + try structs.put(s.name, s.*); + } + + for (bindingJson.enums) |e| { + try enums.put(e.name, e); + } + + for (bindingJson.defines) |d| { + try defines.put(d.name, d); + } + + for (bindingJson.functions) |*f| { + f.returnType = cAlias.get(f.returnType) orelse f.returnType; + if (f.params) |params| { + for (params) |*p| { + p.type = cAlias.get(p.type) orelse p.type; + } + } + try functions.put(f.name, f.*); + } + } + + return @This(){ + .structs = structs, + .enums = enums, + .defines = defines, + .functions = functions, + }; + } + + pub fn toIntermediate(self: @This(), allocator: Allocator, customs: Intermediate) !Intermediate { + var functions = std.ArrayList(Function).init(allocator); + var enums = std.ArrayList(Enum).init(allocator); + var structs = std.ArrayList(Struct).init(allocator); + + enums: for (self.enums.values()) |e| { + for (customs.enums) |tt| { + if (eql(tt.name, e.name)) break :enums; + } + try enums.append(try parseRaylibEnum(allocator, e)); + } + structs: for (self.structs.values()) |s| { + for (customs.structs) |tt| { + if (eql(tt.name, s.name)) break :structs; + } + try structs.append(try parseRaylibStruct(allocator, s, customs)); + } + for (self.defines.values()) |_| {} + + funcs: for (self.functions.values()) |f| { + for (customs.functions) |ff| { + if (eql(ff.name, f.name)) break :funcs; + } + try functions.append(try parseRaylibFunction(allocator, f, customs.types)); + } + + return Intermediate{ + .functions = try functions.toOwnedSlice(), + .enums = try enums.toOwnedSlice(), + .structs = try structs.toOwnedSlice(), + }; + } + + fn containsStruct(self: @This(), name: []const u8) bool { + return self.structs.contains(name); + } + + fn containsEnum(self: @This(), name: []const u8) bool { + return self.enums.contains(name); + } + + fn containsFunction(self: @This(), name: []const u8) bool { + return self.functions.contains(name); + } +}; + +const RaylibJson = struct { + structs: []RaylibStruct, + enums: []RaylibEnum, + defines: []RaylibDefine, + functions: []RaylibFunction, +}; + +pub const RaylibStruct = struct { + name: []const u8, + description: []const u8, + fields: []RaylibField, +}; + +pub const RaylibField = struct { + name: []const u8, + description: []const u8, + type: []const u8, +}; + +pub const RaylibEnum = struct { + name: []const u8, + description: []const u8, + values: []RaylibEnumValue, +}; + +pub const RaylibEnumValue = struct { + name: []const u8, + description: []const u8, + value: c_int, +}; + +pub const RaylibFunction = struct { + name: []const u8, + description: []const u8, + returnType: []const u8, + params: ?[]RaylibFunctionParam = null, +}; + +pub const RaylibFunctionParam = struct { + name: []const u8, + type: []const u8, + description: ?[]const u8 = null, +}; + +pub const RaylibDefine = struct { + name: []const u8, + type: []const u8, + value: []const u8, + description: ?[]const u8 = null, +}; + +//--- Helpers ------------------------------------------------------------------------------------- + +/// true if C type is primitive or a pointer to anything +/// this means we don't need to wrap it in a pointer +pub fn isPrimitiveOrPointer(c: []const u8) bool { + const primitiveTypes = std.ComptimeStringMap(void, .{ + .{ "void", {} }, + .{ "bool", {} }, + .{ "char", {} }, + .{ "unsigned char", {} }, + .{ "short", {} }, + .{ "unsigned short", {} }, + .{ "int", {} }, + .{ "unsigned int", {} }, + .{ "long", {} }, + .{ "unsigned long", {} }, + .{ "unsigned long long", {} }, + .{ "float", {} }, + .{ "double", {} }, + }); + return primitiveTypes.has(stripType(c)) or endsWith(c, "*"); +} + +fn eql(a: []const u8, b: []const u8) bool { + return std.mem.eql(u8, a, b); +} + +fn startsWith(haystack: []const u8, needle: []const u8) bool { + return std.mem.startsWith(u8, haystack, needle); +} + +fn endsWith(haystack: []const u8, needle: []const u8) bool { + return std.mem.endsWith(u8, haystack, needle); +}