fix(raygui): make some funcs return bool instead of i32
This commit is contained in:
parent
67fd5af55a
commit
0de5f8aed0
4 changed files with 52 additions and 24 deletions
|
|
@ -487,3 +487,25 @@ pub fn scrollPanel(bounds: Rectangle, text: ?[*:0]const u8, content: Rectangle,
|
|||
}
|
||||
return @as(i32, cdef.GuiScrollPanel(bounds, textFinal, content, @as([*c]Vector2, @ptrCast(scroll)), @as([*c]Rectangle, @ptrCast(view))));
|
||||
}
|
||||
|
||||
/// Button control, returns true when clicked
|
||||
pub fn button(bounds: Rectangle, text: [:0]const u8) bool {
|
||||
return @as(i32, cdef.GuiButton(bounds, @as([*c]const u8, @ptrCast(text)))) > 0;
|
||||
}
|
||||
|
||||
/// Label button control, returns true when clicked
|
||||
pub fn labelButton(bounds: Rectangle, text: [:0]const u8) i32 {
|
||||
return @as(i32, cdef.GuiLabelButton(bounds, @as([*c]const u8, @ptrCast(text)))) > 0;
|
||||
}
|
||||
|
||||
/// Check Box control, returns true when active
|
||||
pub fn checkBox(bounds: Rectangle, text: [:0]const u8, checked: *bool) bool {
|
||||
return @as(i32, cdef.GuiCheckBox(bounds, @as([*c]const u8, @ptrCast(text)), @as([*c]bool, @ptrCast(checked)))) > 0;
|
||||
}
|
||||
|
||||
/// Text Box control, updates input text
|
||||
/// Returns true on ENTER pressed (useful for data validation)
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue