Fix return type for raygui.labelButton

This commit is contained in:
Nikolas 2025-05-04 17:31:08 +02:00
parent 2e60ac0127
commit 3bf08a304c
No known key found for this signature in database
GPG Key ID: E95F679E3CDD9784
3 changed files with 8 additions and 42 deletions

View File

@ -427,7 +427,7 @@ pub const IconName = enum(c_int) {
/// Set one style property
pub fn setStyle(control: Control, comptime property: ControlOrDefaultProperty, value: i32) void {
const property_int: c_int = switch (property) {
inline else => |val| @intCast(@intFromEnum(val))
inline else => |val| @intCast(@intFromEnum(val)),
};
cdef.GuiSetStyle(control, property_int, @as(c_int, value));
@ -436,7 +436,7 @@ pub fn setStyle(control: Control, comptime property: ControlOrDefaultProperty, v
/// Get one style property
pub fn getStyle(control: Control, comptime property: ControlOrDefaultProperty) i32 {
const property_int: c_int = switch (property) {
inline else => |val| @intCast(@intFromEnum(val))
inline else => |val| @intCast(@intFromEnum(val)),
};
return @as(i32, cdef.GuiGetStyle(control, property_int));
@ -494,7 +494,7 @@ pub fn button(bounds: Rectangle, text: [:0]const u8) bool {
}
/// Label button control, returns true when clicked
pub fn labelButton(bounds: Rectangle, text: [:0]const u8) i32 {
pub fn labelButton(bounds: Rectangle, text: [:0]const u8) bool {
return @as(i32, cdef.GuiLabelButton(bounds, @as([*c]const u8, @ptrCast(text)))) > 0;
}
@ -508,4 +508,3 @@ pub fn checkBox(bounds: Rectangle, text: [:0]const u8, checked: *bool) bool {
pub fn textBox(bounds: Rectangle, text: [:0]u8, textSize: i32, editMode: bool) bool {
return @as(i32, cdef.GuiTextBox(bounds, @as([*c]u8, @ptrCast(text)), @as(c_int, textSize), editMode)) > 0;
}

View File

@ -427,7 +427,7 @@ pub const IconName = enum(c_int) {
/// Set one style property
pub fn setStyle(control: Control, comptime property: ControlOrDefaultProperty, value: i32) void {
const property_int: c_int = switch (property) {
inline else => |val| @intCast(@intFromEnum(val))
inline else => |val| @intCast(@intFromEnum(val)),
};
cdef.GuiSetStyle(control, property_int, @as(c_int, value));
@ -436,7 +436,7 @@ pub fn setStyle(control: Control, comptime property: ControlOrDefaultProperty, v
/// Get one style property
pub fn getStyle(control: Control, comptime property: ControlOrDefaultProperty) i32 {
const property_int: c_int = switch (property) {
inline else => |val| @intCast(@intFromEnum(val))
inline else => |val| @intCast(@intFromEnum(val)),
};
return @as(i32, cdef.GuiGetStyle(control, property_int));
@ -494,7 +494,7 @@ pub fn button(bounds: Rectangle, text: [:0]const u8) bool {
}
/// Label button control, returns true when clicked
pub fn labelButton(bounds: Rectangle, text: [:0]const u8) i32 {
pub fn labelButton(bounds: Rectangle, text: [:0]const u8) bool {
return @as(i32, cdef.GuiLabelButton(bounds, @as([*c]const u8, @ptrCast(text)))) > 0;
}
@ -509,7 +509,6 @@ pub fn textBox(bounds: Rectangle, text: [:0]u8, textSize: i32, editMode: bool) b
return @as(i32, cdef.GuiTextBox(bounds, @as([*c]u8, @ptrCast(text)), @as(c_int, textSize), editMode)) > 0;
}
/// Enable gui controls (global state)
pub fn enable() void {
cdef.GuiEnable();

View File

@ -1819,38 +1819,7 @@ pub const MaterialMapIndex = enum(c_int) {
brdf = 10,
};
pub const ShaderLocationIndex = enum(c_int) {
vertex_position = 0,
vertex_texcoord01 = 1,
vertex_texcoord02 = 2,
vertex_normal = 3,
vertex_tangent = 4,
vertex_color = 5,
matrix_mvp = 6,
matrix_view = 7,
matrix_projection = 8,
matrix_model = 9,
matrix_normal = 10,
vector_view = 11,
color_diffuse = 12,
color_specular = 13,
color_ambient = 14,
map_albedo = 15,
map_metalness = 16,
map_normal = 17,
map_roughness = 18,
map_occlusion = 19,
map_emission = 20,
map_height = 21,
map_cubemap = 22,
map_irradiance = 23,
map_prefilter = 24,
map_brdf = 25,
vertex_boneids = 26,
vertex_boneweights = 27,
bone_matrices = 28,
shader_loc_vertex_instance_tx
};
pub const ShaderLocationIndex = enum(c_int) { vertex_position = 0, vertex_texcoord01 = 1, vertex_texcoord02 = 2, vertex_normal = 3, vertex_tangent = 4, vertex_color = 5, matrix_mvp = 6, matrix_view = 7, matrix_projection = 8, matrix_model = 9, matrix_normal = 10, vector_view = 11, color_diffuse = 12, color_specular = 13, color_ambient = 14, map_albedo = 15, map_metalness = 16, map_normal = 17, map_roughness = 18, map_occlusion = 19, map_emission = 20, map_height = 21, map_cubemap = 22, map_irradiance = 23, map_prefilter = 24, map_brdf = 25, vertex_boneids = 26, vertex_boneweights = 27, bone_matrices = 28, shader_loc_vertex_instance_tx };
pub const ShaderUniformDataType = enum(c_int) {
float = 0,
@ -1982,7 +1951,7 @@ pub const AudioCallback = ?*const fn (?*anyopaque, c_uint) callconv(.C) void;
pub const RAYLIB_VERSION_MAJOR = @as(i32, 5);
pub const RAYLIB_VERSION_MINOR = @as(i32, 5);
pub const RAYLIB_VERSION_PATCH = @as(i32, 0);
pub const RAYLIB_VERSION = "5.6-devfn alloc(_: *anyopaque, len: usize, _: std.mem.Alignment, _: usize) ?[*]u8 {";
pub const RAYLIB_VERSION = "5.6-dev";
pub const MAX_TOUCH_POINTS = 10;
pub const MAX_MATERIAL_MAPS = 12;
@ -2474,7 +2443,6 @@ fn remap(_: *anyopaque, buf: []u8, _: std.mem.Alignment, new_len: usize, _: usiz
}
}
const mem_vtable = std.mem.Allocator.VTable{
.alloc = alloc,
.resize = resize,