Adding support for raygui (#95)

* updated build.zig and generate_functions.py to add raygui

* added raygui.h and manually coded some structs & enums in raygui prelude WIP

* ported all the structs, enums and globals to zig till raygui implementation

* imported types from raylib in raygui

* re-encoded raygui-prelude.zig. I don't know for some reason it was showing up as UTF-16 unicode text file. re-encoded it to UTF-8

* fixed imports in prelude to work properly with generated files

* updated generate_functions.py file to generate for raygui [text type error not fixed]

* simple temporary patch for mentioned text type issue

* removed unused imports from raylib in raygui

* added generated files

* Manually define raygui functions for slice arguments

* Manually define raygui functions with pointer return values

---------

Co-authored-by: Not-Nik <nik.wipper@gmx.de>
This commit is contained in:
Mohanavel S K 2024-05-31 22:54:05 +05:30 committed by GitHub
parent 39909cdcb3
commit efb7b736db
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 6874 additions and 2 deletions

View File

@ -146,6 +146,18 @@ const gl = struct {
} }
}; };
const gui = struct {
fn getModule(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.builtin.Mode) *std.Build.Module {
const raylib = rl.getModule(b, target, optimize);
return b.addModule("raygui", .{
.root_source_file = b.path("lib/raygui.zig"),
.imports = &.{.{ .name = "raylib-zig", .module = raylib }},
.target = target,
.optimize = optimize,
});
}
};
pub fn build(b: *std.Build) !void { pub fn build(b: *std.Build) !void {
const target = b.standardTargetOptions(.{}); const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{}); const optimize = b.standardOptimizeOption(.{});
@ -248,6 +260,7 @@ pub fn build(b: *std.Build) !void {
const raylib = rl.getModule(b, target, optimize); const raylib = rl.getModule(b, target, optimize);
const raylib_math = rl.math.getModule(b, target, optimize); const raylib_math = rl.math.getModule(b, target, optimize);
const rlgl = rl.gl.getModule(b, target, optimize); const rlgl = rl.gl.getModule(b, target, optimize);
const raygui = rl.gui.getModule(b, target, optimize);
const raylib_test = b.addTest(.{ const raylib_test = b.addTest(.{
.root_source_file = b.path("lib/raylib.zig"), .root_source_file = b.path("lib/raylib.zig"),
@ -269,10 +282,18 @@ pub fn build(b: *std.Build) !void {
}); });
rlgl_test.root_module.addImport("raylib-zig", raylib); rlgl_test.root_module.addImport("raylib-zig", raylib);
const raygui_test = b.addTest(.{
.root_source_file = b.path("lib/raygui.zig"),
.target = target,
.optimize = optimize,
});
raygui_test.root_module.addImport("raylib-zig", raylib);
const test_step = b.step("test", "Check for library compilation errors"); const test_step = b.step("test", "Check for library compilation errors");
test_step.dependOn(&raylib_test.step); test_step.dependOn(&raylib_test.step);
test_step.dependOn(&raylib_math_test.step); test_step.dependOn(&raylib_math_test.step);
test_step.dependOn(&rlgl_test.step); test_step.dependOn(&rlgl_test.step);
test_step.dependOn(&raygui_test.step);
const examples_step = b.step("examples", "Builds all the examples"); const examples_step = b.step("examples", "Builds all the examples");
@ -282,6 +303,7 @@ pub fn build(b: *std.Build) !void {
exe_lib.root_module.addImport("raylib", raylib); exe_lib.root_module.addImport("raylib", raylib);
exe_lib.root_module.addImport("raylib-math", raylib_math); exe_lib.root_module.addImport("raylib-math", raylib_math);
exe_lib.root_module.addImport("rlgl", rlgl); exe_lib.root_module.addImport("rlgl", rlgl);
exe_lib.root_module.addImport("raygui", raygui);
const raylib_lib = getRaylib(b, target, optimize, options); const raylib_lib = getRaylib(b, target, optimize, options);
// Note that raylib itself isn't actually added to the exe_lib // Note that raylib itself isn't actually added to the exe_lib
@ -308,6 +330,7 @@ pub fn build(b: *std.Build) !void {
exe.root_module.addImport("raylib", raylib); exe.root_module.addImport("raylib", raylib);
exe.root_module.addImport("raylib-math", raylib_math); exe.root_module.addImport("raylib-math", raylib_math);
exe.root_module.addImport("rlgl", rlgl); exe.root_module.addImport("rlgl", rlgl);
exe.root_module.addImport("raygui", raygui);
const run_cmd = b.addRunArtifact(exe); const run_cmd = b.addRunArtifact(exe);
const run_step = b.step(ex.name, ex.desc); const run_step = b.step(ex.name, ex.desc);

View File

@ -25,6 +25,8 @@ IGNORE_TYPES = [
"[*c]Color", "[*c]Color",
"[*c]GlyphInfo", "[*c]GlyphInfo",
"[*c]c_int", "[*c]c_int",
"[*c]c_uint",
"[*c][*c]u8",
"[*c][*c]const u8", "[*c][*c]const u8",
"[*c]Material", "[*c]Material",
"[*c]ModelAnimation", "[*c]ModelAnimation",
@ -53,7 +55,8 @@ def ziggify_type(name: str, t: str) -> str:
"position", "mesh", "materialCount", "material", "model", "animCount", "position", "mesh", "materialCount", "material", "model", "animCount",
"wave", "v1", "v2", "outAxis", "outAngle", "fileSize", "wave", "v1", "v2", "outAxis", "outAngle", "fileSize",
"AutomationEventList", "list", "batch", "glInternalFormat", "glFormat", "AutomationEventList", "list", "batch", "glInternalFormat", "glFormat",
"glType", "mipmaps" "glType", "mipmaps", "active", "scroll", "view", "checked", "mouseCell",
"scrollIndex", "focus", "secretViewActive", "color", "alpha", "colorHsv"
] ]
multi = [ multi = [
"data", "compData", "points", "fileData", "colors", "pixels", "data", "compData", "points", "fileData", "colors", "pixels",
@ -62,10 +65,13 @@ def ziggify_type(name: str, t: str) -> str:
"LoadFontData", "LoadCodepoints", "TextSplit", "LoadMaterials", "LoadFontData", "LoadCodepoints", "TextSplit", "LoadMaterials",
"LoadModelAnimations", "LoadWaveSamples", "images", "LoadModelAnimations", "LoadWaveSamples", "images",
"LoadRandomSequence", "sequence", "kernel", "GlyphInfo", "glyphs", "glyphRecs", "LoadRandomSequence", "sequence", "kernel", "GlyphInfo", "glyphs", "glyphRecs",
"matf", "rlGetShaderLocsDefault", "locs" "matf", "rlGetShaderLocsDefault", "locs", "GuiGetIcons", "GuiLoadIcons"
] ]
string = False string = False
if name == "text" and t == "[*c][*c]const u8":
return "[][:0]const u8"
if t.startswith("[*c]") and name not in single and name not in multi: if t.startswith("[*c]") and name not in single and name not in multi:
if (t == "[*c]const u8" or t == "[*c]u8") and name not in NO_STRINGS: # Strings are multis. if (t == "[*c]const u8" or t == "[*c]u8") and name not in NO_STRINGS: # Strings are multis.
string = True string = True
@ -303,6 +309,8 @@ def parse_header(header_name: str, output_file: str, ext_file: str, prefix: str,
"DrawTriangleFan", "DrawTriangleFan",
"DrawTriangleStrip", "DrawTriangleStrip",
"DrawTriangleStrip3D", "DrawTriangleStrip3D",
"GuiTabBar",
"GuiListViewEx"
] ]
if func_name in manual or "FromMemory" in func_name: if func_name in manual or "FromMemory" in func_name:
@ -358,3 +366,12 @@ if __name__ == "__main__":
"preludes/rlgl-ext-prelude.zig", "preludes/rlgl-ext-prelude.zig",
"#if defined(RLGL_IMPLEMENTATION)\n" "#if defined(RLGL_IMPLEMENTATION)\n"
) )
parse_header(
"raygui.h",
"raygui.zig",
"raygui-ext.zig",
"RAYGUIAPI ",
"preludes/raygui-prelude.zig",
"preludes/raygui-ext-prelude.zig",
"#if defined(RAYGUI_IMPLEMENTATION)\n"
)

View File

@ -0,0 +1 @@
const rl = @import("raylib-zig");

View File

@ -0,0 +1,437 @@
const rl = @import("raylib-zig");
const std = @import("std");
const cdef = @import("raygui-ext.zig");
test {
std.testing.refAllDeclsRecursive(@This());
}
const Vector2 = rl.Vector2;
const Vector3 = rl.Vector3;
const Color = rl.Color;
const Rectangle = rl.Rectangle;
const Font = rl.Font;
pub const GuiStyleProp = extern struct {
controlId: c_ushort,
propertyId: c_ushort,
propertyValue: c_int,
};
pub const GuiState = enum(c_int) {
state_normal = 0,
state_focused,
state_pressed,
state_disabled,
};
pub const GuiTextAlignment = enum(c_int) {
text_align_left = 0,
text_align_center,
text_align_right,
};
pub const GuiTextAlignmentVertical = enum(c_int) {
text_align_top = 0,
text_align_middle,
text_align_bottom,
};
pub const GuiTextWrapMode = enum(c_int) {
text_wrap_none = 0,
text_wrap_char,
text_wrap_word,
};
pub const GuiControl = enum(c_int) {
default = 0,
label,
button,
toggle,
slider,
progressbar,
checkbox,
combobox,
dropdownbox,
textbox,
valuebox,
spinner,
listview,
colorpicker,
scrollbar,
statusbar,
};
pub const GuiControlProperty = enum(c_int) {
border_color_normal = 0,
base_color_normal,
text_color_normal,
border_color_focused,
base_color_focused,
text_color_focused,
border_color_pressed,
base_color_pressed,
text_color_pressed,
border_color_disabled,
base_color_disabled,
text_color_disabled,
border_width,
text_padding,
text_alignment,
};
pub const GuiDefaultProperty = enum(c_int) {
text_size = 16,
text_spacing,
line_color,
background_color,
text_line_spacing,
text_alignment_vertical,
text_wrap_mode,
};
pub const GuiToggleProperty = enum(c_int) {
group_padding = 16,
};
pub const GuiSliderProperty = enum(c_int) {
slider_width = 16,
slider_padding,
};
pub const GuiProgressBarProperty = enum(c_int) {
progress_padding = 16,
};
pub const GuiScrollBarProperty = enum(c_int) {
arrows_size = 16,
arrows_visible,
scroll_slider_padding,
scroll_slider_size,
scroll_padding,
scroll_speed,
};
pub const GuiCheckBoxProperty = enum(c_int) {
check_padding = 16,
};
pub const GuiComboBoxProperty = enum(c_int) {
combo_button_width = 16,
combo_button_spacing,
};
pub const GuiDropdownBoxProperty = enum(c_int) {
arrow_padding = 16,
dropdown_items_spacing,
};
pub const GuiTextBoxProperty = enum(c_int) {
text_readonly = 16,
};
pub const GuiSpinnerProperty = enum(c_int) {
spin_button_width = 16,
spin_button_spacing,
};
pub const GuiListViewProperty = enum(c_int) {
list_items_height = 16,
list_items_spacing,
scrollbar_width,
scrollbar_side,
};
pub const GuiColorPickerProperty = enum(c_int) {
color_selector_size = 16,
huebar_width,
huebar_padding,
huebar_selector_height,
huebar_selector_overflow,
};
pub const scrollbar_left_side: c_int = 0;
pub const scrollbar_right_side: c_int = 1;
pub const GuiIconName = enum(c_int) {
icon_none = 0,
icon_folder_file_open = 1,
icon_file_save_classic = 2,
icon_folder_open = 3,
icon_folder_save = 4,
icon_file_open = 5,
icon_file_save = 6,
icon_file_export = 7,
icon_file_add = 8,
icon_file_delete = 9,
icon_filetype_text = 10,
icon_filetype_audio = 11,
icon_filetype_image = 12,
icon_filetype_play = 13,
icon_filetype_video = 14,
icon_filetype_info = 15,
icon_file_copy = 16,
icon_file_cut = 17,
icon_file_paste = 18,
icon_cursor_hand = 19,
icon_cursor_pointer = 20,
icon_cursor_classic = 21,
icon_pencil = 22,
icon_pencil_big = 23,
icon_brush_classic = 24,
icon_brush_painter = 25,
icon_water_drop = 26,
icon_color_picker = 27,
icon_rubber = 28,
icon_color_bucket = 29,
icon_text_t = 30,
icon_text_a = 31,
icon_scale = 32,
icon_resize = 33,
icon_filter_point = 34,
icon_filter_bilinear = 35,
icon_crop = 36,
icon_crop_alpha = 37,
icon_square_toggle = 38,
icon_symmetry = 39,
icon_symmetry_horizontal = 40,
icon_symmetry_vertical = 41,
icon_lens = 42,
icon_lens_big = 43,
icon_eye_on = 44,
icon_eye_off = 45,
icon_filter_top = 46,
icon_filter = 47,
icon_target_point = 48,
icon_target_small = 49,
icon_target_big = 50,
icon_target_move = 51,
icon_cursor_move = 52,
icon_cursor_scale = 53,
icon_cursor_scale_right = 54,
icon_cursor_scale_left = 55,
icon_undo = 56,
icon_redo = 57,
icon_reredo = 58,
icon_mutate = 59,
icon_rotate = 60,
icon_repeat = 61,
icon_shuffle = 62,
icon_emptybox = 63,
icon_target = 64,
icon_target_small_fill = 65,
icon_target_big_fill = 66,
icon_target_move_fill = 67,
icon_cursor_move_fill = 68,
icon_cursor_scale_fill = 69,
icon_cursor_scale_right_fill = 70,
icon_cursor_scale_left_fill = 71,
icon_undo_fill = 72,
icon_redo_fill = 73,
icon_reredo_fill = 74,
icon_mutate_fill = 75,
icon_rotate_fill = 76,
icon_repeat_fill = 77,
icon_shuffle_fill = 78,
icon_emptybox_small = 79,
icon_box = 80,
icon_box_top = 81,
icon_box_top_right = 82,
icon_box_right = 83,
icon_box_bottom_right = 84,
icon_box_bottom = 85,
icon_box_bottom_left = 86,
icon_box_left = 87,
icon_box_top_left = 88,
icon_box_center = 89,
icon_box_circle_mask = 90,
icon_pot = 91,
icon_alpha_multiply = 92,
icon_alpha_clear = 93,
icon_dithering = 94,
icon_mipmaps = 95,
icon_box_grid = 96,
icon_grid = 97,
icon_box_corners_small = 98,
icon_box_corners_big = 99,
icon_four_boxes = 100,
icon_grid_fill = 101,
icon_box_multisize = 102,
icon_zoom_small = 103,
icon_zoom_medium = 104,
icon_zoom_big = 105,
icon_zoom_all = 106,
icon_zoom_center = 107,
icon_box_dots_small = 108,
icon_box_dots_big = 109,
icon_box_concentric = 110,
icon_box_grid_big = 111,
icon_ok_tick = 112,
icon_cross = 113,
icon_arrow_left = 114,
icon_arrow_right = 115,
icon_arrow_down = 116,
icon_arrow_up = 117,
icon_arrow_left_fill = 118,
icon_arrow_right_fill = 119,
icon_arrow_down_fill = 120,
icon_arrow_up_fill = 121,
icon_audio = 122,
icon_fx = 123,
icon_wave = 124,
icon_wave_sinus = 125,
icon_wave_square = 126,
icon_wave_triangular = 127,
icon_cross_small = 128,
icon_player_previous = 129,
icon_player_play_back = 130,
icon_player_play = 131,
icon_player_pause = 132,
icon_player_stop = 133,
icon_player_next = 134,
icon_player_record = 135,
icon_magnet = 136,
icon_lock_close = 137,
icon_lock_open = 138,
icon_clock = 139,
icon_tools = 140,
icon_gear = 141,
icon_gear_big = 142,
icon_bin = 143,
icon_hand_pointer = 144,
icon_laser = 145,
icon_coin = 146,
icon_explosion = 147,
icon_1up = 148,
icon_player = 149,
icon_player_jump = 150,
icon_key = 151,
icon_demon = 152,
icon_text_popup = 153,
icon_gear_ex = 154,
icon_crack = 155,
icon_crack_points = 156,
icon_star = 157,
icon_door = 158,
icon_exit = 159,
icon_mode_2d = 160,
icon_mode_3d = 161,
icon_cube = 162,
icon_cube_face_top = 163,
icon_cube_face_left = 164,
icon_cube_face_front = 165,
icon_cube_face_bottom = 166,
icon_cube_face_right = 167,
icon_cube_face_back = 168,
icon_camera = 169,
icon_special = 170,
icon_link_net = 171,
icon_link_boxes = 172,
icon_link_multi = 173,
icon_link = 174,
icon_link_broke = 175,
icon_text_notes = 176,
icon_notebook = 177,
icon_suitcase = 178,
icon_suitcase_zip = 179,
icon_mailbox = 180,
icon_monitor = 181,
icon_printer = 182,
icon_photo_camera = 183,
icon_photo_camera_flash = 184,
icon_house = 185,
icon_heart = 186,
icon_corner = 187,
icon_vertical_bars = 188,
icon_vertical_bars_fill = 189,
icon_life_bars = 190,
icon_info = 191,
icon_crossline = 192,
icon_help = 193,
icon_filetype_alpha = 194,
icon_filetype_home = 195,
icon_layers_visible = 196,
icon_layers = 197,
icon_window = 198,
icon_hidpi = 199,
icon_filetype_binary = 200,
icon_hex = 201,
icon_shield = 202,
icon_file_new = 203,
icon_folder_add = 204,
icon_alarm = 205,
icon_cpu = 206,
icon_rom = 207,
icon_step_over = 208,
icon_step_into = 209,
icon_step_out = 210,
icon_restart = 211,
icon_breakpoint_on = 212,
icon_breakpoint_off = 213,
icon_burger_menu = 214,
icon_case_sensitive = 215,
icon_reg_exp = 216,
icon_folder = 217,
icon_file = 218,
icon_sand_timer = 219,
icon_warning = 220,
icon_help_box = 221,
icon_info_box = 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 fn guiGetIcons() rl.RaylibError![]u32 {
var res: []u32 = undefined;
const ptr = cdef.GuiGetIcons();
if (ptr == 0) return rl.RaylibError.GenericError;
res.ptr = @as([*]u32, @ptrCast(ptr));
res.len = @as(usize, @intCast(256 * 256)); // RAYGUI_ICON_MAX_ICONS * RAYGUI_ICON_MAX_ICONS
return res;
}
// If you REALLY need the return value of the function, you'll know what to do with it and its size yourself
pub fn guiLoadIcons(fileName: [*c]const u8, loadIconsName: bool) [*c][*c]u8 {
return cdef.GuiLoadIcons(fileName, loadIconsName);
}
pub fn guiTabBar(bounds: Rectangle, text: [][:0]const u8, active: *i32) i32 {
return @as(i32, cdef.GuiTabBar(bounds, @as([*c][*c]const u8, @ptrCast(text)), @as(c_int, @intCast(text.len)), @as([*c]c_int, @ptrCast(active))));
}
pub fn guiListViewEx(bounds: Rectangle, text: [][:0]const u8, scrollIndex: *i32, active: *i32, focus: *i32) i32 {
return @as(i32, cdef.GuiListViewEx(bounds, @as([*c][*c]const u8, @ptrCast(text)), @as(c_int, @intCast(text.len)), @as([*c]c_int, @ptrCast(scrollIndex)), @as([*c]c_int, @ptrCast(active)), @as([*c]c_int, @ptrCast(focus))));
}

59
lib/raygui-ext.zig Normal file
View File

@ -0,0 +1,59 @@
const rl = @import("raylib-zig");
pub extern "c" fn GuiEnable() void;
pub extern "c" fn GuiDisable() void;
pub extern "c" fn GuiLock() void;
pub extern "c" fn GuiUnlock() void;
pub extern "c" fn GuiIsLocked() bool;
pub extern "c" fn GuiSetAlpha(alpha: f32) void;
pub extern "c" fn GuiSetState(state: c_int) void;
pub extern "c" fn GuiGetState() c_int;
pub extern "c" fn GuiSetFont(font: rl.Font) void;
pub extern "c" fn GuiGetFont() rl.Font;
pub extern "c" fn GuiSetStyle(control: c_int, property: c_int, value: c_int) void;
pub extern "c" fn GuiGetStyle(control: c_int, property: c_int) c_int;
pub extern "c" fn GuiLoadStyle(fileName: [*c]const u8) void;
pub extern "c" fn GuiLoadStyleDefault() void;
pub extern "c" fn GuiEnableTooltip() void;
pub extern "c" fn GuiDisableTooltip() void;
pub extern "c" fn GuiSetTooltip(tooltip: [*c]const u8) void;
pub extern "c" fn GuiIconText(iconId: c_int, text: [*c]const u8) [*c]const u8;
pub extern "c" fn GuiSetIconScale(scale: c_int) void;
pub extern "c" fn GuiGetIcons() [*c]c_uint;
pub extern "c" fn GuiLoadIcons(fileName: [*c]const u8, loadIconsName: bool) [*c][*c]u8;
pub extern "c" fn GuiDrawIcon(iconId: c_int, posX: c_int, posY: c_int, pixelSize: c_int, color: rl.Color) void;
pub extern "c" fn GuiWindowBox(bounds: rl.Rectangle, title: [*c]const u8) c_int;
pub extern "c" fn GuiGroupBox(bounds: rl.Rectangle, text: [*c]const u8) c_int;
pub extern "c" fn GuiLine(bounds: rl.Rectangle, text: [*c]const u8) c_int;
pub extern "c" fn GuiPanel(bounds: rl.Rectangle, text: [*c]const u8) c_int;
pub extern "c" fn GuiTabBar(bounds: rl.Rectangle, text: [*c][*c]const u8, count: c_int, active: [*c]c_int) c_int;
pub extern "c" fn GuiScrollPanel(bounds: rl.Rectangle, text: [*c]const u8, content: rl.Rectangle, scroll: [*c]rl.Vector2, view: [*c]rl.Rectangle) c_int;
pub extern "c" fn GuiLabel(bounds: rl.Rectangle, text: [*c]const u8) c_int;
pub extern "c" fn GuiButton(bounds: rl.Rectangle, text: [*c]const u8) c_int;
pub extern "c" fn GuiLabelButton(bounds: rl.Rectangle, text: [*c]const u8) c_int;
pub extern "c" fn GuiToggle(bounds: rl.Rectangle, text: [*c]const u8, active: [*c]bool) c_int;
pub extern "c" fn GuiToggleGroup(bounds: rl.Rectangle, text: [*c]const u8, active: [*c]c_int) c_int;
pub extern "c" fn GuiToggleSlider(bounds: rl.Rectangle, text: [*c]const u8, active: [*c]c_int) c_int;
pub extern "c" fn GuiCheckBox(bounds: rl.Rectangle, text: [*c]const u8, checked: [*c]bool) c_int;
pub extern "c" fn GuiComboBox(bounds: rl.Rectangle, text: [*c]const u8, active: [*c]c_int) c_int;
pub extern "c" fn GuiDropdownBox(bounds: rl.Rectangle, text: [*c]const u8, active: [*c]c_int, editMode: bool) c_int;
pub extern "c" fn GuiSpinner(bounds: rl.Rectangle, text: [*c]const u8, value: [*c]c_int, minValue: c_int, maxValue: c_int, editMode: bool) c_int;
pub extern "c" fn GuiValueBox(bounds: rl.Rectangle, text: [*c]const u8, value: [*c]c_int, minValue: c_int, maxValue: c_int, editMode: bool) c_int;
pub extern "c" fn GuiValueBoxFloat(bounds: rl.Rectangle, text: [*c]const u8, textValue: [*c]u8, value: [*c]f32, editMode: bool) c_int;
pub extern "c" fn GuiTextBox(bounds: rl.Rectangle, text: [*c]u8, textSize: c_int, editMode: bool) c_int;
pub extern "c" fn GuiSlider(bounds: rl.Rectangle, textLeft: [*c]const u8, textRight: [*c]const u8, value: [*c]f32, minValue: f32, maxValue: f32) c_int;
pub extern "c" fn GuiSliderBar(bounds: rl.Rectangle, textLeft: [*c]const u8, textRight: [*c]const u8, value: [*c]f32, minValue: f32, maxValue: f32) c_int;
pub extern "c" fn GuiProgressBar(bounds: rl.Rectangle, textLeft: [*c]const u8, textRight: [*c]const u8, value: [*c]f32, minValue: f32, maxValue: f32) c_int;
pub extern "c" fn GuiStatusBar(bounds: rl.Rectangle, text: [*c]const u8) c_int;
pub extern "c" fn GuiDummyRec(bounds: rl.Rectangle, text: [*c]const u8) c_int;
pub extern "c" fn GuiGrid(bounds: rl.Rectangle, text: [*c]const u8, spacing: f32, subdivs: c_int, mouseCell: [*c]rl.Vector2) c_int;
pub extern "c" fn GuiListView(bounds: rl.Rectangle, text: [*c]const u8, scrollIndex: [*c]c_int, active: [*c]c_int) c_int;
pub extern "c" fn GuiListViewEx(bounds: rl.Rectangle, text: [*c][*c]const u8, count: c_int, scrollIndex: [*c]c_int, active: [*c]c_int, focus: [*c]c_int) c_int;
pub extern "c" fn GuiMessageBox(bounds: rl.Rectangle, title: [*c]const u8, message: [*c]const u8, buttons: [*c]const u8) c_int;
pub extern "c" fn GuiTextInputBox(bounds: rl.Rectangle, title: [*c]const u8, message: [*c]const u8, buttons: [*c]const u8, text: [*c]u8, textMaxSize: c_int, secretViewActive: [*c]bool) c_int;
pub extern "c" fn GuiColorPicker(bounds: rl.Rectangle, text: [*c]const u8, color: [*c]rl.Color) c_int;
pub extern "c" fn GuiColorPanel(bounds: rl.Rectangle, text: [*c]const u8, color: [*c]rl.Color) c_int;
pub extern "c" fn GuiColorBarAlpha(bounds: rl.Rectangle, text: [*c]const u8, alpha: [*c]f32) c_int;
pub extern "c" fn GuiColorBarHue(bounds: rl.Rectangle, text: [*c]const u8, value: [*c]f32) c_int;
pub extern "c" fn GuiColorPickerHSV(bounds: rl.Rectangle, text: [*c]const u8, colorHsv: [*c]rl.Vector3) c_int;
pub extern "c" fn GuiColorPanelHSV(bounds: rl.Rectangle, text: [*c]const u8, colorHsv: [*c]rl.Vector3) c_int;

5686
lib/raygui.h Normal file

File diff suppressed because it is too large Load Diff

649
lib/raygui.zig Normal file
View File

@ -0,0 +1,649 @@
const rl = @import("raylib-zig");
const std = @import("std");
const cdef = @import("raygui-ext.zig");
test {
std.testing.refAllDeclsRecursive(@This());
}
const Vector2 = rl.Vector2;
const Vector3 = rl.Vector3;
const Color = rl.Color;
const Rectangle = rl.Rectangle;
const Font = rl.Font;
pub const GuiStyleProp = extern struct {
controlId: c_ushort,
propertyId: c_ushort,
propertyValue: c_int,
};
pub const GuiState = enum(c_int) {
state_normal = 0,
state_focused,
state_pressed,
state_disabled,
};
pub const GuiTextAlignment = enum(c_int) {
text_align_left = 0,
text_align_center,
text_align_right,
};
pub const GuiTextAlignmentVertical = enum(c_int) {
text_align_top = 0,
text_align_middle,
text_align_bottom,
};
pub const GuiTextWrapMode = enum(c_int) {
text_wrap_none = 0,
text_wrap_char,
text_wrap_word,
};
pub const GuiControl = enum(c_int) {
default = 0,
label,
button,
toggle,
slider,
progressbar,
checkbox,
combobox,
dropdownbox,
textbox,
valuebox,
spinner,
listview,
colorpicker,
scrollbar,
statusbar,
};
pub const GuiControlProperty = enum(c_int) {
border_color_normal = 0,
base_color_normal,
text_color_normal,
border_color_focused,
base_color_focused,
text_color_focused,
border_color_pressed,
base_color_pressed,
text_color_pressed,
border_color_disabled,
base_color_disabled,
text_color_disabled,
border_width,
text_padding,
text_alignment,
};
pub const GuiDefaultProperty = enum(c_int) {
text_size = 16,
text_spacing,
line_color,
background_color,
text_line_spacing,
text_alignment_vertical,
text_wrap_mode,
};
pub const GuiToggleProperty = enum(c_int) {
group_padding = 16,
};
pub const GuiSliderProperty = enum(c_int) {
slider_width = 16,
slider_padding,
};
pub const GuiProgressBarProperty = enum(c_int) {
progress_padding = 16,
};
pub const GuiScrollBarProperty = enum(c_int) {
arrows_size = 16,
arrows_visible,
scroll_slider_padding,
scroll_slider_size,
scroll_padding,
scroll_speed,
};
pub const GuiCheckBoxProperty = enum(c_int) {
check_padding = 16,
};
pub const GuiComboBoxProperty = enum(c_int) {
combo_button_width = 16,
combo_button_spacing,
};
pub const GuiDropdownBoxProperty = enum(c_int) {
arrow_padding = 16,
dropdown_items_spacing,
};
pub const GuiTextBoxProperty = enum(c_int) {
text_readonly = 16,
};
pub const GuiSpinnerProperty = enum(c_int) {
spin_button_width = 16,
spin_button_spacing,
};
pub const GuiListViewProperty = enum(c_int) {
list_items_height = 16,
list_items_spacing,
scrollbar_width,
scrollbar_side,
};
pub const GuiColorPickerProperty = enum(c_int) {
color_selector_size = 16,
huebar_width,
huebar_padding,
huebar_selector_height,
huebar_selector_overflow,
};
pub const scrollbar_left_side: c_int = 0;
pub const scrollbar_right_side: c_int = 1;
pub const GuiIconName = enum(c_int) {
icon_none = 0,
icon_folder_file_open = 1,
icon_file_save_classic = 2,
icon_folder_open = 3,
icon_folder_save = 4,
icon_file_open = 5,
icon_file_save = 6,
icon_file_export = 7,
icon_file_add = 8,
icon_file_delete = 9,
icon_filetype_text = 10,
icon_filetype_audio = 11,
icon_filetype_image = 12,
icon_filetype_play = 13,
icon_filetype_video = 14,
icon_filetype_info = 15,
icon_file_copy = 16,
icon_file_cut = 17,
icon_file_paste = 18,
icon_cursor_hand = 19,
icon_cursor_pointer = 20,
icon_cursor_classic = 21,
icon_pencil = 22,
icon_pencil_big = 23,
icon_brush_classic = 24,
icon_brush_painter = 25,
icon_water_drop = 26,
icon_color_picker = 27,
icon_rubber = 28,
icon_color_bucket = 29,
icon_text_t = 30,
icon_text_a = 31,
icon_scale = 32,
icon_resize = 33,
icon_filter_point = 34,
icon_filter_bilinear = 35,
icon_crop = 36,
icon_crop_alpha = 37,
icon_square_toggle = 38,
icon_symmetry = 39,
icon_symmetry_horizontal = 40,
icon_symmetry_vertical = 41,
icon_lens = 42,
icon_lens_big = 43,
icon_eye_on = 44,
icon_eye_off = 45,
icon_filter_top = 46,
icon_filter = 47,
icon_target_point = 48,
icon_target_small = 49,
icon_target_big = 50,
icon_target_move = 51,
icon_cursor_move = 52,
icon_cursor_scale = 53,
icon_cursor_scale_right = 54,
icon_cursor_scale_left = 55,
icon_undo = 56,
icon_redo = 57,
icon_reredo = 58,
icon_mutate = 59,
icon_rotate = 60,
icon_repeat = 61,
icon_shuffle = 62,
icon_emptybox = 63,
icon_target = 64,
icon_target_small_fill = 65,
icon_target_big_fill = 66,
icon_target_move_fill = 67,
icon_cursor_move_fill = 68,
icon_cursor_scale_fill = 69,
icon_cursor_scale_right_fill = 70,
icon_cursor_scale_left_fill = 71,
icon_undo_fill = 72,
icon_redo_fill = 73,
icon_reredo_fill = 74,
icon_mutate_fill = 75,
icon_rotate_fill = 76,
icon_repeat_fill = 77,
icon_shuffle_fill = 78,
icon_emptybox_small = 79,
icon_box = 80,
icon_box_top = 81,
icon_box_top_right = 82,
icon_box_right = 83,
icon_box_bottom_right = 84,
icon_box_bottom = 85,
icon_box_bottom_left = 86,
icon_box_left = 87,
icon_box_top_left = 88,
icon_box_center = 89,
icon_box_circle_mask = 90,
icon_pot = 91,
icon_alpha_multiply = 92,
icon_alpha_clear = 93,
icon_dithering = 94,
icon_mipmaps = 95,
icon_box_grid = 96,
icon_grid = 97,
icon_box_corners_small = 98,
icon_box_corners_big = 99,
icon_four_boxes = 100,
icon_grid_fill = 101,
icon_box_multisize = 102,
icon_zoom_small = 103,
icon_zoom_medium = 104,
icon_zoom_big = 105,
icon_zoom_all = 106,
icon_zoom_center = 107,
icon_box_dots_small = 108,
icon_box_dots_big = 109,
icon_box_concentric = 110,
icon_box_grid_big = 111,
icon_ok_tick = 112,
icon_cross = 113,
icon_arrow_left = 114,
icon_arrow_right = 115,
icon_arrow_down = 116,
icon_arrow_up = 117,
icon_arrow_left_fill = 118,
icon_arrow_right_fill = 119,
icon_arrow_down_fill = 120,
icon_arrow_up_fill = 121,
icon_audio = 122,
icon_fx = 123,
icon_wave = 124,
icon_wave_sinus = 125,
icon_wave_square = 126,
icon_wave_triangular = 127,
icon_cross_small = 128,
icon_player_previous = 129,
icon_player_play_back = 130,
icon_player_play = 131,
icon_player_pause = 132,
icon_player_stop = 133,
icon_player_next = 134,
icon_player_record = 135,
icon_magnet = 136,
icon_lock_close = 137,
icon_lock_open = 138,
icon_clock = 139,
icon_tools = 140,
icon_gear = 141,
icon_gear_big = 142,
icon_bin = 143,
icon_hand_pointer = 144,
icon_laser = 145,
icon_coin = 146,
icon_explosion = 147,
icon_1up = 148,
icon_player = 149,
icon_player_jump = 150,
icon_key = 151,
icon_demon = 152,
icon_text_popup = 153,
icon_gear_ex = 154,
icon_crack = 155,
icon_crack_points = 156,
icon_star = 157,
icon_door = 158,
icon_exit = 159,
icon_mode_2d = 160,
icon_mode_3d = 161,
icon_cube = 162,
icon_cube_face_top = 163,
icon_cube_face_left = 164,
icon_cube_face_front = 165,
icon_cube_face_bottom = 166,
icon_cube_face_right = 167,
icon_cube_face_back = 168,
icon_camera = 169,
icon_special = 170,
icon_link_net = 171,
icon_link_boxes = 172,
icon_link_multi = 173,
icon_link = 174,
icon_link_broke = 175,
icon_text_notes = 176,
icon_notebook = 177,
icon_suitcase = 178,
icon_suitcase_zip = 179,
icon_mailbox = 180,
icon_monitor = 181,
icon_printer = 182,
icon_photo_camera = 183,
icon_photo_camera_flash = 184,
icon_house = 185,
icon_heart = 186,
icon_corner = 187,
icon_vertical_bars = 188,
icon_vertical_bars_fill = 189,
icon_life_bars = 190,
icon_info = 191,
icon_crossline = 192,
icon_help = 193,
icon_filetype_alpha = 194,
icon_filetype_home = 195,
icon_layers_visible = 196,
icon_layers = 197,
icon_window = 198,
icon_hidpi = 199,
icon_filetype_binary = 200,
icon_hex = 201,
icon_shield = 202,
icon_file_new = 203,
icon_folder_add = 204,
icon_alarm = 205,
icon_cpu = 206,
icon_rom = 207,
icon_step_over = 208,
icon_step_into = 209,
icon_step_out = 210,
icon_restart = 211,
icon_breakpoint_on = 212,
icon_breakpoint_off = 213,
icon_burger_menu = 214,
icon_case_sensitive = 215,
icon_reg_exp = 216,
icon_folder = 217,
icon_file = 218,
icon_sand_timer = 219,
icon_warning = 220,
icon_help_box = 221,
icon_info_box = 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 fn guiGetIcons() rl.RaylibError![]u32 {
var res: []u32 = undefined;
const ptr = cdef.GuiGetIcons();
if (ptr == 0) return rl.RaylibError.GenericError;
res.ptr = @as([*]u32, @ptrCast(ptr));
res.len = @as(usize, @intCast(256 * 256)); // RAYGUI_ICON_MAX_ICONS * RAYGUI_ICON_MAX_ICONS
return res;
}
// If you REALLY need the return value of the function, you'll know what to do with it and its size yourself
pub fn guiLoadIcons(fileName: [*c]const u8, loadIconsName: bool) [*c][*c]u8 {
return cdef.GuiLoadIcons(fileName, loadIconsName);
}
pub fn guiTabBar(bounds: Rectangle, text: [][:0]const u8, active: *i32) i32 {
return @as(i32, cdef.GuiTabBar(bounds, @as([*c][*c]const u8, @ptrCast(text)), @as(c_int, @intCast(text.len)), @as([*c]c_int, @ptrCast(active))));
}
pub fn guiListViewEx(bounds: Rectangle, text: [][:0]const u8, scrollIndex: *i32, active: *i32, focus: *i32) i32 {
return @as(i32, cdef.GuiListViewEx(bounds, @as([*c][*c]const u8, @ptrCast(text)), @as(c_int, @intCast(text.len)), @as([*c]c_int, @ptrCast(scrollIndex)), @as([*c]c_int, @ptrCast(active)), @as([*c]c_int, @ptrCast(focus))));
}
pub fn guiEnable() void {
cdef.GuiEnable();
}
pub fn guiDisable() void {
cdef.GuiDisable();
}
pub fn guiLock() void {
cdef.GuiLock();
}
pub fn guiUnlock() void {
cdef.GuiUnlock();
}
pub fn guiIsLocked() bool {
return cdef.GuiIsLocked();
}
pub fn guiSetAlpha(alpha: f32) void {
cdef.GuiSetAlpha(alpha);
}
pub fn guiSetState(state: i32) void {
cdef.GuiSetState(@as(c_int, state));
}
pub fn guiGetState() i32 {
return @as(i32, cdef.GuiGetState());
}
pub fn guiSetFont(font: Font) void {
cdef.GuiSetFont(font);
}
pub fn guiGetFont() Font {
return cdef.GuiGetFont();
}
pub fn guiSetStyle(control: i32, property: i32, value: i32) void {
cdef.GuiSetStyle(@as(c_int, control), @as(c_int, property), @as(c_int, value));
}
pub fn guiGetStyle(control: i32, property: i32) i32 {
return @as(i32, cdef.GuiGetStyle(@as(c_int, control), @as(c_int, property)));
}
pub fn guiLoadStyle(fileName: [:0]const u8) void {
cdef.GuiLoadStyle(@as([*c]const u8, @ptrCast(fileName)));
}
pub fn guiLoadStyleDefault() void {
cdef.GuiLoadStyleDefault();
}
pub fn guiEnableTooltip() void {
cdef.GuiEnableTooltip();
}
pub fn guiDisableTooltip() void {
cdef.GuiDisableTooltip();
}
pub fn guiSetTooltip(tooltip: [:0]const u8) void {
cdef.GuiSetTooltip(@as([*c]const u8, @ptrCast(tooltip)));
}
pub fn guiIconText(iconId: i32, text: [:0]const u8) [:0]const u8 {
return std.mem.span(cdef.GuiIconText(@as(c_int, iconId), @as([*c]const u8, @ptrCast(text))));
}
pub fn guiSetIconScale(scale: i32) void {
cdef.GuiSetIconScale(@as(c_int, scale));
}
pub fn guiDrawIcon(iconId: i32, posX: i32, posY: i32, pixelSize: i32, color: Color) void {
cdef.GuiDrawIcon(@as(c_int, iconId), @as(c_int, posX), @as(c_int, posY), @as(c_int, pixelSize), color);
}
pub fn guiWindowBox(bounds: Rectangle, title: [:0]const u8) i32 {
return @as(i32, cdef.GuiWindowBox(bounds, @as([*c]const u8, @ptrCast(title))));
}
pub fn guiGroupBox(bounds: Rectangle, text: [:0]const u8) i32 {
return @as(i32, cdef.GuiGroupBox(bounds, @as([*c]const u8, @ptrCast(text))));
}
pub fn guiLine(bounds: Rectangle, text: [:0]const u8) i32 {
return @as(i32, cdef.GuiLine(bounds, @as([*c]const u8, @ptrCast(text))));
}
pub fn guiPanel(bounds: Rectangle, text: [:0]const u8) i32 {
return @as(i32, cdef.GuiPanel(bounds, @as([*c]const u8, @ptrCast(text))));
}
pub fn guiScrollPanel(bounds: Rectangle, text: [:0]const u8, content: Rectangle, scroll: *Vector2, view: *Rectangle) i32 {
return @as(i32, cdef.GuiScrollPanel(bounds, @as([*c]const u8, @ptrCast(text)), content, @as([*c]Vector2, @ptrCast(scroll)), @as([*c]Rectangle, @ptrCast(view))));
}
pub fn guiLabel(bounds: Rectangle, text: [:0]const u8) i32 {
return @as(i32, cdef.GuiLabel(bounds, @as([*c]const u8, @ptrCast(text))));
}
pub fn guiButton(bounds: Rectangle, text: [:0]const u8) i32 {
return @as(i32, cdef.GuiButton(bounds, @as([*c]const u8, @ptrCast(text))));
}
pub fn guiLabelButton(bounds: Rectangle, text: [:0]const u8) i32 {
return @as(i32, cdef.GuiLabelButton(bounds, @as([*c]const u8, @ptrCast(text))));
}
pub fn guiToggle(bounds: Rectangle, text: [:0]const u8, active: *bool) i32 {
return @as(i32, cdef.GuiToggle(bounds, @as([*c]const u8, @ptrCast(text)), @as([*c]bool, @ptrCast(active))));
}
pub fn guiToggleGroup(bounds: Rectangle, text: [:0]const u8, active: *i32) i32 {
return @as(i32, cdef.GuiToggleGroup(bounds, @as([*c]const u8, @ptrCast(text)), @as([*c]c_int, @ptrCast(active))));
}
pub fn guiToggleSlider(bounds: Rectangle, text: [:0]const u8, active: *i32) i32 {
return @as(i32, cdef.GuiToggleSlider(bounds, @as([*c]const u8, @ptrCast(text)), @as([*c]c_int, @ptrCast(active))));
}
pub fn guiCheckBox(bounds: Rectangle, text: [:0]const u8, checked: *bool) i32 {
return @as(i32, cdef.GuiCheckBox(bounds, @as([*c]const u8, @ptrCast(text)), @as([*c]bool, @ptrCast(checked))));
}
pub fn guiComboBox(bounds: Rectangle, text: [:0]const u8, active: *i32) i32 {
return @as(i32, cdef.GuiComboBox(bounds, @as([*c]const u8, @ptrCast(text)), @as([*c]c_int, @ptrCast(active))));
}
pub fn guiDropdownBox(bounds: Rectangle, text: [:0]const u8, active: *i32, editMode: bool) i32 {
return @as(i32, cdef.GuiDropdownBox(bounds, @as([*c]const u8, @ptrCast(text)), @as([*c]c_int, @ptrCast(active)), editMode));
}
pub fn guiSpinner(bounds: Rectangle, text: [:0]const u8, value: *i32, minValue: i32, maxValue: i32, editMode: bool) i32 {
return @as(i32, cdef.GuiSpinner(bounds, @as([*c]const u8, @ptrCast(text)), @as([*c]c_int, @ptrCast(value)), @as(c_int, minValue), @as(c_int, maxValue), editMode));
}
pub fn guiValueBox(bounds: Rectangle, text: [:0]const u8, value: *i32, minValue: i32, maxValue: i32, editMode: bool) i32 {
return @as(i32, cdef.GuiValueBox(bounds, @as([*c]const u8, @ptrCast(text)), @as([*c]c_int, @ptrCast(value)), @as(c_int, minValue), @as(c_int, maxValue), editMode));
}
pub fn guiValueBoxFloat(bounds: Rectangle, text: [:0]const u8, textValue: [:0]u8, value: *f32, editMode: bool) i32 {
return @as(i32, cdef.GuiValueBoxFloat(bounds, @as([*c]const u8, @ptrCast(text)), @as([*c]u8, @ptrCast(textValue)), @as([*c]f32, @ptrCast(value)), editMode));
}
pub fn guiTextBox(bounds: Rectangle, text: [:0]u8, textSize: i32, editMode: bool) i32 {
return @as(i32, cdef.GuiTextBox(bounds, @as([*c]u8, @ptrCast(text)), @as(c_int, textSize), editMode));
}
pub fn guiSlider(bounds: Rectangle, textLeft: [:0]const u8, textRight: [:0]const u8, value: *f32, minValue: f32, maxValue: f32) i32 {
return @as(i32, cdef.GuiSlider(bounds, @as([*c]const u8, @ptrCast(textLeft)), @as([*c]const u8, @ptrCast(textRight)), @as([*c]f32, @ptrCast(value)), minValue, maxValue));
}
pub fn guiSliderBar(bounds: Rectangle, textLeft: [:0]const u8, textRight: [:0]const u8, value: *f32, minValue: f32, maxValue: f32) i32 {
return @as(i32, cdef.GuiSliderBar(bounds, @as([*c]const u8, @ptrCast(textLeft)), @as([*c]const u8, @ptrCast(textRight)), @as([*c]f32, @ptrCast(value)), minValue, maxValue));
}
pub fn guiProgressBar(bounds: Rectangle, textLeft: [:0]const u8, textRight: [:0]const u8, value: *f32, minValue: f32, maxValue: f32) i32 {
return @as(i32, cdef.GuiProgressBar(bounds, @as([*c]const u8, @ptrCast(textLeft)), @as([*c]const u8, @ptrCast(textRight)), @as([*c]f32, @ptrCast(value)), minValue, maxValue));
}
pub fn guiStatusBar(bounds: Rectangle, text: [:0]const u8) i32 {
return @as(i32, cdef.GuiStatusBar(bounds, @as([*c]const u8, @ptrCast(text))));
}
pub fn guiDummyRec(bounds: Rectangle, text: [:0]const u8) i32 {
return @as(i32, cdef.GuiDummyRec(bounds, @as([*c]const u8, @ptrCast(text))));
}
pub fn guiGrid(bounds: Rectangle, text: [:0]const u8, spacing: f32, subdivs: i32, mouseCell: *Vector2) i32 {
return @as(i32, cdef.GuiGrid(bounds, @as([*c]const u8, @ptrCast(text)), spacing, @as(c_int, subdivs), @as([*c]Vector2, @ptrCast(mouseCell))));
}
pub fn guiListView(bounds: Rectangle, text: [:0]const u8, scrollIndex: *i32, active: *i32) i32 {
return @as(i32, cdef.GuiListView(bounds, @as([*c]const u8, @ptrCast(text)), @as([*c]c_int, @ptrCast(scrollIndex)), @as([*c]c_int, @ptrCast(active))));
}
pub fn guiMessageBox(bounds: Rectangle, title: [:0]const u8, message: [:0]const u8, buttons: [:0]const u8) i32 {
return @as(i32, cdef.GuiMessageBox(bounds, @as([*c]const u8, @ptrCast(title)), @as([*c]const u8, @ptrCast(message)), @as([*c]const u8, @ptrCast(buttons))));
}
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 @as(i32, cdef.GuiTextInputBox(bounds, @as([*c]const u8, @ptrCast(title)), @as([*c]const u8, @ptrCast(message)), @as([*c]const u8, @ptrCast(buttons)), @as([*c]u8, @ptrCast(text)), @as(c_int, textMaxSize), @as([*c]bool, @ptrCast(secretViewActive))));
}
pub fn guiColorPicker(bounds: Rectangle, text: [:0]const u8, color: *Color) i32 {
return @as(i32, cdef.GuiColorPicker(bounds, @as([*c]const u8, @ptrCast(text)), @as([*c]Color, @ptrCast(color))));
}
pub fn guiColorPanel(bounds: Rectangle, text: [:0]const u8, color: *Color) i32 {
return @as(i32, cdef.GuiColorPanel(bounds, @as([*c]const u8, @ptrCast(text)), @as([*c]Color, @ptrCast(color))));
}
pub fn guiColorBarAlpha(bounds: Rectangle, text: [:0]const u8, alpha: *f32) i32 {
return @as(i32, cdef.GuiColorBarAlpha(bounds, @as([*c]const u8, @ptrCast(text)), @as([*c]f32, @ptrCast(alpha))));
}
pub fn guiColorBarHue(bounds: Rectangle, text: [:0]const u8, value: *f32) i32 {
return @as(i32, cdef.GuiColorBarHue(bounds, @as([*c]const u8, @ptrCast(text)), @as([*c]f32, @ptrCast(value))));
}
pub fn guiColorPickerHSV(bounds: Rectangle, text: [:0]const u8, colorHsv: *Vector3) i32 {
return @as(i32, cdef.GuiColorPickerHSV(bounds, @as([*c]const u8, @ptrCast(text)), @as([*c]Vector3, @ptrCast(colorHsv))));
}
pub fn guiColorPanelHSV(bounds: Rectangle, text: [:0]const u8, colorHsv: *Vector3) i32 {
return @as(i32, cdef.GuiColorPanelHSV(bounds, @as([*c]const u8, @ptrCast(text)), @as([*c]Vector3, @ptrCast(colorHsv))));
}