From cb0b92e73a2686d2c4e97be71f41f1ab85d749f9 Mon Sep 17 00:00:00 2001 From: Konstantin8105 Date: Fri, 25 Nov 2022 12:50:20 +0300 Subject: [PATCH] fix: add icons, nil C pointers --- .../controls_test_suite.go | 84 +++-- raygui3_5/raygui.go | 352 +++++++++++++++--- 2 files changed, 354 insertions(+), 82 deletions(-) diff --git a/examples/gui/controls_test_suite/controls_test_suite.go b/examples/gui/controls_test_suite/controls_test_suite.go index c3310ce..1cad647 100644 --- a/examples/gui/controls_test_suite/controls_test_suite.go +++ b/examples/gui/controls_test_suite/controls_test_suite.go @@ -81,13 +81,13 @@ func main() { listViewScrollIndex int32 = 0 listViewActive int32 = -1 - //TODO listViewExScrollIndex int32 = 0 - //TODO listViewExActive int32 = 2 - //TODO listViewExFocus int32 = -1 - //TODO listViewExList = [8]string{"This", "is", "a", "list view", "with", "disable", "elements", "amazing!"} + listViewExScrollIndex int32 = 0 + listViewExActive int32 = 2 + listViewExFocus int32 = -1 + listViewExList = []string{"This", "is", "a", "list view", "with", "disable", "elements", "amazing!"} - // TODO multiTextBoxText = "Multi text box" - // TODO multiTextBoxEditMode bool = false + multiTextBoxText = "Multi text box" + multiTextBoxEditMode bool = false colorPickerValue = rl.Red sliderValue float32 = 50 @@ -102,7 +102,7 @@ func main() { toggleGroupActive int32 = 0 - //TODO viewScroll = rl.Vector2{0, 0} + // TODO viewScroll = rl.Vector2{0, 0} //---------------------------------------------------------------------------------- @@ -113,7 +113,7 @@ func main() { exitWindow bool = false showMessageBox bool = false - // TODO textInput string + textInput string showTextInputBox bool = false // TODO textInputFileName string @@ -136,13 +136,13 @@ func main() { showTextInputBox = true } - if rl.IsFileDropped() { - // TODO var droppedFiles gui.FilePathList = rl.LoadDroppedFiles() - // TODO if (droppedFiles.count > 0) && rl.IsFileExtension(droppedFiles.paths[0], ".rgs") { - // TODO gui.LoadStyle(droppedFiles.paths[0]) - // TODO } - // TODO rl.UnloadDroppedFiles(droppedFiles) // Clear internal buffers - } + // TODO if rl.IsFileDropped() { + // TODO var droppedFiles gui.FilePathList = rl.LoadDroppedFiles() + // TODO if (droppedFiles.count > 0) && rl.IsFileExtension(droppedFiles.paths[0], ".rgs") { + // TODO gui.LoadStyle(droppedFiles.paths[0]) + // TODO } + // TODO rl.UnloadDroppedFiles(droppedFiles) // Clear internal buffers + // TODO } //---------------------------------------------------------------------------------- // Draw @@ -179,9 +179,9 @@ func main() { gui.SetStyle(gui.BUTTON, gui.TEXT_ALIGNMENT, gui.TEXT_ALIGN_CENTER) - // TODO if gui.Button(rl.Rectangle{25, 255, 125, 30}, gui.IconText(gui.ICON_FILE_SAVE, "Save File")) { - // TODO showTextInputBox = true - // TODO } + if gui.Button(rl.Rectangle{25, 255, 125, 30}, gui.IconText(gui.ICON_FILE_SAVE, "Save File")) { + showTextInputBox = true + } gui.GroupBox(rl.Rectangle{25, 310, 125, 150}, "STATES") //GuiLock(); @@ -215,14 +215,14 @@ func main() { // Second GUI column listViewActive = gui.ListView(rl.Rectangle{165, 25, 140, 140}, "Charmander;Bulbasaur;#18#Squirtel;Pikachu;Eevee;Pidgey", &listViewScrollIndex, listViewActive) - //TODO listViewExActive = gui.ListViewEx(rl.Rectangle{165, 180, 140, 200}, listViewExList, 8, &listViewExFocus, &listViewExScrollIndex, listViewExActive) + listViewExActive = gui.ListViewEx(rl.Rectangle{165, 180, 140, 200}, listViewExList, &listViewExFocus, &listViewExScrollIndex, listViewExActive) toggleGroupActive = gui.ToggleGroup(rl.Rectangle{165, 400, 140, 25}, "#1#ONE\n#3#TWO\n#8#THREE\n#23#", toggleGroupActive) // Third GUI column - // TODO if gui.TextBoxMulti(rl.Rectangle{320, 25, 225, 140}, multiTextBoxText, 256, multiTextBoxEditMode) { - // TODO multiTextBoxEditMode = !multiTextBoxEditMode - // TODO } + if gui.TextBoxMulti(rl.Rectangle{320, 25, 225, 140}, &multiTextBoxText, 256, multiTextBoxEditMode) { + multiTextBoxEditMode = !multiTextBoxEditMode + } colorPickerValue = gui.ColorPicker(rl.Rectangle{320, 185, 196, 192}, "", colorPickerValue) sliderValue = gui.Slider(rl.Rectangle{355, 400, 165, 20}, "TEST", @@ -244,28 +244,34 @@ func main() { if showMessageBox { rl.DrawRectangle(0, 0, int32(rl.GetScreenWidth()), int32(rl.GetScreenHeight()), rl.Fade(rl.RayWhite, 0.8)) - // TODO var result int32 = gui.MessageBox(rl.Rectangle{float32(rl.GetScreenWidth())/2 - 125, float32(rl.GetScreenHeight())/2 - 50, 250, 100}, gui.IconText(gui.ICON_EXIT, "Close Window"), "Do you really want to exit?", "Yes;No") + var result int32 = gui.MessageBox(rl.Rectangle{float32(rl.GetScreenWidth())/2 - 125, float32(rl.GetScreenHeight())/2 - 50, 250, 100}, gui.IconText(gui.ICON_EXIT, "Close Window"), "Do you really want to exit?", "Yes;No") - // TODO if (result == 0) || (result == 2) { - // TODO showMessageBox = false - // TODO } else if result == 1 { - // TODO exitWindow = true - // TODO } + if (result == 0) || (result == 2) { + showMessageBox = false + } else if result == 1 { + exitWindow = true + } } if showTextInputBox { rl.DrawRectangle(0, 0, int32(rl.GetScreenWidth()), int32(rl.GetScreenHeight()), rl.Fade(rl.RayWhite, 0.8)) - //TODO var result int = gui.TextInputBox(rl.Rectangle{float32(rl.GetScreenWidth())/2 - 120, float32(rl.GetScreenHeight())/2 - 60, 240, 140}, "Save", gui.IconText(gui.ICON_FILE_SAVE, "Save file as..."), "Ok;Cancel", textInput, 255, "") - // TODO if result == 1 { - // TODO // TODO: Validate textInput value and save - // TODO // strcpy(textInputFileName, textInput) - // TODO textInputFileName = textInput - // TODO } - // TODO if (result == 0) || (result == 1) || (result == 2) { - // TODO showTextInputBox = false - // TODO //strcpy(textInput, "\0"); - // TODO textInput = "" - // TODO } + var result int32 = gui.TextInputBox( + rl.Rectangle{float32(rl.GetScreenWidth())/2 - 120, float32(rl.GetScreenHeight())/2 - 60, 240, 140}, + "Save", + gui.IconText(gui.ICON_FILE_SAVE, "Save file as..."), + "Ok;Cancel", + &textInput, 255, nil) + + if result == 1 { + // TODO: Validate textInput value and save + // strcpy(textInputFileName, textInput) + // TODO textInputFileName = textInput + } + if (result == 0) || (result == 1) || (result == 2) { + showTextInputBox = false + //strcpy(textInput, "\0"); + textInput = "" + } } //---------------------------------------------------------------------------------- diff --git a/raygui3_5/raygui.go b/raygui3_5/raygui.go index b7090d8..66b3994 100644 --- a/raygui3_5/raygui.go +++ b/raygui3_5/raygui.go @@ -766,8 +766,10 @@ func Spinner(bounds rl.Rectangle, text string, value *int32, minValue, maxValue ctext := C.CString(text) defer C.free(unsafe.Pointer(ctext)) - var cvalue C.int - cvalue = C.int(*value) + if value == nil { + value = new(int32) + } + cvalue := C.int(*value) defer func() { *value = int32(cvalue) }() @@ -890,8 +892,10 @@ func ListView(bounds rl.Rectangle, text string, scrollIndex *int32, active int32 ctext := C.CString(text) defer C.free(unsafe.Pointer(ctext)) - var cscrollIndex C.int - cscrollIndex = C.int(*scrollIndex) + if scrollIndex == nil { + scrollIndex = new(int32) + } + cscrollIndex := C.int(*scrollIndex) defer func() { *scrollIndex = int32(cscrollIndex) }() @@ -1004,8 +1008,10 @@ func DropdownBox(bounds rl.Rectangle, text string, active *int32, editMode bool) ctext := C.CString(text) defer C.free(unsafe.Pointer(ctext)) - var cactive C.int - cactive = C.int(*active) + if active == nil { + active = new(int32) + } + cactive := C.int(*active) defer func() { *active = int32(cactive) }() @@ -1026,8 +1032,10 @@ func ValueBox(bounds rl.Rectangle, text string, value *int32, minValue, maxValue ctext := C.CString(text) defer C.free(unsafe.Pointer(ctext)) - var cvalue C.int - cvalue = C.int(*value) + if value == nil { + value = new(int32) + } + cvalue := C.int(*value) defer func() { *value = int32(cvalue) }() @@ -1097,6 +1105,269 @@ func IconText(iconId int32, text string) string { // return C.GuiGetIcons() // } +// ICON_NONE - transpiled function from C4GO/tests/raylib/raygui.h:575 +//---------------------------------------------------------------------------------- +// Icons enumeration +//---------------------------------------------------------------------------------- +const ( + ICON_NONE int32 = 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_219 = 219 + ICON_220 = 220 + ICON_221 = 221 + ICON_222 = 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 +) + // Text Input Box control, ask for text func TextInputBox(bounds rl.Rectangle, title, message, buttons string, text *string, textMaxSize int32, secretViewActive *int32) int32 { var cbounds C.struct_Rectangle @@ -1115,24 +1386,29 @@ func TextInputBox(bounds rl.Rectangle, title, message, buttons string, text *str defer C.free(unsafe.Pointer(cbuttons)) bs := []byte(*text) + if len(bs) == 0 { + bs = []byte{byte(0)} + } if 0 < len(bs) && bs[len(bs)-1] != byte(0) { // minimalize allocation bs = append(bs, byte(0)) // for next input symbols } ctext := (*C.char)(unsafe.Pointer(&bs[0])) defer func() { - *text = strings.TrimSpace(string(bs)) + *text = string(bs) // no need : C.free(unsafe.Pointer(ctext)) }() ctextMaxSize := C.int(textMaxSize) - var csecretViewActive C.int - csecretViewActive = C.int(*secretViewActive) + if secretViewActive == nil { + secretViewActive = new(int32) + } + csecretViewActive := C.int(*secretViewActive) defer func() { *secretViewActive = int32(csecretViewActive) }() - return int32(C.TextInputBox(cbounds, ctitle, cmessage, cbuttons, &ctext, textMaxSize, &csecretViewActive)) + return int32(C.GuiTextInputBox(cbounds, ctitle, cmessage, cbuttons, ctext, ctextMaxSize, &csecretViewActive)) } // Text Box control with multiple lines @@ -1144,35 +1420,22 @@ func TextBoxMulti(bounds rl.Rectangle, text *string, textSize int32, editMode bo cbounds.height = C.float(bounds.Height) bs := []byte(*text) + if len(bs) == 0 { + bs = []byte{byte(0)} + } if 0 < len(bs) && bs[len(bs)-1] != byte(0) { // minimalize allocation bs = append(bs, byte(0)) // for next input symbols } ctext := (*C.char)(unsafe.Pointer(&bs[0])) defer func() { - *text = strings.TrimSpace(string(bs)) + *text = string(bs) // no need : C.free(unsafe.Pointer(ctext)) }() ctextSize := (C.int)(textSize) ceditMode := (C.bool)(editMode) - return bool(C.GuiTextBoxMulti(cbounds, &ctext, ctextSize, ceditMode)) -} - -// Check Box control, returns true when active -func CheckBox(bounds rl.Rectangle, text string, checked bool) bool { - var cbounds C.struct_Rectangle - cbounds.x = C.float(bounds.X) - cbounds.y = C.float(bounds.Y) - cbounds.width = C.float(bounds.Width) - cbounds.height = C.float(bounds.Height) - - ctext := C.CString(text) - defer C.free(unsafe.Pointer(ctext)) - - cchecked := C.bool(checked) - - return bool(C.GuiCheckBox(cbounds, ctext, cchecked)) + return bool(C.GuiTextBoxMulti(cbounds, ctext, ctextSize, ceditMode)) } // List View control with extended parameters @@ -1185,19 +1448,22 @@ func ListViewEx(bounds rl.Rectangle, text []string, focus, scrollIndex *int32, a cbounds.width = C.float(bounds.Width) cbounds.height = C.float(bounds.Height) - ctext := make([]C.CString, len(text)) - for i := range text { - ctext[i] = C.CString(text[i]) - defer C.free(unsafe.Pointer(ctext[i])) - } + ctext := NewCStringArrayFromSlice(text) + defer ctext.Free() count := C.int(len(text)) + if focus == nil { + focus = new(int32) + } cfocus := C.int(*focus) defer func() { *focus = int32(cfocus) }() + if scrollIndex == nil { + scrollIndex = new(int32) + } cscrollIndex := C.int(*scrollIndex) defer func() { *scrollIndex = int32(cscrollIndex) @@ -1205,12 +1471,12 @@ func ListViewEx(bounds rl.Rectangle, text []string, focus, scrollIndex *int32, a cactive := C.int(active) - return int32(C.GuiListViewEx(cbounds, &ctext[0], count, &cfocus, &cscrollIndex, cactive)) + return int32(C.GuiListViewEx(cbounds, (**C.char)(ctext.Pointer), count, &cfocus, &cscrollIndex, cactive)) } // Tab Bar control // NOTE: Using GuiToggle() for the TABS -func TabBar(bounds rl.Rectangle, text []string, active *int) int32 { +func TabBar(bounds rl.Rectangle, text []string, active *int32) int32 { // int GuiTabBar(Rectangle bounds, const char **text, int count, int *active) var cbounds C.struct_Rectangle @@ -1219,19 +1485,19 @@ func TabBar(bounds rl.Rectangle, text []string, active *int) int32 { cbounds.width = C.float(bounds.Width) cbounds.height = C.float(bounds.Height) - ctext := make([]C.CString, len(text)) - for i := range text { - ctext[i] = C.CString(text[i]) - defer C.free(unsafe.Pointer(ctext[i])) - } + ctext := NewCStringArrayFromSlice(text) + defer ctext.Free() count := C.int(len(text)) + if active == nil { + active = new(int32) + } cactive := C.int(*active) defer func() { *active = int32(cactive) }() - return int32(C.TabBar(cbounds, &ctext[0], count, &cactive)) + return int32(C.GuiTabBar(cbounds, (**C.char)(ctext.Pointer), count, &cactive)) } // Warning (*ast.FunctionDecl): {prefix: n:SetAudioStreamCallback,t1:void (AudioStream, AudioCallback),t2:}. C4GO/tests/raylib/raylib.h:1567 :cannot transpileFunctionDecl. cannot bindingFunctionDecl func `SetAudioStreamCallback`. field type is pointer: `rAudioBuffer *`