Binding tweaks

This commit is contained in:
Synthasmagoria 2026-09-11 18:30:51 +02:00
commit 53a148d979
4 changed files with 839 additions and 457 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,10 @@
#!/usr/bin/env bash
# Currently not cross compiling for windows and darwin
set -euo pipefail
# This is supposed to use Karl Zylinski's odin-c-bindgen
# https://github.com/karl-zylinski/odin-c-bindgen
odin-c-bindgen bindgen.sjson
rm -f ../raygui.odin
cp bindgen_output/raygui.odin ../
rm -r bindgen_output

View file

@ -4,8 +4,15 @@ inputs = [
imports_file = "imports.odin"
output_folder = "bindgen_output"
package_name = "raylib"
clang_include_paths = [
"../raylib/src"
]
procedure_type_overrides = {
"GuiSetStyle.control" = "GuiControl"
"GuiGetStyle.control" = "GuiControl"
}

View file

@ -1091,7 +1091,7 @@ program_render_ui_and_handle_focus :: proc(ctx: ^ui.Context, focus_element_id: u
// TODO (synthas): implement keeping the rectangle within screen borders
tooltip_position = rl.GetMousePosition()
}
if rl.GuiButton(area, element.label) {
if rl.GuiButton(area, element.label) == 1 {
if element.data == nil do break
data := cast(^UiElementData_Button)element.data
switch data.type {
@ -1199,7 +1199,7 @@ program_render_ui_and_handle_focus :: proc(ctx: ^ui.Context, focus_element_id: u
}
case .InputText:
data := cast(^UiElementData_TextInput)element.data
if rl.GuiTextBox(area, data.str, i32(program.font_style.size), focus_element_id == element.id) {
if rl.GuiTextBox(area, data.str, i32(program.font_style.size), focus_element_id == element.id) == 1 {
focus_element_id = element.id
}
case .Label: