From 7e9246c069778f419910c100d34936b94199ef1f Mon Sep 17 00:00:00 2001 From: JupiterRider <60042618+JupiterRider@users.noreply.github.com> Date: Tue, 17 Jun 2025 17:47:09 +0200 Subject: [PATCH 1/2] raygui/cstring.go: "fix" possible misuse of unsafe.Pointer --- raygui/cstring.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/raygui/cstring.go b/raygui/cstring.go index c321ae2..023bfd4 100644 --- a/raygui/cstring.go +++ b/raygui/cstring.go @@ -70,7 +70,7 @@ func (arr *CStringArray) ToSlice() []string { defer C.free(unsafe.Pointer(cs)) p := uintptr(arr.Pointer) for { - cs = (**C.char)(unsafe.Pointer(p)) + cs = *(***C.char)(unsafe.Pointer(&p)) if *cs == nil { // skip NULL - the last element break } From 9a87dd6d60eaa9d619281d152c3fade64e282777 Mon Sep 17 00:00:00 2001 From: JupiterRider <60042618+JupiterRider@users.noreply.github.com> Date: Tue, 17 Jun 2025 17:48:13 +0200 Subject: [PATCH 2/2] raygui: Spinner returns true if clicked #503 --- raygui/raygui.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/raygui/raygui.go b/raygui/raygui.go index b72e28b..a4e6820 100644 --- a/raygui/raygui.go +++ b/raygui/raygui.go @@ -548,8 +548,8 @@ func ComboBox(bounds rl.Rectangle, text string, active int32) int32 { return int32(cactive) } -// Spinner control, returns selected value -func Spinner(bounds rl.Rectangle, text string, value *int32, minValue, maxValue int, editMode bool) int32 { +// Spinner control, sets value to the selected number and returns true when clicked. +func Spinner(bounds rl.Rectangle, text string, value *int32, minValue, maxValue int, editMode bool) bool { var cbounds C.struct_Rectangle cbounds.x = C.float(bounds.X) cbounds.y = C.float(bounds.Y) @@ -573,8 +573,7 @@ func Spinner(bounds rl.Rectangle, text string, value *int32, minValue, maxValue cmaxValue := C.int(maxValue) ceditMode := C.bool(editMode) - C.GuiSpinner(cbounds, ctext, &cvalue, cminValue, cmaxValue, ceditMode) - return int32(cvalue) + return C.GuiSpinner(cbounds, ctext, &cvalue, cminValue, cmaxValue, ceditMode) != 0 } // Slider control