├── .gitmodules ├── cmd └── cmd.go ├── Makefile ├── .gitignore ├── imgui ├── types_opaque.go ├── cgo_helpers.c ├── cgo_helpers.h ├── types.go ├── const.go └── cgo_helpers.go └── imgui.yml /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "imgui/cimgui"] 2 | path = imgui/cimgui 3 | url = https://github.com/Extrawurst/cimgui.git 4 | -------------------------------------------------------------------------------- /cmd/cmd.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/Xzya/go-imgui/imgui" 5 | "fmt" 6 | ) 7 | 8 | func main() { 9 | fmt.Println(imgui.Vec2{}) 10 | } 11 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | c-for-go imgui.yml 3 | 4 | clean: 5 | rm -f imgui/cgo_helpers.go imgui/cgo_helpers.h imgui/cgo_helpers.c 6 | rm -f imgui/const.go imgui/doc.go imgui/types.go 7 | rm -f imgui/imgui.go 8 | 9 | test: 10 | cd foobar && go build -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Binaries for programs and plugins 2 | *.exe 3 | *.exe~ 4 | *.dll 5 | *.so 6 | *.dylib 7 | 8 | # Test binary, build with `go test -c` 9 | *.test 10 | 11 | # Output of the go coverage tool, specifically when used with LiteIDE 12 | *.out 13 | 14 | 15 | .idea -------------------------------------------------------------------------------- /imgui/types_opaque.go: -------------------------------------------------------------------------------- 1 | package imgui 2 | 3 | /* 4 | #include "cimgui/cimgui/cimgui.h" 5 | */ 6 | import "C" 7 | 8 | type TextBuffer C.struct_ImGuiTextBuffer 9 | type Glyph C.struct_Glyph 10 | type Context C.struct_ImGuiContext 11 | type DrawListSharedData C.struct_ImDrawListSharedData 12 | -------------------------------------------------------------------------------- /imgui/cgo_helpers.c: -------------------------------------------------------------------------------- 1 | // WARNING: This file has automatically been generated on Fri, 16 Feb 2018 00:12:48 EET. 2 | // By https://git.io/c-for-go. DO NOT EDIT. 3 | 4 | #include "_cgo_export.h" 5 | #include "cgo_helpers.h" 6 | 7 | int ImGuiTextEditCallback_4d1820f7(struct ImGuiTextEditCallbackData* data) { 8 | return textEditCallback4D1820F7(data); 9 | } 10 | 11 | void ImGuiSizeConstraintCallback_f2f47f64(struct ImGuiSizeConstraintCallbackData* data) { 12 | sizeConstraintCallbackF2F47F64(data); 13 | } 14 | 15 | void ImDrawCallback_adeaa4a0(struct ImDrawList* parent_list, struct ImDrawCmd* cmd) { 16 | drawCallbackADEAA4A0(parent_list, cmd); 17 | } 18 | 19 | -------------------------------------------------------------------------------- /imgui/cgo_helpers.h: -------------------------------------------------------------------------------- 1 | // WARNING: This file has automatically been generated on Fri, 16 Feb 2018 00:12:48 EET. 2 | // By https://git.io/c-for-go. DO NOT EDIT. 3 | 4 | #include "cimgui/cimgui/cimgui.h" 5 | #include 6 | #pragma once 7 | 8 | #define __CGOGEN 1 9 | 10 | // ImGuiTextEditCallback_4d1820f7 is a proxy for callback ImGuiTextEditCallback. 11 | int ImGuiTextEditCallback_4d1820f7(struct ImGuiTextEditCallbackData* data); 12 | 13 | // ImGuiSizeConstraintCallback_f2f47f64 is a proxy for callback ImGuiSizeConstraintCallback. 14 | void ImGuiSizeConstraintCallback_f2f47f64(struct ImGuiSizeConstraintCallbackData* data); 15 | 16 | // ImDrawCallback_adeaa4a0 is a proxy for callback ImDrawCallback. 17 | void ImDrawCallback_adeaa4a0(struct ImDrawList* parent_list, struct ImDrawCmd* cmd); 18 | 19 | -------------------------------------------------------------------------------- /imgui.yml: -------------------------------------------------------------------------------- 1 | --- 2 | GENERATOR: 3 | PackageName: imgui 4 | PackageDescription: 5 | PackageLicense: 6 | Includes: ["cimgui/cimgui/cimgui.h"] 7 | Options: 8 | SafeStrings: true 9 | 10 | PARSER: 11 | IncludePaths: ["/usr/local/include", "/usr/include", "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/", "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/8.0.0/include/"] 12 | SourcesPaths: ["imgui/cimgui/cimgui/cimgui.h"] 13 | Defines: 14 | CIMGUI_DEFINE_ENUMS_AND_STRUCTS: 1 15 | 16 | TRANSLATOR: 17 | ConstRules: 18 | defines: expand 19 | enum: expand 20 | 21 | PtrTips: 22 | struct: 23 | function: 24 | # callbacks 25 | - {target: "ImGuiTextEditCallback", tips: [ref]} 26 | - {target: "ImGuiSizeConstraintCallback", tips: [ref]} 27 | - {target: "ImDrawCallback", tips: [ref, ref]} 28 | # inline 29 | - {target: "items_getter", tips: [ref,0,ref]} 30 | - {target: "values_getter", tips: [ref,0]} 31 | # others 32 | - {target: "igShowDemoWindow", tips: [ref]} 33 | - {target: "igShowMetricsWindow", tips: [ref]} 34 | - {target: "igShowStyleEditor", tips: [ref]} 35 | - {target: "igBegin", tips: [ref,ref,0]} 36 | - {target: "igGetContentRegionMax", tips: [ref]} 37 | - {target: "igGetContentRegionAvail", tips: [ref]} 38 | - {target: "igGetWindowContentRegionMin", tips: [ref]} 39 | - {target: "igGetWindowContentRegionMax", tips: [ref]} 40 | - {target: "igGetWindowPos", tips: [ref]} 41 | - {target: "igGetWindowSize", tips: [ref]} 42 | - {target: "igSetStateStorage", tips: [ref]} 43 | - {target: "igPushFont", tips: [ref]} 44 | - {target: "igGetStyleColorVec4", tips: [ref,0]} 45 | - {target: "igGetFontTexUvWhitePixel", tips: [ref]} 46 | - {target: "igGetColorU32Vec", tips: [ref]} 47 | - {target: "igDummy", tips: [ref]} 48 | - {target: "igGetCursorPos", tips: [ref]} 49 | - {target: "igGetCursorStartPos", tips: [ref]} 50 | - {target: "igGetCursorScreenPos", tips: [ref]} 51 | - {target: "igCheckbox", tips: [ref, ref]} 52 | - {target: "igRadioButton", tips: [ref,ref,0]} 53 | - {target: "igPlotLines2", tips: [ref,ref,ref,0,0,ref,0,0,0]} 54 | - {target: "igPlotLines", tips: [ref,ref,0,0,ref,0,0,0,0]} 55 | - {target: "igPlotHistogram2", tips: [ref,ref,ref,0,0,ref,0,0,0]} 56 | - {target: "igPlotHistogram", tips: [ref,ref,0,0,ref0,0,0,0]} 57 | - {target: "igProgressBar", tips: [0,ref,ref]} 58 | - {target: "igCombo", tips: [ref,ref,arr,0,0]} 59 | - {target: "igCombo2", tips: [ref,ref,ref,0]} 60 | - {target: "igCombo3", tips: [ref,ref,ref,ref,0,0]} 61 | - {target: "igDragFloatRange2", tips: [ref,ref,ref,0,0,0,ref,ref,0]} 62 | - {target: "igDragFloat2", tips: [ref,0,0,0,0,ref,0]} 63 | - {target: "igDragFloat3", tips: [ref,0,0,0,0,ref,0]} 64 | - {target: "igDragFloat4", tips: [ref,0,0,0,0,ref,0]} 65 | - {target: "igDragFloat", tips: [ref,ref,0,0,0,ref,0]} 66 | - {target: "igDragIntRange2", tips: [ref,ref,ref,0,0,0,ref,ref]} 67 | - {target: "igDragInt2", tips: [ref,ref,0,0,0,ref]} 68 | - {target: "igDragInt3", tips: [ref,ref,0,0,0,ref]} 69 | - {target: "igDragInt4", tips: [ref,ref,0,0,0,ref]} 70 | - {target: "igDragInt", tips: [ref,ref,0,0,0,ref]} 71 | - {target: "igInputTextMultiline", tips: [ref,ref,0,0,0,ref,ref]} 72 | - {target: "igInputText", tips: [ref,ref,0,0,ref,ref]} 73 | - {target: "igInputFloat2", tips: [ref,ref,0,0]} 74 | - {target: "igInputFloat3", tips: [ref,ref,0,0]} 75 | - {target: "igInputFloat4", tips: [ref,ref,0,0]} 76 | - {target: "igInputFloat", tips: [ref,ref,0,0,0,0]} 77 | - {target: "igInputInt2", tips: [ref,ref,0]} 78 | - {target: "igInputInt3", tips: [ref,ref,0]} 79 | - {target: "igInputInt4", tips: [ref,ref,0]} 80 | - {target: "igInputInt", tips: [ref,ref,0,0,0]} 81 | - {target: "igSliderFloat2", tips: [ref,ref,0,0,ref,0]} 82 | - {target: "igSliderFloat3", tips: [ref,ref,0,0,ref,0]} 83 | - {target: "igSliderFloat4", tips: [ref,ref,0,0,ref,0]} 84 | - {target: "igSliderFloat", tips: [ref,ref,0,0,ref,0]} 85 | - {target: "igSliderAngle", tips: [ref,ref,0,0]} 86 | - {target: "igSliderInt2", tips: [ref,ref,0,0,ref]} 87 | - {target: "igSliderInt3", tips: [ref,ref,0,0,ref]} 88 | - {target: "igSliderInt4", tips: [ref,ref,0,0,ref]} 89 | - {target: "igSliderInt", tips: [ref,ref,0,0,ref]} 90 | - {target: "igVSliderFloat", tips: [ref,0,ref,0,0,ref,0]} 91 | - {target: "igVSliderInt", tips: [ref,0,ref,0,0,ref]} 92 | 93 | Rules: 94 | global: 95 | - {action: accept, from: '(?i)^ig'} 96 | - {action: accept, from: '(?i)^im'} 97 | - {action: replace, from: '^ImGui', to: ''} 98 | - {action: replace, from: '^Im', to: ''} 99 | - {action: replace, from: '^ig', to: ''} 100 | - {transform: export} 101 | function: 102 | - {action: ignore, from: 'igCreateContext'} # func pointer 103 | - {action: ignore, from: 'igPlotLines2'} # func pointer 104 | - {action: ignore, from: 'igPlotHistogram2'} # func pointer 105 | - {action: ignore, from: 'igCombo3'} # func pointer 106 | - {action: ignore, from: 'igListBox2'} # func pointer 107 | - {action: ignore, from: 'igText'} # variadic 108 | - {action: ignore, from: 'igTextColored'} # variadic 109 | - {action: ignore, from: 'igTextDisabled'} # variadic 110 | - {action: ignore, from: 'igTextWrapped'} # variadic 111 | - {action: ignore, from: 'igLabelText'} # variadic 112 | - {action: ignore, from: 'igBulletText'} # variadic 113 | - {action: ignore, from: 'igTreeNodeStr'} # variadic 114 | - {action: ignore, from: 'igTreeNodePtr'} # variadic 115 | - {action: ignore, from: 'igTreeNodeExStr'} # variadic 116 | - {action: ignore, from: 'igTreeNodeExPtr'} # variadic 117 | - {action: ignore, from: 'igSetTooltip'} # variadic 118 | - {action: ignore, from: 'igLogText'} # variadic 119 | - {action: ignore, from: 'ImGuiTextBuffer_appendf'} # variadic 120 | type: 121 | - {action: ignore, from: 'ImGuiHoveredFlags'} 122 | - {action: ignore, from: 'ImGuiComboFlags'} 123 | - {action: ignore, from: 'ImGuiDragDropFlags'} 124 | - {action: ignore, from: 'ImGuiFocusedFlags'} 125 | - {action: ignore, from: 'ImDrawCornerFlags'} 126 | - {action: ignore, from: 'ImDrawListFlags'} 127 | private: 128 | - {transform: unexport} 129 | post-global: 130 | - {action: replace, from: _$} 131 | - {load: snakecase} 132 | -------------------------------------------------------------------------------- /imgui/types.go: -------------------------------------------------------------------------------- 1 | // WARNING: This file has automatically been generated on Fri, 16 Feb 2018 00:12:48 EET. 2 | // By https://git.io/c-for-go. DO NOT EDIT. 3 | 4 | package imgui 5 | 6 | /* 7 | #include "cimgui/cimgui/cimgui.h" 8 | #include 9 | #include "cgo_helpers.h" 10 | */ 11 | import "C" 12 | import "unsafe" 13 | 14 | // DrawIdx type as declared in cimgui/cimgui.h:52 15 | type DrawIdx uint16 16 | 17 | // U32 type as declared in cimgui/cimgui.h:53 18 | type U32 uint32 19 | 20 | // Wchar type as declared in cimgui/cimgui.h:54 21 | type Wchar uint16 22 | 23 | // TextureID type as declared in cimgui/cimgui.h:55 24 | type TextureID unsafe.Pointer 25 | 26 | // ID type as declared in cimgui/cimgui.h:56 27 | type ID uint32 28 | 29 | // Col type as declared in cimgui/cimgui.h:57 30 | type Col int32 31 | 32 | // StyleVar type as declared in cimgui/cimgui.h:58 33 | type StyleVar int32 34 | 35 | // Key type as declared in cimgui/cimgui.h:59 36 | type Key int32 37 | 38 | // ColorEditFlags type as declared in cimgui/cimgui.h:60 39 | type ColorEditFlags int32 40 | 41 | // MouseCursor type as declared in cimgui/cimgui.h:61 42 | type MouseCursor int32 43 | 44 | // WindowFlags type as declared in cimgui/cimgui.h:62 45 | type WindowFlags int32 46 | 47 | // Cond type as declared in cimgui/cimgui.h:63 48 | type Cond int32 49 | 50 | // ColumnsFlags type as declared in cimgui/cimgui.h:64 51 | type ColumnsFlags int32 52 | 53 | // InputTextFlags type as declared in cimgui/cimgui.h:65 54 | type InputTextFlags int32 55 | 56 | // SelectableFlags type as declared in cimgui/cimgui.h:66 57 | type SelectableFlags int32 58 | 59 | // TreeNodeFlags type as declared in cimgui/cimgui.h:67 60 | type TreeNodeFlags int32 61 | 62 | // TextEditCallback type as declared in cimgui/cimgui.h:74 63 | type TextEditCallback func(data *TextEditCallbackData) int32 64 | 65 | // SizeConstraintCallback type as declared in cimgui/cimgui.h:75 66 | type SizeConstraintCallback func(data *SizeConstraintCallbackData) 67 | 68 | // DrawCallback type as declared in cimgui/cimgui.h:76 69 | type DrawCallback func(parentList *DrawList, cmd *DrawCmd) 70 | 71 | // U64 type as declared in cimgui/cimgui.h:80 72 | type U64 uint64 73 | 74 | // DrawCmd as declared in cimgui/cimgui.h:40 75 | type DrawCmd struct { 76 | ElemCount uint32 77 | ClipRect Vec4 78 | TextureId *TextureID 79 | UserCallback DrawCallback 80 | UserCallbackData unsafe.Pointer 81 | ref111e6f2b *C.struct_ImDrawCmd 82 | allocs111e6f2b interface{} 83 | } 84 | 85 | // DrawData as declared in cimgui/cimgui.h:30 86 | type DrawData struct { 87 | Valid bool 88 | CmdLists [][]DrawList 89 | CmdListsCount int32 90 | TotalVtxCount int32 91 | TotalIdxCount int32 92 | ref9a158ae0 *C.struct_ImDrawData 93 | allocs9a158ae0 interface{} 94 | } 95 | 96 | // DrawList as declared in cimgui/cimgui.h:35 97 | type DrawList C.struct_ImDrawList 98 | 99 | // DrawVert as declared in cimgui/cimgui.h:499 100 | type DrawVert struct { 101 | Pos Vec2 102 | Uv Vec2 103 | Col U32 104 | ref5c8bfe45 *C.struct_ImDrawVert 105 | allocs5c8bfe45 interface{} 106 | } 107 | 108 | // Font as declared in cimgui/cimgui.h:37 109 | type Font C.struct_ImFont 110 | 111 | // FontAtlas as declared in cimgui/cimgui.h:39 112 | type FontAtlas C.struct_ImFontAtlas 113 | 114 | // FontConfig as declared in cimgui/cimgui.h:38 115 | type FontConfig struct { 116 | FontData unsafe.Pointer 117 | FontDataSize int32 118 | FontDataOwnedByAtlas bool 119 | FontNo int32 120 | SizePixels float32 121 | OversampleH int32 122 | OversampleV int32 123 | PixelSnapH bool 124 | GlyphExtraSpacing Vec2 125 | GlyphOffset Vec2 126 | GlyphRanges []Wchar 127 | MergeMode bool 128 | RasterizerFlags uint32 129 | RasterizerMultiply float32 130 | Name [32]byte 131 | DstFont []Font 132 | ref5c4f67a0 *C.struct_ImFontConfig 133 | allocs5c4f67a0 interface{} 134 | } 135 | 136 | // IO as declared in cimgui/cimgui.h:28 137 | type IO struct { 138 | DisplaySize Vec2 139 | DeltaTime float32 140 | IniSavingRate float32 141 | IniFilename string 142 | LogFilename string 143 | MouseDoubleClickTime float32 144 | MouseDoubleClickMaxDist float32 145 | MouseDragThreshold float32 146 | KeyMap [19]int32 147 | KeyRepeatDelay float32 148 | KeyRepeatRate float32 149 | UserData unsafe.Pointer 150 | Fonts []FontAtlas 151 | FontGlobalScale float32 152 | FontAllowUserScaling bool 153 | FontDefault []Font 154 | DisplayFramebufferScale Vec2 155 | DisplayVisibleMin Vec2 156 | DisplayVisibleMax Vec2 157 | OptMacOSXBehaviors bool 158 | OptCursorBlink bool 159 | RenderDrawListsFn *func(data []DrawData) 160 | GetClipboardTextFn *func(userData unsafe.Pointer) string 161 | SetClipboardTextFn *func(userData unsafe.Pointer, text string) 162 | ClipboardUserData unsafe.Pointer 163 | MemAllocFn *func(sz uint) unsafe.Pointer 164 | MemFreeFn *func(ptr unsafe.Pointer) 165 | ESetInputScreenPosFn *func(x int32, y int32) 166 | EWindowHandle unsafe.Pointer 167 | MousePos Vec2 168 | MouseDown [5]bool 169 | MouseWheel float32 170 | MouseDrawCursor bool 171 | KeyCtrl bool 172 | KeyShift bool 173 | KeyAlt bool 174 | KeySuper bool 175 | KeysDown [512]bool 176 | InputCharacters [17]Wchar 177 | WantCaptureMouse bool 178 | WantCaptureKeyboard bool 179 | WantTextInput bool 180 | Framerate float32 181 | MetricsAllocs int32 182 | MetricsRenderVertices int32 183 | MetricsRenderIndices int32 184 | MetricsActiveWindows int32 185 | MouseDelta Vec2 186 | MousePosPrev Vec2 187 | MouseClicked [5]bool 188 | MouseClickedPos [5]Vec2 189 | MouseClickedTime [5]float32 190 | MouseDoubleClicked [5]bool 191 | MouseReleased [5]bool 192 | MouseDownOwned [5]bool 193 | MouseDownDuration [5]float32 194 | MouseDownDurationPrev [5]float32 195 | MouseDragMaxDistanceAbs [5]Vec2 196 | MouseDragMaxDistanceSqr [5]float32 197 | KeysDownDuration [512]float32 198 | KeysDownDurationPrev [512]float32 199 | ref4700f756 *C.struct_ImGuiIO 200 | allocs4700f756 interface{} 201 | } 202 | 203 | // ListClipper as declared in cimgui/cimgui.h:41 204 | type ListClipper struct { 205 | StartPosY float32 206 | ItemsHeight float32 207 | ItemsCount int32 208 | StepNo int32 209 | DisplayStart int32 210 | DisplayEnd int32 211 | refd52a46bd *C.struct_ImGuiListClipper 212 | allocsd52a46bd interface{} 213 | } 214 | 215 | // Payload as declared in cimgui/cimgui.h:43 216 | type Payload struct { 217 | Data unsafe.Pointer 218 | DataSize int32 219 | SourceId ID 220 | SourceParentId ID 221 | DataFrameCount int32 222 | DataType [9]byte 223 | Preview bool 224 | Delivery bool 225 | refea983e4e *C.struct_ImGuiPayload 226 | allocsea983e4e interface{} 227 | } 228 | 229 | // SizeConstraintCallbackData as declared in cimgui/cimgui.h:34 230 | type SizeConstraintCallbackData struct { 231 | UserData unsafe.Pointer 232 | Pos Vec2 233 | CurrentSize Vec2 234 | DesiredSize Vec2 235 | ref24c5ad70 *C.struct_ImGuiSizeConstraintCallbackData 236 | allocs24c5ad70 interface{} 237 | } 238 | 239 | // Storage as declared in cimgui/cimgui.h:36 240 | type Storage C.struct_ImGuiStorage 241 | 242 | // Style as declared in cimgui/cimgui.h:29 243 | type Style struct { 244 | Alpha float32 245 | WindowPadding Vec2 246 | WindowRounding float32 247 | WindowBorderSize float32 248 | WindowMinSize Vec2 249 | WindowTitleAlign Vec2 250 | ChildRounding float32 251 | ChildBorderSize float32 252 | PopupRounding float32 253 | PopupBorderSize float32 254 | FramePadding Vec2 255 | FrameRounding float32 256 | FrameBorderSize float32 257 | ItemSpacing Vec2 258 | ItemInnerSpacing Vec2 259 | TouchExtraPadding Vec2 260 | IndentSpacing float32 261 | ColumnsMinSpacing float32 262 | ScrollbarSize float32 263 | ScrollbarRounding float32 264 | GrabMinSize float32 265 | GrabRounding float32 266 | ButtonTextAlign Vec2 267 | DisplayWindowPadding Vec2 268 | DisplaySafeAreaPadding Vec2 269 | AntiAliasedLines bool 270 | AntiAliasedFill bool 271 | CurveTessellationTol float32 272 | Colors [43]Vec4 273 | ref6e47ee0d *C.struct_ImGuiStyle 274 | allocs6e47ee0d interface{} 275 | } 276 | 277 | // TextEditCallbackData as declared in cimgui/cimgui.h:33 278 | type TextEditCallbackData struct { 279 | EventFlag InputTextFlags 280 | Flags InputTextFlags 281 | UserData unsafe.Pointer 282 | ReadOnly bool 283 | EventChar Wchar 284 | EventKey Key 285 | Buf []byte 286 | BufTextLen int32 287 | BufSize int32 288 | BufDirty bool 289 | CursorPos int32 290 | SelectionStart int32 291 | SelectionEnd int32 292 | ref61acec8 *C.struct_ImGuiTextEditCallbackData 293 | allocs61acec8 interface{} 294 | } 295 | 296 | // TextFilter as declared in cimgui/cimgui.h:42 297 | type TextFilter C.struct_ImGuiTextFilter 298 | 299 | // Vec2 as declared in cimgui/cimgui.h:31 300 | type Vec2 struct { 301 | X float32 302 | Y float32 303 | ref74e98a33 *C.struct_ImVec2 304 | allocs74e98a33 interface{} 305 | } 306 | 307 | // Vec4 as declared in cimgui/cimgui.h:32 308 | type Vec4 struct { 309 | X float32 310 | Y float32 311 | Z float32 312 | W float32 313 | ref9d8a2f06 *C.struct_ImVec4 314 | allocs9d8a2f06 interface{} 315 | } 316 | -------------------------------------------------------------------------------- /imgui/const.go: -------------------------------------------------------------------------------- 1 | // WARNING: This file has automatically been generated on Fri, 16 Feb 2018 00:12:48 EET. 2 | // By https://git.io/c-for-go. DO NOT EDIT. 3 | 4 | package imgui 5 | 6 | /* 7 | #include "cimgui/cimgui/cimgui.h" 8 | #include 9 | #include "cgo_helpers.h" 10 | */ 11 | import "C" 12 | 13 | const ( 14 | // IMFONTGLYPH as defined in cimgui/cimgui.h:49 15 | IMFONTGLYPH = 0 16 | ) 17 | 18 | const ( 19 | // WindowFlagsNoTitleBar as declared in cimgui/cimgui.h:96 20 | WindowFlagsNoTitleBar = 1 << 0 21 | // WindowFlagsNoResize as declared in cimgui/cimgui.h:97 22 | WindowFlagsNoResize = 1 << 1 23 | // WindowFlagsNoMove as declared in cimgui/cimgui.h:98 24 | WindowFlagsNoMove = 1 << 2 25 | // WindowFlagsNoScrollbar as declared in cimgui/cimgui.h:99 26 | WindowFlagsNoScrollbar = 1 << 3 27 | // WindowFlagsNoScrollWithMouse as declared in cimgui/cimgui.h:100 28 | WindowFlagsNoScrollWithMouse = 1 << 4 29 | // WindowFlagsNoCollapse as declared in cimgui/cimgui.h:101 30 | WindowFlagsNoCollapse = 1 << 5 31 | // WindowFlagsAlwaysAutoResize as declared in cimgui/cimgui.h:102 32 | WindowFlagsAlwaysAutoResize = 1 << 6 33 | // WindowFlagsNoSavedSettings as declared in cimgui/cimgui.h:104 34 | WindowFlagsNoSavedSettings = 1 << 8 35 | // WindowFlagsNoInputs as declared in cimgui/cimgui.h:105 36 | WindowFlagsNoInputs = 1 << 9 37 | // WindowFlagsMenuBar as declared in cimgui/cimgui.h:106 38 | WindowFlagsMenuBar = 1 << 10 39 | // WindowFlagsHorizontalScrollbar as declared in cimgui/cimgui.h:107 40 | WindowFlagsHorizontalScrollbar = 1 << 11 41 | // WindowFlagsNoFocusOnAppearing as declared in cimgui/cimgui.h:108 42 | WindowFlagsNoFocusOnAppearing = 1 << 12 43 | // WindowFlagsNoBringToFrontOnFocus as declared in cimgui/cimgui.h:109 44 | WindowFlagsNoBringToFrontOnFocus = 1 << 13 45 | // WindowFlagsAlwaysVerticalScrollbar as declared in cimgui/cimgui.h:110 46 | WindowFlagsAlwaysVerticalScrollbar = 1 << 14 47 | // WindowFlagsAlwaysHorizontalScrollbar as declared in cimgui/cimgui.h:111 48 | WindowFlagsAlwaysHorizontalScrollbar = 1 << 15 49 | // WindowFlagsAlwaysUseWindowPadding as declared in cimgui/cimgui.h:112 50 | WindowFlagsAlwaysUseWindowPadding = 1 << 16 51 | // WindowFlagsResizeFromAnySide as declared in cimgui/cimgui.h:113 52 | WindowFlagsResizeFromAnySide = 1 << 17 53 | ) 54 | 55 | const ( 56 | // InputTextFlagsCharsDecimal as declared in cimgui/cimgui.h:118 57 | InputTextFlagsCharsDecimal = 1 << 0 58 | // InputTextFlagsCharsHexadecimal as declared in cimgui/cimgui.h:119 59 | InputTextFlagsCharsHexadecimal = 1 << 1 60 | // InputTextFlagsCharsUppercase as declared in cimgui/cimgui.h:120 61 | InputTextFlagsCharsUppercase = 1 << 2 62 | // InputTextFlagsCharsNoBlank as declared in cimgui/cimgui.h:121 63 | InputTextFlagsCharsNoBlank = 1 << 3 64 | // InputTextFlagsAutoSelectAll as declared in cimgui/cimgui.h:122 65 | InputTextFlagsAutoSelectAll = 1 << 4 66 | // InputTextFlagsEnterReturnsTrue as declared in cimgui/cimgui.h:123 67 | InputTextFlagsEnterReturnsTrue = 1 << 5 68 | // InputTextFlagsCallbackCompletion as declared in cimgui/cimgui.h:124 69 | InputTextFlagsCallbackCompletion = 1 << 6 70 | // InputTextFlagsCallbackHistory as declared in cimgui/cimgui.h:125 71 | InputTextFlagsCallbackHistory = 1 << 7 72 | // InputTextFlagsCallbackAlways as declared in cimgui/cimgui.h:126 73 | InputTextFlagsCallbackAlways = 1 << 8 74 | // InputTextFlagsCallbackCharFilter as declared in cimgui/cimgui.h:127 75 | InputTextFlagsCallbackCharFilter = 1 << 9 76 | // InputTextFlagsAllowTabInput as declared in cimgui/cimgui.h:128 77 | InputTextFlagsAllowTabInput = 1 << 10 78 | // InputTextFlagsCtrlEnterForNewLine as declared in cimgui/cimgui.h:129 79 | InputTextFlagsCtrlEnterForNewLine = 1 << 11 80 | // InputTextFlagsNoHorizontalScroll as declared in cimgui/cimgui.h:130 81 | InputTextFlagsNoHorizontalScroll = 1 << 12 82 | // InputTextFlagsAlwaysInsertMode as declared in cimgui/cimgui.h:131 83 | InputTextFlagsAlwaysInsertMode = 1 << 13 84 | // InputTextFlagsReadOnly as declared in cimgui/cimgui.h:132 85 | InputTextFlagsReadOnly = 1 << 14 86 | // InputTextFlagsPassword as declared in cimgui/cimgui.h:133 87 | InputTextFlagsPassword = 1 << 15 88 | // InputTextFlagsNoUndoRedo as declared in cimgui/cimgui.h:134 89 | InputTextFlagsNoUndoRedo = 1 << 16 90 | ) 91 | 92 | const ( 93 | // TreeNodeFlagsSelected as declared in cimgui/cimgui.h:139 94 | TreeNodeFlagsSelected = 1 << 0 95 | // TreeNodeFlagsFramed as declared in cimgui/cimgui.h:140 96 | TreeNodeFlagsFramed = 1 << 1 97 | // TreeNodeFlagsAllowItemOverlap as declared in cimgui/cimgui.h:141 98 | TreeNodeFlagsAllowItemOverlap = 1 << 2 99 | // TreeNodeFlagsNoTreePushOnOpen as declared in cimgui/cimgui.h:142 100 | TreeNodeFlagsNoTreePushOnOpen = 1 << 3 101 | // TreeNodeFlagsNoAutoOpenOnLog as declared in cimgui/cimgui.h:143 102 | TreeNodeFlagsNoAutoOpenOnLog = 1 << 4 103 | // TreeNodeFlagsDefaultOpen as declared in cimgui/cimgui.h:144 104 | TreeNodeFlagsDefaultOpen = 1 << 5 105 | // TreeNodeFlagsOpenOnDoubleClick as declared in cimgui/cimgui.h:145 106 | TreeNodeFlagsOpenOnDoubleClick = 1 << 6 107 | // TreeNodeFlagsOpenOnArrow as declared in cimgui/cimgui.h:146 108 | TreeNodeFlagsOpenOnArrow = 1 << 7 109 | // TreeNodeFlagsLeaf as declared in cimgui/cimgui.h:147 110 | TreeNodeFlagsLeaf = 1 << 8 111 | // TreeNodeFlagsBullet as declared in cimgui/cimgui.h:148 112 | TreeNodeFlagsBullet = 1 << 9 113 | // TreeNodeFlagsFramePadding as declared in cimgui/cimgui.h:149 114 | TreeNodeFlagsFramePadding = 1 << 10 115 | // TreeNodeFlagsCollapsingHeader as declared in cimgui/cimgui.h:150 116 | TreeNodeFlagsCollapsingHeader = TreeNodeFlagsFramed | TreeNodeFlagsNoAutoOpenOnLog 117 | ) 118 | 119 | const ( 120 | // SelectableFlagsDontClosePopups as declared in cimgui/cimgui.h:155 121 | SelectableFlagsDontClosePopups = 1 << 0 122 | // SelectableFlagsSpanAllColumns as declared in cimgui/cimgui.h:156 123 | SelectableFlagsSpanAllColumns = 1 << 1 124 | // SelectableFlagsAllowDoubleClick as declared in cimgui/cimgui.h:157 125 | SelectableFlagsAllowDoubleClick = 1 << 2 126 | ) 127 | 128 | // ComboFlags as declared in cimgui/cimgui.h:160 129 | type ComboFlags int32 130 | 131 | // ComboFlags enumeration from cimgui/cimgui.h:160 132 | const ( 133 | ComboFlagsPopupAlignLeft = 1 << 0 134 | ComboFlagsHeightSmall = 1 << 1 135 | ComboFlagsHeightRegular = 1 << 2 136 | ComboFlagsHeightLarge = 1 << 3 137 | ComboFlagsHeightLargest = 1 << 4 138 | ComboFlagsHeightMask = ComboFlagsHeightSmall | ComboFlagsHeightRegular | ComboFlagsHeightLarge | ComboFlagsHeightLargest 139 | ) 140 | 141 | // FocusedFlags as declared in cimgui/cimgui.h:170 142 | type FocusedFlags int32 143 | 144 | // FocusedFlags enumeration from cimgui/cimgui.h:170 145 | const ( 146 | FocusedFlagsChildWindows = 1 << 0 147 | FocusedFlagsRootWindow = 1 << 1 148 | FocusedFlagsRootAndChildWindows = FocusedFlagsRootWindow | FocusedFlagsChildWindows 149 | ) 150 | 151 | // HoveredFlags as declared in cimgui/cimgui.h:177 152 | type HoveredFlags int32 153 | 154 | // HoveredFlags enumeration from cimgui/cimgui.h:177 155 | const ( 156 | HoveredFlagsChildWindows = 1 << 0 157 | HoveredFlagsRootWindow = 1 << 1 158 | HoveredFlagsAllowWhenBlockedByPopup = 1 << 2 159 | HoveredFlagsAllowWhenBlockedByActiveItem = 1 << 4 160 | HoveredFlagsAllowWhenOverlapped = 1 << 5 161 | HoveredFlagsRectOnly = HoveredFlagsAllowWhenBlockedByPopup | HoveredFlagsAllowWhenBlockedByActiveItem | HoveredFlagsAllowWhenOverlapped 162 | HoveredFlagsRootAndChildWindows = HoveredFlagsRootWindow | HoveredFlagsChildWindows 163 | ) 164 | 165 | // DragDropFlags as declared in cimgui/cimgui.h:189 166 | type DragDropFlags int32 167 | 168 | // DragDropFlags enumeration from cimgui/cimgui.h:189 169 | const ( 170 | DragDropFlagsSourceNoPreviewTooltip = 1 << 0 171 | DragDropFlagsSourceNoDisableHover = 1 << 1 172 | DragDropFlagsSourceNoHoldToOpenOthers = 1 << 2 173 | DragDropFlagsSourceAllowNullID = 1 << 3 174 | DragDropFlagsSourceExtern = 1 << 4 175 | DragDropFlagsAcceptBeforeDelivery = 1 << 10 176 | DragDropFlagsAcceptNoDrawDefaultRect = 1 << 11 177 | DragDropFlagsAcceptPeekOnly = DragDropFlagsAcceptBeforeDelivery | DragDropFlagsAcceptNoDrawDefaultRect 178 | ) 179 | 180 | const ( 181 | // KeyTab as declared in cimgui/cimgui.h:203 182 | KeyTab = iota 183 | // KeyLeftArrow as declared in cimgui/cimgui.h:204 184 | KeyLeftArrow = 1 185 | // KeyRightArrow as declared in cimgui/cimgui.h:205 186 | KeyRightArrow = 2 187 | // KeyUpArrow as declared in cimgui/cimgui.h:206 188 | KeyUpArrow = 3 189 | // KeyDownArrow as declared in cimgui/cimgui.h:207 190 | KeyDownArrow = 4 191 | // KeyPageUp as declared in cimgui/cimgui.h:208 192 | KeyPageUp = 5 193 | // KeyPageDown as declared in cimgui/cimgui.h:209 194 | KeyPageDown = 6 195 | // KeyHome as declared in cimgui/cimgui.h:210 196 | KeyHome = 7 197 | // KeyEnd as declared in cimgui/cimgui.h:211 198 | KeyEnd = 8 199 | // KeyDelete as declared in cimgui/cimgui.h:212 200 | KeyDelete = 9 201 | // KeyBackspace as declared in cimgui/cimgui.h:213 202 | KeyBackspace = 10 203 | // KeyEnter as declared in cimgui/cimgui.h:214 204 | KeyEnter = 11 205 | // KeyEscape as declared in cimgui/cimgui.h:215 206 | KeyEscape = 12 207 | // KeyA as declared in cimgui/cimgui.h:216 208 | KeyA = 13 209 | // KeyC as declared in cimgui/cimgui.h:217 210 | KeyC = 14 211 | // KeyV as declared in cimgui/cimgui.h:218 212 | KeyV = 15 213 | // KeyX as declared in cimgui/cimgui.h:219 214 | KeyX = 16 215 | // KeyY as declared in cimgui/cimgui.h:220 216 | KeyY = 17 217 | // KeyZ as declared in cimgui/cimgui.h:221 218 | KeyZ = 18 219 | // KeyCOUNT as declared in cimgui/cimgui.h:222 220 | KeyCOUNT = 19 221 | ) 222 | 223 | const ( 224 | // ColText as declared in cimgui/cimgui.h:227 225 | ColText = iota 226 | // ColTextDisabled as declared in cimgui/cimgui.h:228 227 | ColTextDisabled = 1 228 | // ColWindowBg as declared in cimgui/cimgui.h:229 229 | ColWindowBg = 2 230 | // ColChildBg as declared in cimgui/cimgui.h:230 231 | ColChildBg = 3 232 | // ColPopupBg as declared in cimgui/cimgui.h:231 233 | ColPopupBg = 4 234 | // ColBorder as declared in cimgui/cimgui.h:232 235 | ColBorder = 5 236 | // ColBorderShadow as declared in cimgui/cimgui.h:233 237 | ColBorderShadow = 6 238 | // ColFrameBg as declared in cimgui/cimgui.h:234 239 | ColFrameBg = 7 240 | // ColFrameBgHovered as declared in cimgui/cimgui.h:235 241 | ColFrameBgHovered = 8 242 | // ColFrameBgActive as declared in cimgui/cimgui.h:236 243 | ColFrameBgActive = 9 244 | // ColTitleBg as declared in cimgui/cimgui.h:237 245 | ColTitleBg = 10 246 | // ColTitleBgActive as declared in cimgui/cimgui.h:238 247 | ColTitleBgActive = 11 248 | // ColTitleBgCollapsed as declared in cimgui/cimgui.h:239 249 | ColTitleBgCollapsed = 12 250 | // ColMenuBarBg as declared in cimgui/cimgui.h:240 251 | ColMenuBarBg = 13 252 | // ColScrollbarBg as declared in cimgui/cimgui.h:241 253 | ColScrollbarBg = 14 254 | // ColScrollbarGrab as declared in cimgui/cimgui.h:242 255 | ColScrollbarGrab = 15 256 | // ColScrollbarGrabHovered as declared in cimgui/cimgui.h:243 257 | ColScrollbarGrabHovered = 16 258 | // ColScrollbarGrabActive as declared in cimgui/cimgui.h:244 259 | ColScrollbarGrabActive = 17 260 | // ColCheckMark as declared in cimgui/cimgui.h:245 261 | ColCheckMark = 18 262 | // ColSliderGrab as declared in cimgui/cimgui.h:246 263 | ColSliderGrab = 19 264 | // ColSliderGrabActive as declared in cimgui/cimgui.h:247 265 | ColSliderGrabActive = 20 266 | // ColButton as declared in cimgui/cimgui.h:248 267 | ColButton = 21 268 | // ColButtonHovered as declared in cimgui/cimgui.h:249 269 | ColButtonHovered = 22 270 | // ColButtonActive as declared in cimgui/cimgui.h:250 271 | ColButtonActive = 23 272 | // ColHeader as declared in cimgui/cimgui.h:251 273 | ColHeader = 24 274 | // ColHeaderHovered as declared in cimgui/cimgui.h:252 275 | ColHeaderHovered = 25 276 | // ColHeaderActive as declared in cimgui/cimgui.h:253 277 | ColHeaderActive = 26 278 | // ColSeparator as declared in cimgui/cimgui.h:254 279 | ColSeparator = 27 280 | // ColSeparatorHovered as declared in cimgui/cimgui.h:255 281 | ColSeparatorHovered = 28 282 | // ColSeparatorActive as declared in cimgui/cimgui.h:256 283 | ColSeparatorActive = 29 284 | // ColResizeGrip as declared in cimgui/cimgui.h:257 285 | ColResizeGrip = 30 286 | // ColResizeGripHovered as declared in cimgui/cimgui.h:258 287 | ColResizeGripHovered = 31 288 | // ColResizeGripActive as declared in cimgui/cimgui.h:259 289 | ColResizeGripActive = 32 290 | // ColCloseButton as declared in cimgui/cimgui.h:260 291 | ColCloseButton = 33 292 | // ColCloseButtonHovered as declared in cimgui/cimgui.h:261 293 | ColCloseButtonHovered = 34 294 | // ColCloseButtonActive as declared in cimgui/cimgui.h:262 295 | ColCloseButtonActive = 35 296 | // ColPlotLines as declared in cimgui/cimgui.h:263 297 | ColPlotLines = 36 298 | // ColPlotLinesHovered as declared in cimgui/cimgui.h:264 299 | ColPlotLinesHovered = 37 300 | // ColPlotHistogram as declared in cimgui/cimgui.h:265 301 | ColPlotHistogram = 38 302 | // ColPlotHistogramHovered as declared in cimgui/cimgui.h:266 303 | ColPlotHistogramHovered = 39 304 | // ColTextSelectedBg as declared in cimgui/cimgui.h:267 305 | ColTextSelectedBg = 40 306 | // ColModalWindowDarkening as declared in cimgui/cimgui.h:268 307 | ColModalWindowDarkening = 41 308 | // ColDragDropTarget as declared in cimgui/cimgui.h:269 309 | ColDragDropTarget = 42 310 | // ColCOUNT as declared in cimgui/cimgui.h:270 311 | ColCOUNT = 43 312 | ) 313 | 314 | const ( 315 | // StyleVarAlpha as declared in cimgui/cimgui.h:275 316 | StyleVarAlpha = iota 317 | // StyleVarWindowPadding as declared in cimgui/cimgui.h:276 318 | StyleVarWindowPadding = 1 319 | // StyleVarWindowRounding as declared in cimgui/cimgui.h:277 320 | StyleVarWindowRounding = 2 321 | // StyleVarWindowBorderSize as declared in cimgui/cimgui.h:278 322 | StyleVarWindowBorderSize = 3 323 | // StyleVarWindowMinSize as declared in cimgui/cimgui.h:279 324 | StyleVarWindowMinSize = 4 325 | // StyleVarChildRounding as declared in cimgui/cimgui.h:280 326 | StyleVarChildRounding = 5 327 | // StyleVarChildBorderSize as declared in cimgui/cimgui.h:281 328 | StyleVarChildBorderSize = 6 329 | // StyleVarPopupRounding as declared in cimgui/cimgui.h:282 330 | StyleVarPopupRounding = 7 331 | // StyleVarPopupBorderSize as declared in cimgui/cimgui.h:283 332 | StyleVarPopupBorderSize = 8 333 | // StyleVarFramePadding as declared in cimgui/cimgui.h:284 334 | StyleVarFramePadding = 9 335 | // StyleVarFrameRounding as declared in cimgui/cimgui.h:285 336 | StyleVarFrameRounding = 10 337 | // StyleVarFrameBorderSize as declared in cimgui/cimgui.h:286 338 | StyleVarFrameBorderSize = 11 339 | // StyleVarItemSpacing as declared in cimgui/cimgui.h:287 340 | StyleVarItemSpacing = 12 341 | // StyleVarItemInnerSpacing as declared in cimgui/cimgui.h:288 342 | StyleVarItemInnerSpacing = 13 343 | // StyleVarIndentSpacing as declared in cimgui/cimgui.h:289 344 | StyleVarIndentSpacing = 14 345 | // StyleVarGrabMinSize as declared in cimgui/cimgui.h:290 346 | StyleVarGrabMinSize = 15 347 | // StyleVarButtonTextAlign as declared in cimgui/cimgui.h:291 348 | StyleVarButtonTextAlign = 16 349 | // StyleVarCount as declared in cimgui/cimgui.h:292 350 | StyleVarCount = 17 351 | ) 352 | 353 | const ( 354 | // ColorEditFlagsNoAlpha as declared in cimgui/cimgui.h:297 355 | ColorEditFlagsNoAlpha = 1 << 1 356 | // ColorEditFlagsNoPicker as declared in cimgui/cimgui.h:298 357 | ColorEditFlagsNoPicker = 1 << 2 358 | // ColorEditFlagsNoOptions as declared in cimgui/cimgui.h:299 359 | ColorEditFlagsNoOptions = 1 << 3 360 | // ColorEditFlagsNoSmallPreview as declared in cimgui/cimgui.h:300 361 | ColorEditFlagsNoSmallPreview = 1 << 4 362 | // ColorEditFlagsNoInputs as declared in cimgui/cimgui.h:301 363 | ColorEditFlagsNoInputs = 1 << 5 364 | // ColorEditFlagsNoTooltip as declared in cimgui/cimgui.h:302 365 | ColorEditFlagsNoTooltip = 1 << 6 366 | // ColorEditFlagsNoLabel as declared in cimgui/cimgui.h:303 367 | ColorEditFlagsNoLabel = 1 << 7 368 | // ColorEditFlagsNoSidePreview as declared in cimgui/cimgui.h:304 369 | ColorEditFlagsNoSidePreview = 1 << 8 370 | // ColorEditFlagsAlphaBar as declared in cimgui/cimgui.h:305 371 | ColorEditFlagsAlphaBar = 1 << 9 372 | // ColorEditFlagsAlphaPreview as declared in cimgui/cimgui.h:306 373 | ColorEditFlagsAlphaPreview = 1 << 10 374 | // ColorEditFlagsAlphaPreviewHalf as declared in cimgui/cimgui.h:307 375 | ColorEditFlagsAlphaPreviewHalf = 1 << 11 376 | // ColorEditFlagsHDR as declared in cimgui/cimgui.h:308 377 | ColorEditFlagsHDR = 1 << 12 378 | // ColorEditFlagsRGB as declared in cimgui/cimgui.h:309 379 | ColorEditFlagsRGB = 1 << 13 380 | // ColorEditFlagsHSV as declared in cimgui/cimgui.h:310 381 | ColorEditFlagsHSV = 1 << 14 382 | // ColorEditFlagsHEX as declared in cimgui/cimgui.h:311 383 | ColorEditFlagsHEX = 1 << 15 384 | // ColorEditFlagsUint8 as declared in cimgui/cimgui.h:312 385 | ColorEditFlagsUint8 = 1 << 16 386 | // ColorEditFlagsFloat as declared in cimgui/cimgui.h:313 387 | ColorEditFlagsFloat = 1 << 17 388 | // ColorEditFlagsPickerHueBar as declared in cimgui/cimgui.h:314 389 | ColorEditFlagsPickerHueBar = 1 << 18 390 | // ColorEditFlagsPickerHueWheel as declared in cimgui/cimgui.h:315 391 | ColorEditFlagsPickerHueWheel = 1 << 19 392 | ) 393 | 394 | const ( 395 | // MouseCursorNone as declared in cimgui/cimgui.h:320 396 | MouseCursorNone = -1 397 | // MouseCursorArrow as declared in cimgui/cimgui.h:321 398 | MouseCursorArrow = 0 399 | // MouseCursorTextInput as declared in cimgui/cimgui.h:322 400 | MouseCursorTextInput = 1 401 | // MouseCursorMove as declared in cimgui/cimgui.h:323 402 | MouseCursorMove = 2 403 | // MouseCursorResizeNS as declared in cimgui/cimgui.h:324 404 | MouseCursorResizeNS = 3 405 | // MouseCursorResizeEW as declared in cimgui/cimgui.h:325 406 | MouseCursorResizeEW = 4 407 | // MouseCursorResizeNESW as declared in cimgui/cimgui.h:326 408 | MouseCursorResizeNESW = 5 409 | // MouseCursorResizeNWSE as declared in cimgui/cimgui.h:327 410 | MouseCursorResizeNWSE = 6 411 | // MouseCursorCount as declared in cimgui/cimgui.h:328 412 | MouseCursorCount = 7 413 | ) 414 | 415 | const ( 416 | // CondAlways as declared in cimgui/cimgui.h:333 417 | CondAlways = 1 << 0 418 | // CondOnce as declared in cimgui/cimgui.h:334 419 | CondOnce = 1 << 1 420 | // CondFirstUseEver as declared in cimgui/cimgui.h:335 421 | CondFirstUseEver = 1 << 2 422 | // CondAppearing as declared in cimgui/cimgui.h:336 423 | CondAppearing = 1 << 3 424 | ) 425 | 426 | // DrawCornerFlags as declared in cimgui/cimgui.h:339 427 | type DrawCornerFlags int32 428 | 429 | // DrawCornerFlags enumeration from cimgui/cimgui.h:339 430 | const ( 431 | DrawCornerFlagsTopLeft = 1 << 0 432 | DrawCornerFlagsTopRight = 1 << 1 433 | DrawCornerFlagsBotLeft = 1 << 2 434 | DrawCornerFlagsBotRight = 1 << 3 435 | DrawCornerFlagsTop = DrawCornerFlagsTopLeft | DrawCornerFlagsTopRight 436 | DrawCornerFlagsBot = DrawCornerFlagsBotLeft | DrawCornerFlagsBotRight 437 | DrawCornerFlagsLeft = DrawCornerFlagsTopLeft | DrawCornerFlagsBotLeft 438 | DrawCornerFlagsRight = DrawCornerFlagsTopRight | DrawCornerFlagsBotRight 439 | DrawCornerFlagsAll = 0xF 440 | ) 441 | 442 | // DrawListFlags as declared in cimgui/cimgui.h:352 443 | type DrawListFlags int32 444 | 445 | // DrawListFlags enumeration from cimgui/cimgui.h:352 446 | const ( 447 | DrawListFlagsAntiAliasedLines = 1 << 0 448 | DrawListFlagsAntiAliasedFill = 1 << 1 449 | ) 450 | -------------------------------------------------------------------------------- /imgui/cgo_helpers.go: -------------------------------------------------------------------------------- 1 | // WARNING: This file has automatically been generated on Fri, 16 Feb 2018 00:12:48 EET. 2 | // By https://git.io/c-for-go. DO NOT EDIT. 3 | 4 | package imgui 5 | 6 | /* 7 | #include "cimgui/cimgui/cimgui.h" 8 | #include 9 | #include "cgo_helpers.h" 10 | */ 11 | import "C" 12 | import ( 13 | "runtime" 14 | "sync" 15 | "unsafe" 16 | ) 17 | 18 | // cgoAllocMap stores pointers to C allocated memory for future reference. 19 | type cgoAllocMap struct { 20 | mux sync.RWMutex 21 | m map[unsafe.Pointer]struct{} 22 | } 23 | 24 | var cgoAllocsUnknown = new(cgoAllocMap) 25 | 26 | func (a *cgoAllocMap) Add(ptr unsafe.Pointer) { 27 | a.mux.Lock() 28 | if a.m == nil { 29 | a.m = make(map[unsafe.Pointer]struct{}) 30 | } 31 | a.m[ptr] = struct{}{} 32 | a.mux.Unlock() 33 | } 34 | 35 | func (a *cgoAllocMap) IsEmpty() bool { 36 | a.mux.RLock() 37 | isEmpty := len(a.m) == 0 38 | a.mux.RUnlock() 39 | return isEmpty 40 | } 41 | 42 | func (a *cgoAllocMap) Borrow(b *cgoAllocMap) { 43 | if b == nil || b.IsEmpty() { 44 | return 45 | } 46 | b.mux.Lock() 47 | a.mux.Lock() 48 | for ptr := range b.m { 49 | if a.m == nil { 50 | a.m = make(map[unsafe.Pointer]struct{}) 51 | } 52 | a.m[ptr] = struct{}{} 53 | delete(b.m, ptr) 54 | } 55 | a.mux.Unlock() 56 | b.mux.Unlock() 57 | } 58 | 59 | func (a *cgoAllocMap) Free() { 60 | a.mux.Lock() 61 | for ptr := range a.m { 62 | C.free(ptr) 63 | delete(a.m, ptr) 64 | } 65 | a.mux.Unlock() 66 | } 67 | 68 | func (x TextEditCallback) PassRef() (ref *C.ImGuiTextEditCallback, allocs *cgoAllocMap) { 69 | if x == nil { 70 | return nil, nil 71 | } 72 | if textEditCallback4D1820F7Func == nil { 73 | textEditCallback4D1820F7Func = x 74 | } 75 | return (*C.ImGuiTextEditCallback)(C.ImGuiTextEditCallback_4d1820f7), nil 76 | } 77 | 78 | func (x TextEditCallback) PassValue() (ref C.ImGuiTextEditCallback, allocs *cgoAllocMap) { 79 | if x == nil { 80 | return nil, nil 81 | } 82 | if textEditCallback4D1820F7Func == nil { 83 | textEditCallback4D1820F7Func = x 84 | } 85 | return (C.ImGuiTextEditCallback)(C.ImGuiTextEditCallback_4d1820f7), nil 86 | } 87 | 88 | func NewTextEditCallbackRef(ref unsafe.Pointer) *TextEditCallback { 89 | return (*TextEditCallback)(ref) 90 | } 91 | 92 | //export textEditCallback4D1820F7 93 | func textEditCallback4D1820F7(cdata *C.struct_ImGuiTextEditCallbackData) C.int { 94 | if textEditCallback4D1820F7Func != nil { 95 | data4d1820f7 := NewTextEditCallbackDataRef(unsafe.Pointer(cdata)) 96 | ret4d1820f7 := textEditCallback4D1820F7Func(data4d1820f7) 97 | ret, _ := (C.int)(ret4d1820f7), cgoAllocsUnknown 98 | return ret 99 | } 100 | panic("callback func has not been set (race?)") 101 | } 102 | 103 | var textEditCallback4D1820F7Func TextEditCallback 104 | 105 | func (x SizeConstraintCallback) PassRef() (ref *C.ImGuiSizeConstraintCallback, allocs *cgoAllocMap) { 106 | if x == nil { 107 | return nil, nil 108 | } 109 | if sizeConstraintCallbackF2F47F64Func == nil { 110 | sizeConstraintCallbackF2F47F64Func = x 111 | } 112 | return (*C.ImGuiSizeConstraintCallback)(C.ImGuiSizeConstraintCallback_f2f47f64), nil 113 | } 114 | 115 | func (x SizeConstraintCallback) PassValue() (ref C.ImGuiSizeConstraintCallback, allocs *cgoAllocMap) { 116 | if x == nil { 117 | return nil, nil 118 | } 119 | if sizeConstraintCallbackF2F47F64Func == nil { 120 | sizeConstraintCallbackF2F47F64Func = x 121 | } 122 | return (C.ImGuiSizeConstraintCallback)(C.ImGuiSizeConstraintCallback_f2f47f64), nil 123 | } 124 | 125 | func NewSizeConstraintCallbackRef(ref unsafe.Pointer) *SizeConstraintCallback { 126 | return (*SizeConstraintCallback)(ref) 127 | } 128 | 129 | //export sizeConstraintCallbackF2F47F64 130 | func sizeConstraintCallbackF2F47F64(cdata *C.struct_ImGuiSizeConstraintCallbackData) { 131 | if sizeConstraintCallbackF2F47F64Func != nil { 132 | dataf2f47f64 := NewSizeConstraintCallbackDataRef(unsafe.Pointer(cdata)) 133 | sizeConstraintCallbackF2F47F64Func(dataf2f47f64) 134 | return 135 | } 136 | panic("callback func has not been set (race?)") 137 | } 138 | 139 | var sizeConstraintCallbackF2F47F64Func SizeConstraintCallback 140 | 141 | func (x DrawCallback) PassRef() (ref *C.ImDrawCallback, allocs *cgoAllocMap) { 142 | if x == nil { 143 | return nil, nil 144 | } 145 | if drawCallbackADEAA4A0Func == nil { 146 | drawCallbackADEAA4A0Func = x 147 | } 148 | return (*C.ImDrawCallback)(C.ImDrawCallback_adeaa4a0), nil 149 | } 150 | 151 | func (x DrawCallback) PassValue() (ref C.ImDrawCallback, allocs *cgoAllocMap) { 152 | if x == nil { 153 | return nil, nil 154 | } 155 | if drawCallbackADEAA4A0Func == nil { 156 | drawCallbackADEAA4A0Func = x 157 | } 158 | return (C.ImDrawCallback)(C.ImDrawCallback_adeaa4a0), nil 159 | } 160 | 161 | func NewDrawCallbackRef(ref unsafe.Pointer) *DrawCallback { 162 | return (*DrawCallback)(ref) 163 | } 164 | 165 | //export drawCallbackADEAA4A0 166 | func drawCallbackADEAA4A0(cparentList *C.struct_ImDrawList, ccmd *C.struct_ImDrawCmd) { 167 | if drawCallbackADEAA4A0Func != nil { 168 | parentListadeaa4a0 := (*DrawList)(unsafe.Pointer(cparentList)) 169 | cmdadeaa4a0 := NewDrawCmdRef(unsafe.Pointer(ccmd)) 170 | drawCallbackADEAA4A0Func(parentListadeaa4a0, cmdadeaa4a0) 171 | return 172 | } 173 | panic("callback func has not been set (race?)") 174 | } 175 | 176 | var drawCallbackADEAA4A0Func DrawCallback 177 | 178 | // allocStructImDrawCmdMemory allocates memory for type C.struct_ImDrawCmd in C. 179 | // The caller is responsible for freeing the this memory via C.free. 180 | func allocStructImDrawCmdMemory(n int) unsafe.Pointer { 181 | mem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfStructImDrawCmdValue)) 182 | if err != nil { 183 | panic("memory alloc error: " + err.Error()) 184 | } 185 | return mem 186 | } 187 | 188 | const sizeOfStructImDrawCmdValue = unsafe.Sizeof([1]C.struct_ImDrawCmd{}) 189 | 190 | // Ref returns the underlying reference to C object or nil if struct is nil. 191 | func (x *DrawCmd) Ref() *C.struct_ImDrawCmd { 192 | if x == nil { 193 | return nil 194 | } 195 | return x.ref111e6f2b 196 | } 197 | 198 | // Free invokes alloc map's free mechanism that cleanups any allocated memory using C free. 199 | // Does nothing if struct is nil or has no allocation map. 200 | func (x *DrawCmd) Free() { 201 | if x != nil && x.allocs111e6f2b != nil { 202 | x.allocs111e6f2b.(*cgoAllocMap).Free() 203 | x.ref111e6f2b = nil 204 | } 205 | } 206 | 207 | // NewDrawCmdRef creates a new wrapper struct with underlying reference set to the original C object. 208 | // Returns nil if the provided pointer to C object is nil too. 209 | func NewDrawCmdRef(ref unsafe.Pointer) *DrawCmd { 210 | if ref == nil { 211 | return nil 212 | } 213 | obj := new(DrawCmd) 214 | obj.ref111e6f2b = (*C.struct_ImDrawCmd)(unsafe.Pointer(ref)) 215 | return obj 216 | } 217 | 218 | // PassRef returns the underlying C object, otherwise it will allocate one and set its values 219 | // from this wrapping struct, counting allocations into an allocation map. 220 | func (x *DrawCmd) PassRef() (*C.struct_ImDrawCmd, *cgoAllocMap) { 221 | if x == nil { 222 | return nil, nil 223 | } else if x.ref111e6f2b != nil { 224 | return x.ref111e6f2b, nil 225 | } 226 | mem111e6f2b := allocStructImDrawCmdMemory(1) 227 | ref111e6f2b := (*C.struct_ImDrawCmd)(mem111e6f2b) 228 | allocs111e6f2b := new(cgoAllocMap) 229 | allocs111e6f2b.Add(mem111e6f2b) 230 | 231 | var cElemCount_allocs *cgoAllocMap 232 | ref111e6f2b.ElemCount, cElemCount_allocs = (C.uint)(x.ElemCount), cgoAllocsUnknown 233 | allocs111e6f2b.Borrow(cElemCount_allocs) 234 | 235 | var cClipRect_allocs *cgoAllocMap 236 | ref111e6f2b.ClipRect, cClipRect_allocs = x.ClipRect.PassValue() 237 | allocs111e6f2b.Borrow(cClipRect_allocs) 238 | 239 | var cTextureId_allocs *cgoAllocMap 240 | ref111e6f2b.TextureId, cTextureId_allocs = *(**C.ImTextureID)(unsafe.Pointer(&x.TextureId)), cgoAllocsUnknown 241 | allocs111e6f2b.Borrow(cTextureId_allocs) 242 | 243 | var cUserCallback_allocs *cgoAllocMap 244 | ref111e6f2b.UserCallback, cUserCallback_allocs = x.UserCallback.PassValue() 245 | allocs111e6f2b.Borrow(cUserCallback_allocs) 246 | 247 | var cUserCallbackData_allocs *cgoAllocMap 248 | ref111e6f2b.UserCallbackData, cUserCallbackData_allocs = *(*unsafe.Pointer)(unsafe.Pointer(&x.UserCallbackData)), cgoAllocsUnknown 249 | allocs111e6f2b.Borrow(cUserCallbackData_allocs) 250 | 251 | x.ref111e6f2b = ref111e6f2b 252 | x.allocs111e6f2b = allocs111e6f2b 253 | return ref111e6f2b, allocs111e6f2b 254 | 255 | } 256 | 257 | // PassValue does the same as PassRef except that it will try to dereference the returned pointer. 258 | func (x DrawCmd) PassValue() (C.struct_ImDrawCmd, *cgoAllocMap) { 259 | if x.ref111e6f2b != nil { 260 | return *x.ref111e6f2b, nil 261 | } 262 | ref, allocs := x.PassRef() 263 | return *ref, allocs 264 | } 265 | 266 | // Deref uses the underlying reference to C object and fills the wrapping struct with values. 267 | // Do not forget to call this method whether you get a struct for C object and want to read its values. 268 | func (x *DrawCmd) Deref() { 269 | if x.ref111e6f2b == nil { 270 | return 271 | } 272 | x.ElemCount = (uint32)(x.ref111e6f2b.ElemCount) 273 | x.ClipRect = *NewVec4Ref(unsafe.Pointer(&x.ref111e6f2b.ClipRect)) 274 | x.TextureId = (*TextureID)(unsafe.Pointer(x.ref111e6f2b.TextureId)) 275 | x.UserCallback = *NewDrawCallbackRef(unsafe.Pointer(&x.ref111e6f2b.UserCallback)) 276 | x.UserCallbackData = (unsafe.Pointer)(unsafe.Pointer(x.ref111e6f2b.UserCallbackData)) 277 | } 278 | 279 | // allocStructImDrawDataMemory allocates memory for type C.struct_ImDrawData in C. 280 | // The caller is responsible for freeing the this memory via C.free. 281 | func allocStructImDrawDataMemory(n int) unsafe.Pointer { 282 | mem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfStructImDrawDataValue)) 283 | if err != nil { 284 | panic("memory alloc error: " + err.Error()) 285 | } 286 | return mem 287 | } 288 | 289 | const sizeOfStructImDrawDataValue = unsafe.Sizeof([1]C.struct_ImDrawData{}) 290 | 291 | type sliceHeader struct { 292 | Data uintptr 293 | Len int 294 | Cap int 295 | } 296 | 297 | // allocPStructImDrawListMemory allocates memory for type *C.struct_ImDrawList in C. 298 | // The caller is responsible for freeing the this memory via C.free. 299 | func allocPStructImDrawListMemory(n int) unsafe.Pointer { 300 | mem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfPStructImDrawListValue)) 301 | if err != nil { 302 | panic("memory alloc error: " + err.Error()) 303 | } 304 | return mem 305 | } 306 | 307 | const sizeOfPStructImDrawListValue = unsafe.Sizeof([1]*C.struct_ImDrawList{}) 308 | 309 | const sizeOfPtr = unsafe.Sizeof(&struct{}{}) 310 | 311 | // unpackSSDrawList transforms a sliced Go data structure into plain C format. 312 | func unpackSSDrawList(x [][]DrawList) (unpacked **C.struct_ImDrawList, allocs *cgoAllocMap) { 313 | if x == nil { 314 | return nil, nil 315 | } 316 | allocs = new(cgoAllocMap) 317 | defer runtime.SetFinalizer(&unpacked, func(***C.struct_ImDrawList) { 318 | go allocs.Free() 319 | }) 320 | 321 | len0 := len(x) 322 | mem0 := allocPStructImDrawListMemory(len0) 323 | allocs.Add(mem0) 324 | h0 := &sliceHeader{ 325 | Data: uintptr(mem0), 326 | Cap: len0, 327 | Len: len0, 328 | } 329 | v0 := *(*[]*C.struct_ImDrawList)(unsafe.Pointer(h0)) 330 | for i0 := range x { 331 | h := (*sliceHeader)(unsafe.Pointer(&x[i0])) 332 | v0[i0] = (*C.struct_ImDrawList)(unsafe.Pointer(h.Data)) 333 | } 334 | h := (*sliceHeader)(unsafe.Pointer(&v0)) 335 | unpacked = (**C.struct_ImDrawList)(unsafe.Pointer(h.Data)) 336 | return 337 | } 338 | 339 | // packSSDrawList reads sliced Go data structure out from plain C format. 340 | func packSSDrawList(v [][]DrawList, ptr0 **C.struct_ImDrawList) { 341 | const m = 0x7fffffff 342 | for i0 := range v { 343 | ptr1 := (*(*[m / sizeOfPtr]*C.struct_ImDrawList)(unsafe.Pointer(ptr0)))[i0] 344 | hxfc4425b := (*sliceHeader)(unsafe.Pointer(&v[i0])) 345 | hxfc4425b.Data = uintptr(unsafe.Pointer(ptr1)) 346 | hxfc4425b.Cap = 0x7fffffff 347 | // hxfc4425b.Len = ? 348 | } 349 | } 350 | 351 | // Ref returns the underlying reference to C object or nil if struct is nil. 352 | func (x *DrawData) Ref() *C.struct_ImDrawData { 353 | if x == nil { 354 | return nil 355 | } 356 | return x.ref9a158ae0 357 | } 358 | 359 | // Free invokes alloc map's free mechanism that cleanups any allocated memory using C free. 360 | // Does nothing if struct is nil or has no allocation map. 361 | func (x *DrawData) Free() { 362 | if x != nil && x.allocs9a158ae0 != nil { 363 | x.allocs9a158ae0.(*cgoAllocMap).Free() 364 | x.ref9a158ae0 = nil 365 | } 366 | } 367 | 368 | // NewDrawDataRef creates a new wrapper struct with underlying reference set to the original C object. 369 | // Returns nil if the provided pointer to C object is nil too. 370 | func NewDrawDataRef(ref unsafe.Pointer) *DrawData { 371 | if ref == nil { 372 | return nil 373 | } 374 | obj := new(DrawData) 375 | obj.ref9a158ae0 = (*C.struct_ImDrawData)(unsafe.Pointer(ref)) 376 | return obj 377 | } 378 | 379 | // PassRef returns the underlying C object, otherwise it will allocate one and set its values 380 | // from this wrapping struct, counting allocations into an allocation map. 381 | func (x *DrawData) PassRef() (*C.struct_ImDrawData, *cgoAllocMap) { 382 | if x == nil { 383 | return nil, nil 384 | } else if x.ref9a158ae0 != nil { 385 | return x.ref9a158ae0, nil 386 | } 387 | mem9a158ae0 := allocStructImDrawDataMemory(1) 388 | ref9a158ae0 := (*C.struct_ImDrawData)(mem9a158ae0) 389 | allocs9a158ae0 := new(cgoAllocMap) 390 | allocs9a158ae0.Add(mem9a158ae0) 391 | 392 | var cValid_allocs *cgoAllocMap 393 | ref9a158ae0.Valid, cValid_allocs = (C._Bool)(x.Valid), cgoAllocsUnknown 394 | allocs9a158ae0.Borrow(cValid_allocs) 395 | 396 | var cCmdLists_allocs *cgoAllocMap 397 | ref9a158ae0.CmdLists, cCmdLists_allocs = unpackSSDrawList(x.CmdLists) 398 | allocs9a158ae0.Borrow(cCmdLists_allocs) 399 | 400 | var cCmdListsCount_allocs *cgoAllocMap 401 | ref9a158ae0.CmdListsCount, cCmdListsCount_allocs = (C.int)(x.CmdListsCount), cgoAllocsUnknown 402 | allocs9a158ae0.Borrow(cCmdListsCount_allocs) 403 | 404 | var cTotalVtxCount_allocs *cgoAllocMap 405 | ref9a158ae0.TotalVtxCount, cTotalVtxCount_allocs = (C.int)(x.TotalVtxCount), cgoAllocsUnknown 406 | allocs9a158ae0.Borrow(cTotalVtxCount_allocs) 407 | 408 | var cTotalIdxCount_allocs *cgoAllocMap 409 | ref9a158ae0.TotalIdxCount, cTotalIdxCount_allocs = (C.int)(x.TotalIdxCount), cgoAllocsUnknown 410 | allocs9a158ae0.Borrow(cTotalIdxCount_allocs) 411 | 412 | x.ref9a158ae0 = ref9a158ae0 413 | x.allocs9a158ae0 = allocs9a158ae0 414 | return ref9a158ae0, allocs9a158ae0 415 | 416 | } 417 | 418 | // PassValue does the same as PassRef except that it will try to dereference the returned pointer. 419 | func (x DrawData) PassValue() (C.struct_ImDrawData, *cgoAllocMap) { 420 | if x.ref9a158ae0 != nil { 421 | return *x.ref9a158ae0, nil 422 | } 423 | ref, allocs := x.PassRef() 424 | return *ref, allocs 425 | } 426 | 427 | // Deref uses the underlying reference to C object and fills the wrapping struct with values. 428 | // Do not forget to call this method whether you get a struct for C object and want to read its values. 429 | func (x *DrawData) Deref() { 430 | if x.ref9a158ae0 == nil { 431 | return 432 | } 433 | x.Valid = (bool)(x.ref9a158ae0.Valid) 434 | packSSDrawList(x.CmdLists, x.ref9a158ae0.CmdLists) 435 | x.CmdListsCount = (int32)(x.ref9a158ae0.CmdListsCount) 436 | x.TotalVtxCount = (int32)(x.ref9a158ae0.TotalVtxCount) 437 | x.TotalIdxCount = (int32)(x.ref9a158ae0.TotalIdxCount) 438 | } 439 | 440 | // Ref returns a reference to C object as it is. 441 | func (x *DrawList) Ref() *C.struct_ImDrawList { 442 | if x == nil { 443 | return nil 444 | } 445 | return (*C.struct_ImDrawList)(unsafe.Pointer(x)) 446 | } 447 | 448 | // Free cleanups the referenced memory using C free. 449 | func (x *DrawList) Free() { 450 | if x != nil { 451 | C.free(unsafe.Pointer(x)) 452 | } 453 | } 454 | 455 | // NewDrawListRef converts the C object reference into a raw struct reference without wrapping. 456 | func NewDrawListRef(ref unsafe.Pointer) *DrawList { 457 | return (*DrawList)(ref) 458 | } 459 | 460 | // NewDrawList allocates a new C object of this type and converts the reference into 461 | // a raw struct reference without wrapping. 462 | func NewDrawList() *DrawList { 463 | return (*DrawList)(allocStructImDrawListMemory(1)) 464 | } 465 | 466 | // allocStructImDrawListMemory allocates memory for type C.struct_ImDrawList in C. 467 | // The caller is responsible for freeing the this memory via C.free. 468 | func allocStructImDrawListMemory(n int) unsafe.Pointer { 469 | mem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfStructImDrawListValue)) 470 | if err != nil { 471 | panic("memory alloc error: " + err.Error()) 472 | } 473 | return mem 474 | } 475 | 476 | const sizeOfStructImDrawListValue = unsafe.Sizeof([1]C.struct_ImDrawList{}) 477 | 478 | // PassRef returns a reference to C object as it is or allocates a new C object of this type. 479 | func (x *DrawList) PassRef() *C.struct_ImDrawList { 480 | if x == nil { 481 | x = (*DrawList)(allocStructImDrawListMemory(1)) 482 | } 483 | return (*C.struct_ImDrawList)(unsafe.Pointer(x)) 484 | } 485 | 486 | // allocStructImDrawVertMemory allocates memory for type C.struct_ImDrawVert in C. 487 | // The caller is responsible for freeing the this memory via C.free. 488 | func allocStructImDrawVertMemory(n int) unsafe.Pointer { 489 | mem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfStructImDrawVertValue)) 490 | if err != nil { 491 | panic("memory alloc error: " + err.Error()) 492 | } 493 | return mem 494 | } 495 | 496 | const sizeOfStructImDrawVertValue = unsafe.Sizeof([1]C.struct_ImDrawVert{}) 497 | 498 | // Ref returns the underlying reference to C object or nil if struct is nil. 499 | func (x *DrawVert) Ref() *C.struct_ImDrawVert { 500 | if x == nil { 501 | return nil 502 | } 503 | return x.ref5c8bfe45 504 | } 505 | 506 | // Free invokes alloc map's free mechanism that cleanups any allocated memory using C free. 507 | // Does nothing if struct is nil or has no allocation map. 508 | func (x *DrawVert) Free() { 509 | if x != nil && x.allocs5c8bfe45 != nil { 510 | x.allocs5c8bfe45.(*cgoAllocMap).Free() 511 | x.ref5c8bfe45 = nil 512 | } 513 | } 514 | 515 | // NewDrawVertRef creates a new wrapper struct with underlying reference set to the original C object. 516 | // Returns nil if the provided pointer to C object is nil too. 517 | func NewDrawVertRef(ref unsafe.Pointer) *DrawVert { 518 | if ref == nil { 519 | return nil 520 | } 521 | obj := new(DrawVert) 522 | obj.ref5c8bfe45 = (*C.struct_ImDrawVert)(unsafe.Pointer(ref)) 523 | return obj 524 | } 525 | 526 | // PassRef returns the underlying C object, otherwise it will allocate one and set its values 527 | // from this wrapping struct, counting allocations into an allocation map. 528 | func (x *DrawVert) PassRef() (*C.struct_ImDrawVert, *cgoAllocMap) { 529 | if x == nil { 530 | return nil, nil 531 | } else if x.ref5c8bfe45 != nil { 532 | return x.ref5c8bfe45, nil 533 | } 534 | mem5c8bfe45 := allocStructImDrawVertMemory(1) 535 | ref5c8bfe45 := (*C.struct_ImDrawVert)(mem5c8bfe45) 536 | allocs5c8bfe45 := new(cgoAllocMap) 537 | allocs5c8bfe45.Add(mem5c8bfe45) 538 | 539 | var cpos_allocs *cgoAllocMap 540 | ref5c8bfe45.pos, cpos_allocs = x.Pos.PassValue() 541 | allocs5c8bfe45.Borrow(cpos_allocs) 542 | 543 | var cuv_allocs *cgoAllocMap 544 | ref5c8bfe45.uv, cuv_allocs = x.Uv.PassValue() 545 | allocs5c8bfe45.Borrow(cuv_allocs) 546 | 547 | var ccol_allocs *cgoAllocMap 548 | ref5c8bfe45.col, ccol_allocs = (C.ImU32)(x.Col), cgoAllocsUnknown 549 | allocs5c8bfe45.Borrow(ccol_allocs) 550 | 551 | x.ref5c8bfe45 = ref5c8bfe45 552 | x.allocs5c8bfe45 = allocs5c8bfe45 553 | return ref5c8bfe45, allocs5c8bfe45 554 | 555 | } 556 | 557 | // PassValue does the same as PassRef except that it will try to dereference the returned pointer. 558 | func (x DrawVert) PassValue() (C.struct_ImDrawVert, *cgoAllocMap) { 559 | if x.ref5c8bfe45 != nil { 560 | return *x.ref5c8bfe45, nil 561 | } 562 | ref, allocs := x.PassRef() 563 | return *ref, allocs 564 | } 565 | 566 | // Deref uses the underlying reference to C object and fills the wrapping struct with values. 567 | // Do not forget to call this method whether you get a struct for C object and want to read its values. 568 | func (x *DrawVert) Deref() { 569 | if x.ref5c8bfe45 == nil { 570 | return 571 | } 572 | x.Pos = *NewVec2Ref(unsafe.Pointer(&x.ref5c8bfe45.pos)) 573 | x.Uv = *NewVec2Ref(unsafe.Pointer(&x.ref5c8bfe45.uv)) 574 | x.Col = (U32)(x.ref5c8bfe45.col) 575 | } 576 | 577 | // Ref returns a reference to C object as it is. 578 | func (x *Font) Ref() *C.struct_ImFont { 579 | if x == nil { 580 | return nil 581 | } 582 | return (*C.struct_ImFont)(unsafe.Pointer(x)) 583 | } 584 | 585 | // Free cleanups the referenced memory using C free. 586 | func (x *Font) Free() { 587 | if x != nil { 588 | C.free(unsafe.Pointer(x)) 589 | } 590 | } 591 | 592 | // NewFontRef converts the C object reference into a raw struct reference without wrapping. 593 | func NewFontRef(ref unsafe.Pointer) *Font { 594 | return (*Font)(ref) 595 | } 596 | 597 | // NewFont allocates a new C object of this type and converts the reference into 598 | // a raw struct reference without wrapping. 599 | func NewFont() *Font { 600 | return (*Font)(allocStructImFontMemory(1)) 601 | } 602 | 603 | // allocStructImFontMemory allocates memory for type C.struct_ImFont in C. 604 | // The caller is responsible for freeing the this memory via C.free. 605 | func allocStructImFontMemory(n int) unsafe.Pointer { 606 | mem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfStructImFontValue)) 607 | if err != nil { 608 | panic("memory alloc error: " + err.Error()) 609 | } 610 | return mem 611 | } 612 | 613 | const sizeOfStructImFontValue = unsafe.Sizeof([1]C.struct_ImFont{}) 614 | 615 | // PassRef returns a reference to C object as it is or allocates a new C object of this type. 616 | func (x *Font) PassRef() *C.struct_ImFont { 617 | if x == nil { 618 | x = (*Font)(allocStructImFontMemory(1)) 619 | } 620 | return (*C.struct_ImFont)(unsafe.Pointer(x)) 621 | } 622 | 623 | // Ref returns a reference to C object as it is. 624 | func (x *FontAtlas) Ref() *C.struct_ImFontAtlas { 625 | if x == nil { 626 | return nil 627 | } 628 | return (*C.struct_ImFontAtlas)(unsafe.Pointer(x)) 629 | } 630 | 631 | // Free cleanups the referenced memory using C free. 632 | func (x *FontAtlas) Free() { 633 | if x != nil { 634 | C.free(unsafe.Pointer(x)) 635 | } 636 | } 637 | 638 | // NewFontAtlasRef converts the C object reference into a raw struct reference without wrapping. 639 | func NewFontAtlasRef(ref unsafe.Pointer) *FontAtlas { 640 | return (*FontAtlas)(ref) 641 | } 642 | 643 | // NewFontAtlas allocates a new C object of this type and converts the reference into 644 | // a raw struct reference without wrapping. 645 | func NewFontAtlas() *FontAtlas { 646 | return (*FontAtlas)(allocStructImFontAtlasMemory(1)) 647 | } 648 | 649 | // allocStructImFontAtlasMemory allocates memory for type C.struct_ImFontAtlas in C. 650 | // The caller is responsible for freeing the this memory via C.free. 651 | func allocStructImFontAtlasMemory(n int) unsafe.Pointer { 652 | mem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfStructImFontAtlasValue)) 653 | if err != nil { 654 | panic("memory alloc error: " + err.Error()) 655 | } 656 | return mem 657 | } 658 | 659 | const sizeOfStructImFontAtlasValue = unsafe.Sizeof([1]C.struct_ImFontAtlas{}) 660 | 661 | // PassRef returns a reference to C object as it is or allocates a new C object of this type. 662 | func (x *FontAtlas) PassRef() *C.struct_ImFontAtlas { 663 | if x == nil { 664 | x = (*FontAtlas)(allocStructImFontAtlasMemory(1)) 665 | } 666 | return (*C.struct_ImFontAtlas)(unsafe.Pointer(x)) 667 | } 668 | 669 | // allocStructImFontConfigMemory allocates memory for type C.struct_ImFontConfig in C. 670 | // The caller is responsible for freeing the this memory via C.free. 671 | func allocStructImFontConfigMemory(n int) unsafe.Pointer { 672 | mem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfStructImFontConfigValue)) 673 | if err != nil { 674 | panic("memory alloc error: " + err.Error()) 675 | } 676 | return mem 677 | } 678 | 679 | const sizeOfStructImFontConfigValue = unsafe.Sizeof([1]C.struct_ImFontConfig{}) 680 | 681 | // Ref returns the underlying reference to C object or nil if struct is nil. 682 | func (x *FontConfig) Ref() *C.struct_ImFontConfig { 683 | if x == nil { 684 | return nil 685 | } 686 | return x.ref5c4f67a0 687 | } 688 | 689 | // Free invokes alloc map's free mechanism that cleanups any allocated memory using C free. 690 | // Does nothing if struct is nil or has no allocation map. 691 | func (x *FontConfig) Free() { 692 | if x != nil && x.allocs5c4f67a0 != nil { 693 | x.allocs5c4f67a0.(*cgoAllocMap).Free() 694 | x.ref5c4f67a0 = nil 695 | } 696 | } 697 | 698 | // NewFontConfigRef creates a new wrapper struct with underlying reference set to the original C object. 699 | // Returns nil if the provided pointer to C object is nil too. 700 | func NewFontConfigRef(ref unsafe.Pointer) *FontConfig { 701 | if ref == nil { 702 | return nil 703 | } 704 | obj := new(FontConfig) 705 | obj.ref5c4f67a0 = (*C.struct_ImFontConfig)(unsafe.Pointer(ref)) 706 | return obj 707 | } 708 | 709 | // PassRef returns the underlying C object, otherwise it will allocate one and set its values 710 | // from this wrapping struct, counting allocations into an allocation map. 711 | func (x *FontConfig) PassRef() (*C.struct_ImFontConfig, *cgoAllocMap) { 712 | if x == nil { 713 | return nil, nil 714 | } else if x.ref5c4f67a0 != nil { 715 | return x.ref5c4f67a0, nil 716 | } 717 | mem5c4f67a0 := allocStructImFontConfigMemory(1) 718 | ref5c4f67a0 := (*C.struct_ImFontConfig)(mem5c4f67a0) 719 | allocs5c4f67a0 := new(cgoAllocMap) 720 | allocs5c4f67a0.Add(mem5c4f67a0) 721 | 722 | var cFontData_allocs *cgoAllocMap 723 | ref5c4f67a0.FontData, cFontData_allocs = *(*unsafe.Pointer)(unsafe.Pointer(&x.FontData)), cgoAllocsUnknown 724 | allocs5c4f67a0.Borrow(cFontData_allocs) 725 | 726 | var cFontDataSize_allocs *cgoAllocMap 727 | ref5c4f67a0.FontDataSize, cFontDataSize_allocs = (C.int)(x.FontDataSize), cgoAllocsUnknown 728 | allocs5c4f67a0.Borrow(cFontDataSize_allocs) 729 | 730 | var cFontDataOwnedByAtlas_allocs *cgoAllocMap 731 | ref5c4f67a0.FontDataOwnedByAtlas, cFontDataOwnedByAtlas_allocs = (C._Bool)(x.FontDataOwnedByAtlas), cgoAllocsUnknown 732 | allocs5c4f67a0.Borrow(cFontDataOwnedByAtlas_allocs) 733 | 734 | var cFontNo_allocs *cgoAllocMap 735 | ref5c4f67a0.FontNo, cFontNo_allocs = (C.int)(x.FontNo), cgoAllocsUnknown 736 | allocs5c4f67a0.Borrow(cFontNo_allocs) 737 | 738 | var cSizePixels_allocs *cgoAllocMap 739 | ref5c4f67a0.SizePixels, cSizePixels_allocs = (C.float)(x.SizePixels), cgoAllocsUnknown 740 | allocs5c4f67a0.Borrow(cSizePixels_allocs) 741 | 742 | var cOversampleH_allocs *cgoAllocMap 743 | ref5c4f67a0.OversampleH, cOversampleH_allocs = (C.int)(x.OversampleH), cgoAllocsUnknown 744 | allocs5c4f67a0.Borrow(cOversampleH_allocs) 745 | 746 | var cOversampleV_allocs *cgoAllocMap 747 | ref5c4f67a0.OversampleV, cOversampleV_allocs = (C.int)(x.OversampleV), cgoAllocsUnknown 748 | allocs5c4f67a0.Borrow(cOversampleV_allocs) 749 | 750 | var cPixelSnapH_allocs *cgoAllocMap 751 | ref5c4f67a0.PixelSnapH, cPixelSnapH_allocs = (C._Bool)(x.PixelSnapH), cgoAllocsUnknown 752 | allocs5c4f67a0.Borrow(cPixelSnapH_allocs) 753 | 754 | var cGlyphExtraSpacing_allocs *cgoAllocMap 755 | ref5c4f67a0.GlyphExtraSpacing, cGlyphExtraSpacing_allocs = x.GlyphExtraSpacing.PassValue() 756 | allocs5c4f67a0.Borrow(cGlyphExtraSpacing_allocs) 757 | 758 | var cGlyphOffset_allocs *cgoAllocMap 759 | ref5c4f67a0.GlyphOffset, cGlyphOffset_allocs = x.GlyphOffset.PassValue() 760 | allocs5c4f67a0.Borrow(cGlyphOffset_allocs) 761 | 762 | var cGlyphRanges_allocs *cgoAllocMap 763 | ref5c4f67a0.GlyphRanges, cGlyphRanges_allocs = (*C.ImWchar)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&x.GlyphRanges)).Data)), cgoAllocsUnknown 764 | allocs5c4f67a0.Borrow(cGlyphRanges_allocs) 765 | 766 | var cMergeMode_allocs *cgoAllocMap 767 | ref5c4f67a0.MergeMode, cMergeMode_allocs = (C._Bool)(x.MergeMode), cgoAllocsUnknown 768 | allocs5c4f67a0.Borrow(cMergeMode_allocs) 769 | 770 | var cRasterizerFlags_allocs *cgoAllocMap 771 | ref5c4f67a0.RasterizerFlags, cRasterizerFlags_allocs = (C.uint)(x.RasterizerFlags), cgoAllocsUnknown 772 | allocs5c4f67a0.Borrow(cRasterizerFlags_allocs) 773 | 774 | var cRasterizerMultiply_allocs *cgoAllocMap 775 | ref5c4f67a0.RasterizerMultiply, cRasterizerMultiply_allocs = (C.float)(x.RasterizerMultiply), cgoAllocsUnknown 776 | allocs5c4f67a0.Borrow(cRasterizerMultiply_allocs) 777 | 778 | var cName_allocs *cgoAllocMap 779 | ref5c4f67a0.Name, cName_allocs = *(*[32]C.char)(unsafe.Pointer(&x.Name)), cgoAllocsUnknown 780 | allocs5c4f67a0.Borrow(cName_allocs) 781 | 782 | var cDstFont_allocs *cgoAllocMap 783 | ref5c4f67a0.DstFont, cDstFont_allocs = (*C.struct_ImFont)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&x.DstFont)).Data)), cgoAllocsUnknown 784 | allocs5c4f67a0.Borrow(cDstFont_allocs) 785 | 786 | x.ref5c4f67a0 = ref5c4f67a0 787 | x.allocs5c4f67a0 = allocs5c4f67a0 788 | return ref5c4f67a0, allocs5c4f67a0 789 | 790 | } 791 | 792 | // PassValue does the same as PassRef except that it will try to dereference the returned pointer. 793 | func (x FontConfig) PassValue() (C.struct_ImFontConfig, *cgoAllocMap) { 794 | if x.ref5c4f67a0 != nil { 795 | return *x.ref5c4f67a0, nil 796 | } 797 | ref, allocs := x.PassRef() 798 | return *ref, allocs 799 | } 800 | 801 | // Deref uses the underlying reference to C object and fills the wrapping struct with values. 802 | // Do not forget to call this method whether you get a struct for C object and want to read its values. 803 | func (x *FontConfig) Deref() { 804 | if x.ref5c4f67a0 == nil { 805 | return 806 | } 807 | x.FontData = (unsafe.Pointer)(unsafe.Pointer(x.ref5c4f67a0.FontData)) 808 | x.FontDataSize = (int32)(x.ref5c4f67a0.FontDataSize) 809 | x.FontDataOwnedByAtlas = (bool)(x.ref5c4f67a0.FontDataOwnedByAtlas) 810 | x.FontNo = (int32)(x.ref5c4f67a0.FontNo) 811 | x.SizePixels = (float32)(x.ref5c4f67a0.SizePixels) 812 | x.OversampleH = (int32)(x.ref5c4f67a0.OversampleH) 813 | x.OversampleV = (int32)(x.ref5c4f67a0.OversampleV) 814 | x.PixelSnapH = (bool)(x.ref5c4f67a0.PixelSnapH) 815 | x.GlyphExtraSpacing = *NewVec2Ref(unsafe.Pointer(&x.ref5c4f67a0.GlyphExtraSpacing)) 816 | x.GlyphOffset = *NewVec2Ref(unsafe.Pointer(&x.ref5c4f67a0.GlyphOffset)) 817 | hxf95e7c8 := (*sliceHeader)(unsafe.Pointer(&x.GlyphRanges)) 818 | hxf95e7c8.Data = uintptr(unsafe.Pointer(x.ref5c4f67a0.GlyphRanges)) 819 | hxf95e7c8.Cap = 0x7fffffff 820 | // hxf95e7c8.Len = ? 821 | 822 | x.MergeMode = (bool)(x.ref5c4f67a0.MergeMode) 823 | x.RasterizerFlags = (uint32)(x.ref5c4f67a0.RasterizerFlags) 824 | x.RasterizerMultiply = (float32)(x.ref5c4f67a0.RasterizerMultiply) 825 | x.Name = *(*[32]byte)(unsafe.Pointer(&x.ref5c4f67a0.Name)) 826 | hxff2234b := (*sliceHeader)(unsafe.Pointer(&x.DstFont)) 827 | hxff2234b.Data = uintptr(unsafe.Pointer(x.ref5c4f67a0.DstFont)) 828 | hxff2234b.Cap = 0x7fffffff 829 | // hxff2234b.Len = ? 830 | 831 | } 832 | 833 | // allocStructImGuiIOMemory allocates memory for type C.struct_ImGuiIO in C. 834 | // The caller is responsible for freeing the this memory via C.free. 835 | func allocStructImGuiIOMemory(n int) unsafe.Pointer { 836 | mem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfStructImGuiIOValue)) 837 | if err != nil { 838 | panic("memory alloc error: " + err.Error()) 839 | } 840 | return mem 841 | } 842 | 843 | const sizeOfStructImGuiIOValue = unsafe.Sizeof([1]C.struct_ImGuiIO{}) 844 | 845 | // unpackPCharString represents the data from Go string as *C.char and avoids copying. 846 | func unpackPCharString(str string) (*C.char, *cgoAllocMap) { 847 | str = safeString(str) 848 | h := (*stringHeader)(unsafe.Pointer(&str)) 849 | return (*C.char)(unsafe.Pointer(h.Data)), cgoAllocsUnknown 850 | } 851 | 852 | type stringHeader struct { 853 | Data uintptr 854 | Len int 855 | } 856 | 857 | // safeString ensures that the string is NULL-terminated, a NULL-terminated copy is created otherwise. 858 | func safeString(str string) string { 859 | if len(str) > 0 && str[len(str)-1] != '\x00' { 860 | str = str + "\x00" 861 | } else if len(str) == 0 { 862 | str = "\x00" 863 | } 864 | return str 865 | } 866 | 867 | // allocA5StructImVec2Memory allocates memory for type [5]C.struct_ImVec2 in C. 868 | // The caller is responsible for freeing the this memory via C.free. 869 | func allocA5StructImVec2Memory(n int) unsafe.Pointer { 870 | mem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfA5StructImVec2Value)) 871 | if err != nil { 872 | panic("memory alloc error: " + err.Error()) 873 | } 874 | return mem 875 | } 876 | 877 | const sizeOfA5StructImVec2Value = unsafe.Sizeof([1][5]C.struct_ImVec2{}) 878 | 879 | // unpackA5Vec2 transforms a sliced Go data structure into plain C format. 880 | func unpackA5Vec2(x [5]Vec2) (unpacked [5]C.struct_ImVec2, allocs *cgoAllocMap) { 881 | allocs = new(cgoAllocMap) 882 | defer runtime.SetFinalizer(&unpacked, func(*[5]C.struct_ImVec2) { 883 | go allocs.Free() 884 | }) 885 | 886 | mem0 := allocA5StructImVec2Memory(1) 887 | allocs.Add(mem0) 888 | v0 := (*[5]C.struct_ImVec2)(mem0) 889 | for i0 := range x { 890 | allocs0 := new(cgoAllocMap) 891 | v0[i0], allocs0 = x[i0].PassValue() 892 | allocs.Borrow(allocs0) 893 | } 894 | unpacked = *(*[5]C.struct_ImVec2)(mem0) 895 | return 896 | } 897 | 898 | // packPCharString creates a Go string backed by *C.char and avoids copying. 899 | func packPCharString(p *C.char) (raw string) { 900 | if p != nil && *p != 0 { 901 | h := (*stringHeader)(unsafe.Pointer(&raw)) 902 | h.Data = uintptr(unsafe.Pointer(p)) 903 | for *p != 0 { 904 | p = (*C.char)(unsafe.Pointer(uintptr(unsafe.Pointer(p)) + 1)) // p++ 905 | } 906 | h.Len = int(uintptr(unsafe.Pointer(p)) - h.Data) 907 | } 908 | return 909 | } 910 | 911 | // RawString reperesents a string backed by data on the C side. 912 | type RawString string 913 | 914 | // Copy returns a Go-managed copy of raw string. 915 | func (raw RawString) Copy() string { 916 | if len(raw) == 0 { 917 | return "" 918 | } 919 | h := (*stringHeader)(unsafe.Pointer(&raw)) 920 | return C.GoStringN((*C.char)(unsafe.Pointer(h.Data)), C.int(h.Len)) 921 | } 922 | 923 | // packA5Vec2 reads sliced Go data structure out from plain C format. 924 | func packA5Vec2(v *[5]Vec2, ptr0 *[5]C.struct_ImVec2) { 925 | for i0 := range v { 926 | ptr1 := ptr0[i0] 927 | v[i0] = *NewVec2Ref(unsafe.Pointer(&ptr1)) 928 | } 929 | } 930 | 931 | // Ref returns the underlying reference to C object or nil if struct is nil. 932 | func (x *IO) Ref() *C.struct_ImGuiIO { 933 | if x == nil { 934 | return nil 935 | } 936 | return x.ref4700f756 937 | } 938 | 939 | // Free invokes alloc map's free mechanism that cleanups any allocated memory using C free. 940 | // Does nothing if struct is nil or has no allocation map. 941 | func (x *IO) Free() { 942 | if x != nil && x.allocs4700f756 != nil { 943 | x.allocs4700f756.(*cgoAllocMap).Free() 944 | x.ref4700f756 = nil 945 | } 946 | } 947 | 948 | // NewIORef creates a new wrapper struct with underlying reference set to the original C object. 949 | // Returns nil if the provided pointer to C object is nil too. 950 | func NewIORef(ref unsafe.Pointer) *IO { 951 | if ref == nil { 952 | return nil 953 | } 954 | obj := new(IO) 955 | obj.ref4700f756 = (*C.struct_ImGuiIO)(unsafe.Pointer(ref)) 956 | return obj 957 | } 958 | 959 | // PassRef returns the underlying C object, otherwise it will allocate one and set its values 960 | // from this wrapping struct, counting allocations into an allocation map. 961 | func (x *IO) PassRef() (*C.struct_ImGuiIO, *cgoAllocMap) { 962 | if x == nil { 963 | return nil, nil 964 | } else if x.ref4700f756 != nil { 965 | return x.ref4700f756, nil 966 | } 967 | mem4700f756 := allocStructImGuiIOMemory(1) 968 | ref4700f756 := (*C.struct_ImGuiIO)(mem4700f756) 969 | allocs4700f756 := new(cgoAllocMap) 970 | allocs4700f756.Add(mem4700f756) 971 | 972 | var cDisplaySize_allocs *cgoAllocMap 973 | ref4700f756.DisplaySize, cDisplaySize_allocs = x.DisplaySize.PassValue() 974 | allocs4700f756.Borrow(cDisplaySize_allocs) 975 | 976 | var cDeltaTime_allocs *cgoAllocMap 977 | ref4700f756.DeltaTime, cDeltaTime_allocs = (C.float)(x.DeltaTime), cgoAllocsUnknown 978 | allocs4700f756.Borrow(cDeltaTime_allocs) 979 | 980 | var cIniSavingRate_allocs *cgoAllocMap 981 | ref4700f756.IniSavingRate, cIniSavingRate_allocs = (C.float)(x.IniSavingRate), cgoAllocsUnknown 982 | allocs4700f756.Borrow(cIniSavingRate_allocs) 983 | 984 | var cIniFilename_allocs *cgoAllocMap 985 | ref4700f756.IniFilename, cIniFilename_allocs = unpackPCharString(x.IniFilename) 986 | allocs4700f756.Borrow(cIniFilename_allocs) 987 | 988 | var cLogFilename_allocs *cgoAllocMap 989 | ref4700f756.LogFilename, cLogFilename_allocs = unpackPCharString(x.LogFilename) 990 | allocs4700f756.Borrow(cLogFilename_allocs) 991 | 992 | var cMouseDoubleClickTime_allocs *cgoAllocMap 993 | ref4700f756.MouseDoubleClickTime, cMouseDoubleClickTime_allocs = (C.float)(x.MouseDoubleClickTime), cgoAllocsUnknown 994 | allocs4700f756.Borrow(cMouseDoubleClickTime_allocs) 995 | 996 | var cMouseDoubleClickMaxDist_allocs *cgoAllocMap 997 | ref4700f756.MouseDoubleClickMaxDist, cMouseDoubleClickMaxDist_allocs = (C.float)(x.MouseDoubleClickMaxDist), cgoAllocsUnknown 998 | allocs4700f756.Borrow(cMouseDoubleClickMaxDist_allocs) 999 | 1000 | var cMouseDragThreshold_allocs *cgoAllocMap 1001 | ref4700f756.MouseDragThreshold, cMouseDragThreshold_allocs = (C.float)(x.MouseDragThreshold), cgoAllocsUnknown 1002 | allocs4700f756.Borrow(cMouseDragThreshold_allocs) 1003 | 1004 | var cKeyMap_allocs *cgoAllocMap 1005 | ref4700f756.KeyMap, cKeyMap_allocs = *(*[19]C.int)(unsafe.Pointer(&x.KeyMap)), cgoAllocsUnknown 1006 | allocs4700f756.Borrow(cKeyMap_allocs) 1007 | 1008 | var cKeyRepeatDelay_allocs *cgoAllocMap 1009 | ref4700f756.KeyRepeatDelay, cKeyRepeatDelay_allocs = (C.float)(x.KeyRepeatDelay), cgoAllocsUnknown 1010 | allocs4700f756.Borrow(cKeyRepeatDelay_allocs) 1011 | 1012 | var cKeyRepeatRate_allocs *cgoAllocMap 1013 | ref4700f756.KeyRepeatRate, cKeyRepeatRate_allocs = (C.float)(x.KeyRepeatRate), cgoAllocsUnknown 1014 | allocs4700f756.Borrow(cKeyRepeatRate_allocs) 1015 | 1016 | var cUserData_allocs *cgoAllocMap 1017 | ref4700f756.UserData, cUserData_allocs = *(*unsafe.Pointer)(unsafe.Pointer(&x.UserData)), cgoAllocsUnknown 1018 | allocs4700f756.Borrow(cUserData_allocs) 1019 | 1020 | var cFonts_allocs *cgoAllocMap 1021 | ref4700f756.Fonts, cFonts_allocs = (*C.struct_ImFontAtlas)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&x.Fonts)).Data)), cgoAllocsUnknown 1022 | allocs4700f756.Borrow(cFonts_allocs) 1023 | 1024 | var cFontGlobalScale_allocs *cgoAllocMap 1025 | ref4700f756.FontGlobalScale, cFontGlobalScale_allocs = (C.float)(x.FontGlobalScale), cgoAllocsUnknown 1026 | allocs4700f756.Borrow(cFontGlobalScale_allocs) 1027 | 1028 | var cFontAllowUserScaling_allocs *cgoAllocMap 1029 | ref4700f756.FontAllowUserScaling, cFontAllowUserScaling_allocs = (C._Bool)(x.FontAllowUserScaling), cgoAllocsUnknown 1030 | allocs4700f756.Borrow(cFontAllowUserScaling_allocs) 1031 | 1032 | var cFontDefault_allocs *cgoAllocMap 1033 | ref4700f756.FontDefault, cFontDefault_allocs = (*C.struct_ImFont)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&x.FontDefault)).Data)), cgoAllocsUnknown 1034 | allocs4700f756.Borrow(cFontDefault_allocs) 1035 | 1036 | var cDisplayFramebufferScale_allocs *cgoAllocMap 1037 | ref4700f756.DisplayFramebufferScale, cDisplayFramebufferScale_allocs = x.DisplayFramebufferScale.PassValue() 1038 | allocs4700f756.Borrow(cDisplayFramebufferScale_allocs) 1039 | 1040 | var cDisplayVisibleMin_allocs *cgoAllocMap 1041 | ref4700f756.DisplayVisibleMin, cDisplayVisibleMin_allocs = x.DisplayVisibleMin.PassValue() 1042 | allocs4700f756.Borrow(cDisplayVisibleMin_allocs) 1043 | 1044 | var cDisplayVisibleMax_allocs *cgoAllocMap 1045 | ref4700f756.DisplayVisibleMax, cDisplayVisibleMax_allocs = x.DisplayVisibleMax.PassValue() 1046 | allocs4700f756.Borrow(cDisplayVisibleMax_allocs) 1047 | 1048 | var cOptMacOSXBehaviors_allocs *cgoAllocMap 1049 | ref4700f756.OptMacOSXBehaviors, cOptMacOSXBehaviors_allocs = (C._Bool)(x.OptMacOSXBehaviors), cgoAllocsUnknown 1050 | allocs4700f756.Borrow(cOptMacOSXBehaviors_allocs) 1051 | 1052 | var cOptCursorBlink_allocs *cgoAllocMap 1053 | ref4700f756.OptCursorBlink, cOptCursorBlink_allocs = (C._Bool)(x.OptCursorBlink), cgoAllocsUnknown 1054 | allocs4700f756.Borrow(cOptCursorBlink_allocs) 1055 | 1056 | var cRenderDrawListsFn_allocs *cgoAllocMap 1057 | ref4700f756.RenderDrawListsFn, cRenderDrawListsFn_allocs = x.RenderDrawListsFn.PassRef() 1058 | allocs4700f756.Borrow(cRenderDrawListsFn_allocs) 1059 | 1060 | var cGetClipboardTextFn_allocs *cgoAllocMap 1061 | ref4700f756.GetClipboardTextFn, cGetClipboardTextFn_allocs = x.GetClipboardTextFn.PassRef() 1062 | allocs4700f756.Borrow(cGetClipboardTextFn_allocs) 1063 | 1064 | var cSetClipboardTextFn_allocs *cgoAllocMap 1065 | ref4700f756.SetClipboardTextFn, cSetClipboardTextFn_allocs = x.SetClipboardTextFn.PassRef() 1066 | allocs4700f756.Borrow(cSetClipboardTextFn_allocs) 1067 | 1068 | var cClipboardUserData_allocs *cgoAllocMap 1069 | ref4700f756.ClipboardUserData, cClipboardUserData_allocs = *(*unsafe.Pointer)(unsafe.Pointer(&x.ClipboardUserData)), cgoAllocsUnknown 1070 | allocs4700f756.Borrow(cClipboardUserData_allocs) 1071 | 1072 | var cMemAllocFn_allocs *cgoAllocMap 1073 | ref4700f756.MemAllocFn, cMemAllocFn_allocs = x.MemAllocFn.PassRef() 1074 | allocs4700f756.Borrow(cMemAllocFn_allocs) 1075 | 1076 | var cMemFreeFn_allocs *cgoAllocMap 1077 | ref4700f756.MemFreeFn, cMemFreeFn_allocs = x.MemFreeFn.PassRef() 1078 | allocs4700f756.Borrow(cMemFreeFn_allocs) 1079 | 1080 | var cImeSetInputScreenPosFn_allocs *cgoAllocMap 1081 | ref4700f756.ImeSetInputScreenPosFn, cImeSetInputScreenPosFn_allocs = x.ESetInputScreenPosFn.PassRef() 1082 | allocs4700f756.Borrow(cImeSetInputScreenPosFn_allocs) 1083 | 1084 | var cImeWindowHandle_allocs *cgoAllocMap 1085 | ref4700f756.ImeWindowHandle, cImeWindowHandle_allocs = *(*unsafe.Pointer)(unsafe.Pointer(&x.EWindowHandle)), cgoAllocsUnknown 1086 | allocs4700f756.Borrow(cImeWindowHandle_allocs) 1087 | 1088 | var cMousePos_allocs *cgoAllocMap 1089 | ref4700f756.MousePos, cMousePos_allocs = x.MousePos.PassValue() 1090 | allocs4700f756.Borrow(cMousePos_allocs) 1091 | 1092 | var cMouseDown_allocs *cgoAllocMap 1093 | ref4700f756.MouseDown, cMouseDown_allocs = *(*[5]C._Bool)(unsafe.Pointer(&x.MouseDown)), cgoAllocsUnknown 1094 | allocs4700f756.Borrow(cMouseDown_allocs) 1095 | 1096 | var cMouseWheel_allocs *cgoAllocMap 1097 | ref4700f756.MouseWheel, cMouseWheel_allocs = (C.float)(x.MouseWheel), cgoAllocsUnknown 1098 | allocs4700f756.Borrow(cMouseWheel_allocs) 1099 | 1100 | var cMouseDrawCursor_allocs *cgoAllocMap 1101 | ref4700f756.MouseDrawCursor, cMouseDrawCursor_allocs = (C._Bool)(x.MouseDrawCursor), cgoAllocsUnknown 1102 | allocs4700f756.Borrow(cMouseDrawCursor_allocs) 1103 | 1104 | var cKeyCtrl_allocs *cgoAllocMap 1105 | ref4700f756.KeyCtrl, cKeyCtrl_allocs = (C._Bool)(x.KeyCtrl), cgoAllocsUnknown 1106 | allocs4700f756.Borrow(cKeyCtrl_allocs) 1107 | 1108 | var cKeyShift_allocs *cgoAllocMap 1109 | ref4700f756.KeyShift, cKeyShift_allocs = (C._Bool)(x.KeyShift), cgoAllocsUnknown 1110 | allocs4700f756.Borrow(cKeyShift_allocs) 1111 | 1112 | var cKeyAlt_allocs *cgoAllocMap 1113 | ref4700f756.KeyAlt, cKeyAlt_allocs = (C._Bool)(x.KeyAlt), cgoAllocsUnknown 1114 | allocs4700f756.Borrow(cKeyAlt_allocs) 1115 | 1116 | var cKeySuper_allocs *cgoAllocMap 1117 | ref4700f756.KeySuper, cKeySuper_allocs = (C._Bool)(x.KeySuper), cgoAllocsUnknown 1118 | allocs4700f756.Borrow(cKeySuper_allocs) 1119 | 1120 | var cKeysDown_allocs *cgoAllocMap 1121 | ref4700f756.KeysDown, cKeysDown_allocs = *(*[512]C._Bool)(unsafe.Pointer(&x.KeysDown)), cgoAllocsUnknown 1122 | allocs4700f756.Borrow(cKeysDown_allocs) 1123 | 1124 | var cInputCharacters_allocs *cgoAllocMap 1125 | ref4700f756.InputCharacters, cInputCharacters_allocs = *(*[17]C.ImWchar)(unsafe.Pointer(&x.InputCharacters)), cgoAllocsUnknown 1126 | allocs4700f756.Borrow(cInputCharacters_allocs) 1127 | 1128 | var cWantCaptureMouse_allocs *cgoAllocMap 1129 | ref4700f756.WantCaptureMouse, cWantCaptureMouse_allocs = (C._Bool)(x.WantCaptureMouse), cgoAllocsUnknown 1130 | allocs4700f756.Borrow(cWantCaptureMouse_allocs) 1131 | 1132 | var cWantCaptureKeyboard_allocs *cgoAllocMap 1133 | ref4700f756.WantCaptureKeyboard, cWantCaptureKeyboard_allocs = (C._Bool)(x.WantCaptureKeyboard), cgoAllocsUnknown 1134 | allocs4700f756.Borrow(cWantCaptureKeyboard_allocs) 1135 | 1136 | var cWantTextInput_allocs *cgoAllocMap 1137 | ref4700f756.WantTextInput, cWantTextInput_allocs = (C._Bool)(x.WantTextInput), cgoAllocsUnknown 1138 | allocs4700f756.Borrow(cWantTextInput_allocs) 1139 | 1140 | var cFramerate_allocs *cgoAllocMap 1141 | ref4700f756.Framerate, cFramerate_allocs = (C.float)(x.Framerate), cgoAllocsUnknown 1142 | allocs4700f756.Borrow(cFramerate_allocs) 1143 | 1144 | var cMetricsAllocs_allocs *cgoAllocMap 1145 | ref4700f756.MetricsAllocs, cMetricsAllocs_allocs = (C.int)(x.MetricsAllocs), cgoAllocsUnknown 1146 | allocs4700f756.Borrow(cMetricsAllocs_allocs) 1147 | 1148 | var cMetricsRenderVertices_allocs *cgoAllocMap 1149 | ref4700f756.MetricsRenderVertices, cMetricsRenderVertices_allocs = (C.int)(x.MetricsRenderVertices), cgoAllocsUnknown 1150 | allocs4700f756.Borrow(cMetricsRenderVertices_allocs) 1151 | 1152 | var cMetricsRenderIndices_allocs *cgoAllocMap 1153 | ref4700f756.MetricsRenderIndices, cMetricsRenderIndices_allocs = (C.int)(x.MetricsRenderIndices), cgoAllocsUnknown 1154 | allocs4700f756.Borrow(cMetricsRenderIndices_allocs) 1155 | 1156 | var cMetricsActiveWindows_allocs *cgoAllocMap 1157 | ref4700f756.MetricsActiveWindows, cMetricsActiveWindows_allocs = (C.int)(x.MetricsActiveWindows), cgoAllocsUnknown 1158 | allocs4700f756.Borrow(cMetricsActiveWindows_allocs) 1159 | 1160 | var cMouseDelta_allocs *cgoAllocMap 1161 | ref4700f756.MouseDelta, cMouseDelta_allocs = x.MouseDelta.PassValue() 1162 | allocs4700f756.Borrow(cMouseDelta_allocs) 1163 | 1164 | var cMousePosPrev_allocs *cgoAllocMap 1165 | ref4700f756.MousePosPrev, cMousePosPrev_allocs = x.MousePosPrev.PassValue() 1166 | allocs4700f756.Borrow(cMousePosPrev_allocs) 1167 | 1168 | var cMouseClicked_allocs *cgoAllocMap 1169 | ref4700f756.MouseClicked, cMouseClicked_allocs = *(*[5]C._Bool)(unsafe.Pointer(&x.MouseClicked)), cgoAllocsUnknown 1170 | allocs4700f756.Borrow(cMouseClicked_allocs) 1171 | 1172 | var cMouseClickedPos_allocs *cgoAllocMap 1173 | ref4700f756.MouseClickedPos, cMouseClickedPos_allocs = unpackA5Vec2(x.MouseClickedPos) 1174 | allocs4700f756.Borrow(cMouseClickedPos_allocs) 1175 | 1176 | var cMouseClickedTime_allocs *cgoAllocMap 1177 | ref4700f756.MouseClickedTime, cMouseClickedTime_allocs = *(*[5]C.float)(unsafe.Pointer(&x.MouseClickedTime)), cgoAllocsUnknown 1178 | allocs4700f756.Borrow(cMouseClickedTime_allocs) 1179 | 1180 | var cMouseDoubleClicked_allocs *cgoAllocMap 1181 | ref4700f756.MouseDoubleClicked, cMouseDoubleClicked_allocs = *(*[5]C._Bool)(unsafe.Pointer(&x.MouseDoubleClicked)), cgoAllocsUnknown 1182 | allocs4700f756.Borrow(cMouseDoubleClicked_allocs) 1183 | 1184 | var cMouseReleased_allocs *cgoAllocMap 1185 | ref4700f756.MouseReleased, cMouseReleased_allocs = *(*[5]C._Bool)(unsafe.Pointer(&x.MouseReleased)), cgoAllocsUnknown 1186 | allocs4700f756.Borrow(cMouseReleased_allocs) 1187 | 1188 | var cMouseDownOwned_allocs *cgoAllocMap 1189 | ref4700f756.MouseDownOwned, cMouseDownOwned_allocs = *(*[5]C._Bool)(unsafe.Pointer(&x.MouseDownOwned)), cgoAllocsUnknown 1190 | allocs4700f756.Borrow(cMouseDownOwned_allocs) 1191 | 1192 | var cMouseDownDuration_allocs *cgoAllocMap 1193 | ref4700f756.MouseDownDuration, cMouseDownDuration_allocs = *(*[5]C.float)(unsafe.Pointer(&x.MouseDownDuration)), cgoAllocsUnknown 1194 | allocs4700f756.Borrow(cMouseDownDuration_allocs) 1195 | 1196 | var cMouseDownDurationPrev_allocs *cgoAllocMap 1197 | ref4700f756.MouseDownDurationPrev, cMouseDownDurationPrev_allocs = *(*[5]C.float)(unsafe.Pointer(&x.MouseDownDurationPrev)), cgoAllocsUnknown 1198 | allocs4700f756.Borrow(cMouseDownDurationPrev_allocs) 1199 | 1200 | var cMouseDragMaxDistanceAbs_allocs *cgoAllocMap 1201 | ref4700f756.MouseDragMaxDistanceAbs, cMouseDragMaxDistanceAbs_allocs = unpackA5Vec2(x.MouseDragMaxDistanceAbs) 1202 | allocs4700f756.Borrow(cMouseDragMaxDistanceAbs_allocs) 1203 | 1204 | var cMouseDragMaxDistanceSqr_allocs *cgoAllocMap 1205 | ref4700f756.MouseDragMaxDistanceSqr, cMouseDragMaxDistanceSqr_allocs = *(*[5]C.float)(unsafe.Pointer(&x.MouseDragMaxDistanceSqr)), cgoAllocsUnknown 1206 | allocs4700f756.Borrow(cMouseDragMaxDistanceSqr_allocs) 1207 | 1208 | var cKeysDownDuration_allocs *cgoAllocMap 1209 | ref4700f756.KeysDownDuration, cKeysDownDuration_allocs = *(*[512]C.float)(unsafe.Pointer(&x.KeysDownDuration)), cgoAllocsUnknown 1210 | allocs4700f756.Borrow(cKeysDownDuration_allocs) 1211 | 1212 | var cKeysDownDurationPrev_allocs *cgoAllocMap 1213 | ref4700f756.KeysDownDurationPrev, cKeysDownDurationPrev_allocs = *(*[512]C.float)(unsafe.Pointer(&x.KeysDownDurationPrev)), cgoAllocsUnknown 1214 | allocs4700f756.Borrow(cKeysDownDurationPrev_allocs) 1215 | 1216 | x.ref4700f756 = ref4700f756 1217 | x.allocs4700f756 = allocs4700f756 1218 | return ref4700f756, allocs4700f756 1219 | 1220 | } 1221 | 1222 | // PassValue does the same as PassRef except that it will try to dereference the returned pointer. 1223 | func (x IO) PassValue() (C.struct_ImGuiIO, *cgoAllocMap) { 1224 | if x.ref4700f756 != nil { 1225 | return *x.ref4700f756, nil 1226 | } 1227 | ref, allocs := x.PassRef() 1228 | return *ref, allocs 1229 | } 1230 | 1231 | // Deref uses the underlying reference to C object and fills the wrapping struct with values. 1232 | // Do not forget to call this method whether you get a struct for C object and want to read its values. 1233 | func (x *IO) Deref() { 1234 | if x.ref4700f756 == nil { 1235 | return 1236 | } 1237 | x.DisplaySize = *NewVec2Ref(unsafe.Pointer(&x.ref4700f756.DisplaySize)) 1238 | x.DeltaTime = (float32)(x.ref4700f756.DeltaTime) 1239 | x.IniSavingRate = (float32)(x.ref4700f756.IniSavingRate) 1240 | x.IniFilename = packPCharString(x.ref4700f756.IniFilename) 1241 | x.LogFilename = packPCharString(x.ref4700f756.LogFilename) 1242 | x.MouseDoubleClickTime = (float32)(x.ref4700f756.MouseDoubleClickTime) 1243 | x.MouseDoubleClickMaxDist = (float32)(x.ref4700f756.MouseDoubleClickMaxDist) 1244 | x.MouseDragThreshold = (float32)(x.ref4700f756.MouseDragThreshold) 1245 | x.KeyMap = *(*[19]int32)(unsafe.Pointer(&x.ref4700f756.KeyMap)) 1246 | x.KeyRepeatDelay = (float32)(x.ref4700f756.KeyRepeatDelay) 1247 | x.KeyRepeatRate = (float32)(x.ref4700f756.KeyRepeatRate) 1248 | x.UserData = (unsafe.Pointer)(unsafe.Pointer(x.ref4700f756.UserData)) 1249 | hxff73280 := (*sliceHeader)(unsafe.Pointer(&x.Fonts)) 1250 | hxff73280.Data = uintptr(unsafe.Pointer(x.ref4700f756.Fonts)) 1251 | hxff73280.Cap = 0x7fffffff 1252 | // hxff73280.Len = ? 1253 | 1254 | x.FontGlobalScale = (float32)(x.ref4700f756.FontGlobalScale) 1255 | x.FontAllowUserScaling = (bool)(x.ref4700f756.FontAllowUserScaling) 1256 | hxfa9955c := (*sliceHeader)(unsafe.Pointer(&x.FontDefault)) 1257 | hxfa9955c.Data = uintptr(unsafe.Pointer(x.ref4700f756.FontDefault)) 1258 | hxfa9955c.Cap = 0x7fffffff 1259 | // hxfa9955c.Len = ? 1260 | 1261 | x.DisplayFramebufferScale = *NewVec2Ref(unsafe.Pointer(&x.ref4700f756.DisplayFramebufferScale)) 1262 | x.DisplayVisibleMin = *NewVec2Ref(unsafe.Pointer(&x.ref4700f756.DisplayVisibleMin)) 1263 | x.DisplayVisibleMax = *NewVec2Ref(unsafe.Pointer(&x.ref4700f756.DisplayVisibleMax)) 1264 | x.OptMacOSXBehaviors = (bool)(x.ref4700f756.OptMacOSXBehaviors) 1265 | x.OptCursorBlink = (bool)(x.ref4700f756.OptCursorBlink) 1266 | x.RenderDrawListsFn = NewRef(unsafe.Pointer(x.ref4700f756.RenderDrawListsFn)) 1267 | x.GetClipboardTextFn = NewRef(unsafe.Pointer(x.ref4700f756.GetClipboardTextFn)) 1268 | x.SetClipboardTextFn = NewRef(unsafe.Pointer(x.ref4700f756.SetClipboardTextFn)) 1269 | x.ClipboardUserData = (unsafe.Pointer)(unsafe.Pointer(x.ref4700f756.ClipboardUserData)) 1270 | x.MemAllocFn = NewRef(unsafe.Pointer(x.ref4700f756.MemAllocFn)) 1271 | x.MemFreeFn = NewRef(unsafe.Pointer(x.ref4700f756.MemFreeFn)) 1272 | x.ESetInputScreenPosFn = NewRef(unsafe.Pointer(x.ref4700f756.ImeSetInputScreenPosFn)) 1273 | x.EWindowHandle = (unsafe.Pointer)(unsafe.Pointer(x.ref4700f756.ImeWindowHandle)) 1274 | x.MousePos = *NewVec2Ref(unsafe.Pointer(&x.ref4700f756.MousePos)) 1275 | x.MouseDown = *(*[5]bool)(unsafe.Pointer(&x.ref4700f756.MouseDown)) 1276 | x.MouseWheel = (float32)(x.ref4700f756.MouseWheel) 1277 | x.MouseDrawCursor = (bool)(x.ref4700f756.MouseDrawCursor) 1278 | x.KeyCtrl = (bool)(x.ref4700f756.KeyCtrl) 1279 | x.KeyShift = (bool)(x.ref4700f756.KeyShift) 1280 | x.KeyAlt = (bool)(x.ref4700f756.KeyAlt) 1281 | x.KeySuper = (bool)(x.ref4700f756.KeySuper) 1282 | x.KeysDown = *(*[512]bool)(unsafe.Pointer(&x.ref4700f756.KeysDown)) 1283 | x.InputCharacters = *(*[17]Wchar)(unsafe.Pointer(&x.ref4700f756.InputCharacters)) 1284 | x.WantCaptureMouse = (bool)(x.ref4700f756.WantCaptureMouse) 1285 | x.WantCaptureKeyboard = (bool)(x.ref4700f756.WantCaptureKeyboard) 1286 | x.WantTextInput = (bool)(x.ref4700f756.WantTextInput) 1287 | x.Framerate = (float32)(x.ref4700f756.Framerate) 1288 | x.MetricsAllocs = (int32)(x.ref4700f756.MetricsAllocs) 1289 | x.MetricsRenderVertices = (int32)(x.ref4700f756.MetricsRenderVertices) 1290 | x.MetricsRenderIndices = (int32)(x.ref4700f756.MetricsRenderIndices) 1291 | x.MetricsActiveWindows = (int32)(x.ref4700f756.MetricsActiveWindows) 1292 | x.MouseDelta = *NewVec2Ref(unsafe.Pointer(&x.ref4700f756.MouseDelta)) 1293 | x.MousePosPrev = *NewVec2Ref(unsafe.Pointer(&x.ref4700f756.MousePosPrev)) 1294 | x.MouseClicked = *(*[5]bool)(unsafe.Pointer(&x.ref4700f756.MouseClicked)) 1295 | packA5Vec2(&x.MouseClickedPos, (*[5]C.struct_ImVec2)(unsafe.Pointer(&x.ref4700f756.MouseClickedPos))) 1296 | x.MouseClickedTime = *(*[5]float32)(unsafe.Pointer(&x.ref4700f756.MouseClickedTime)) 1297 | x.MouseDoubleClicked = *(*[5]bool)(unsafe.Pointer(&x.ref4700f756.MouseDoubleClicked)) 1298 | x.MouseReleased = *(*[5]bool)(unsafe.Pointer(&x.ref4700f756.MouseReleased)) 1299 | x.MouseDownOwned = *(*[5]bool)(unsafe.Pointer(&x.ref4700f756.MouseDownOwned)) 1300 | x.MouseDownDuration = *(*[5]float32)(unsafe.Pointer(&x.ref4700f756.MouseDownDuration)) 1301 | x.MouseDownDurationPrev = *(*[5]float32)(unsafe.Pointer(&x.ref4700f756.MouseDownDurationPrev)) 1302 | packA5Vec2(&x.MouseDragMaxDistanceAbs, (*[5]C.struct_ImVec2)(unsafe.Pointer(&x.ref4700f756.MouseDragMaxDistanceAbs))) 1303 | x.MouseDragMaxDistanceSqr = *(*[5]float32)(unsafe.Pointer(&x.ref4700f756.MouseDragMaxDistanceSqr)) 1304 | x.KeysDownDuration = *(*[512]float32)(unsafe.Pointer(&x.ref4700f756.KeysDownDuration)) 1305 | x.KeysDownDurationPrev = *(*[512]float32)(unsafe.Pointer(&x.ref4700f756.KeysDownDurationPrev)) 1306 | } 1307 | 1308 | // allocStructImGuiListClipperMemory allocates memory for type C.struct_ImGuiListClipper in C. 1309 | // The caller is responsible for freeing the this memory via C.free. 1310 | func allocStructImGuiListClipperMemory(n int) unsafe.Pointer { 1311 | mem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfStructImGuiListClipperValue)) 1312 | if err != nil { 1313 | panic("memory alloc error: " + err.Error()) 1314 | } 1315 | return mem 1316 | } 1317 | 1318 | const sizeOfStructImGuiListClipperValue = unsafe.Sizeof([1]C.struct_ImGuiListClipper{}) 1319 | 1320 | // Ref returns the underlying reference to C object or nil if struct is nil. 1321 | func (x *ListClipper) Ref() *C.struct_ImGuiListClipper { 1322 | if x == nil { 1323 | return nil 1324 | } 1325 | return x.refd52a46bd 1326 | } 1327 | 1328 | // Free invokes alloc map's free mechanism that cleanups any allocated memory using C free. 1329 | // Does nothing if struct is nil or has no allocation map. 1330 | func (x *ListClipper) Free() { 1331 | if x != nil && x.allocsd52a46bd != nil { 1332 | x.allocsd52a46bd.(*cgoAllocMap).Free() 1333 | x.refd52a46bd = nil 1334 | } 1335 | } 1336 | 1337 | // NewListClipperRef creates a new wrapper struct with underlying reference set to the original C object. 1338 | // Returns nil if the provided pointer to C object is nil too. 1339 | func NewListClipperRef(ref unsafe.Pointer) *ListClipper { 1340 | if ref == nil { 1341 | return nil 1342 | } 1343 | obj := new(ListClipper) 1344 | obj.refd52a46bd = (*C.struct_ImGuiListClipper)(unsafe.Pointer(ref)) 1345 | return obj 1346 | } 1347 | 1348 | // PassRef returns the underlying C object, otherwise it will allocate one and set its values 1349 | // from this wrapping struct, counting allocations into an allocation map. 1350 | func (x *ListClipper) PassRef() (*C.struct_ImGuiListClipper, *cgoAllocMap) { 1351 | if x == nil { 1352 | return nil, nil 1353 | } else if x.refd52a46bd != nil { 1354 | return x.refd52a46bd, nil 1355 | } 1356 | memd52a46bd := allocStructImGuiListClipperMemory(1) 1357 | refd52a46bd := (*C.struct_ImGuiListClipper)(memd52a46bd) 1358 | allocsd52a46bd := new(cgoAllocMap) 1359 | allocsd52a46bd.Add(memd52a46bd) 1360 | 1361 | var cStartPosY_allocs *cgoAllocMap 1362 | refd52a46bd.StartPosY, cStartPosY_allocs = (C.float)(x.StartPosY), cgoAllocsUnknown 1363 | allocsd52a46bd.Borrow(cStartPosY_allocs) 1364 | 1365 | var cItemsHeight_allocs *cgoAllocMap 1366 | refd52a46bd.ItemsHeight, cItemsHeight_allocs = (C.float)(x.ItemsHeight), cgoAllocsUnknown 1367 | allocsd52a46bd.Borrow(cItemsHeight_allocs) 1368 | 1369 | var cItemsCount_allocs *cgoAllocMap 1370 | refd52a46bd.ItemsCount, cItemsCount_allocs = (C.int)(x.ItemsCount), cgoAllocsUnknown 1371 | allocsd52a46bd.Borrow(cItemsCount_allocs) 1372 | 1373 | var cStepNo_allocs *cgoAllocMap 1374 | refd52a46bd.StepNo, cStepNo_allocs = (C.int)(x.StepNo), cgoAllocsUnknown 1375 | allocsd52a46bd.Borrow(cStepNo_allocs) 1376 | 1377 | var cDisplayStart_allocs *cgoAllocMap 1378 | refd52a46bd.DisplayStart, cDisplayStart_allocs = (C.int)(x.DisplayStart), cgoAllocsUnknown 1379 | allocsd52a46bd.Borrow(cDisplayStart_allocs) 1380 | 1381 | var cDisplayEnd_allocs *cgoAllocMap 1382 | refd52a46bd.DisplayEnd, cDisplayEnd_allocs = (C.int)(x.DisplayEnd), cgoAllocsUnknown 1383 | allocsd52a46bd.Borrow(cDisplayEnd_allocs) 1384 | 1385 | x.refd52a46bd = refd52a46bd 1386 | x.allocsd52a46bd = allocsd52a46bd 1387 | return refd52a46bd, allocsd52a46bd 1388 | 1389 | } 1390 | 1391 | // PassValue does the same as PassRef except that it will try to dereference the returned pointer. 1392 | func (x ListClipper) PassValue() (C.struct_ImGuiListClipper, *cgoAllocMap) { 1393 | if x.refd52a46bd != nil { 1394 | return *x.refd52a46bd, nil 1395 | } 1396 | ref, allocs := x.PassRef() 1397 | return *ref, allocs 1398 | } 1399 | 1400 | // Deref uses the underlying reference to C object and fills the wrapping struct with values. 1401 | // Do not forget to call this method whether you get a struct for C object and want to read its values. 1402 | func (x *ListClipper) Deref() { 1403 | if x.refd52a46bd == nil { 1404 | return 1405 | } 1406 | x.StartPosY = (float32)(x.refd52a46bd.StartPosY) 1407 | x.ItemsHeight = (float32)(x.refd52a46bd.ItemsHeight) 1408 | x.ItemsCount = (int32)(x.refd52a46bd.ItemsCount) 1409 | x.StepNo = (int32)(x.refd52a46bd.StepNo) 1410 | x.DisplayStart = (int32)(x.refd52a46bd.DisplayStart) 1411 | x.DisplayEnd = (int32)(x.refd52a46bd.DisplayEnd) 1412 | } 1413 | 1414 | // allocStructImGuiPayloadMemory allocates memory for type C.struct_ImGuiPayload in C. 1415 | // The caller is responsible for freeing the this memory via C.free. 1416 | func allocStructImGuiPayloadMemory(n int) unsafe.Pointer { 1417 | mem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfStructImGuiPayloadValue)) 1418 | if err != nil { 1419 | panic("memory alloc error: " + err.Error()) 1420 | } 1421 | return mem 1422 | } 1423 | 1424 | const sizeOfStructImGuiPayloadValue = unsafe.Sizeof([1]C.struct_ImGuiPayload{}) 1425 | 1426 | // Ref returns the underlying reference to C object or nil if struct is nil. 1427 | func (x *Payload) Ref() *C.struct_ImGuiPayload { 1428 | if x == nil { 1429 | return nil 1430 | } 1431 | return x.refea983e4e 1432 | } 1433 | 1434 | // Free invokes alloc map's free mechanism that cleanups any allocated memory using C free. 1435 | // Does nothing if struct is nil or has no allocation map. 1436 | func (x *Payload) Free() { 1437 | if x != nil && x.allocsea983e4e != nil { 1438 | x.allocsea983e4e.(*cgoAllocMap).Free() 1439 | x.refea983e4e = nil 1440 | } 1441 | } 1442 | 1443 | // NewPayloadRef creates a new wrapper struct with underlying reference set to the original C object. 1444 | // Returns nil if the provided pointer to C object is nil too. 1445 | func NewPayloadRef(ref unsafe.Pointer) *Payload { 1446 | if ref == nil { 1447 | return nil 1448 | } 1449 | obj := new(Payload) 1450 | obj.refea983e4e = (*C.struct_ImGuiPayload)(unsafe.Pointer(ref)) 1451 | return obj 1452 | } 1453 | 1454 | // PassRef returns the underlying C object, otherwise it will allocate one and set its values 1455 | // from this wrapping struct, counting allocations into an allocation map. 1456 | func (x *Payload) PassRef() (*C.struct_ImGuiPayload, *cgoAllocMap) { 1457 | if x == nil { 1458 | return nil, nil 1459 | } else if x.refea983e4e != nil { 1460 | return x.refea983e4e, nil 1461 | } 1462 | memea983e4e := allocStructImGuiPayloadMemory(1) 1463 | refea983e4e := (*C.struct_ImGuiPayload)(memea983e4e) 1464 | allocsea983e4e := new(cgoAllocMap) 1465 | allocsea983e4e.Add(memea983e4e) 1466 | 1467 | var cData_allocs *cgoAllocMap 1468 | refea983e4e.Data, cData_allocs = *(*unsafe.Pointer)(unsafe.Pointer(&x.Data)), cgoAllocsUnknown 1469 | allocsea983e4e.Borrow(cData_allocs) 1470 | 1471 | var cDataSize_allocs *cgoAllocMap 1472 | refea983e4e.DataSize, cDataSize_allocs = (C.int)(x.DataSize), cgoAllocsUnknown 1473 | allocsea983e4e.Borrow(cDataSize_allocs) 1474 | 1475 | var cSourceId_allocs *cgoAllocMap 1476 | refea983e4e.SourceId, cSourceId_allocs = (C.ImGuiID)(x.SourceId), cgoAllocsUnknown 1477 | allocsea983e4e.Borrow(cSourceId_allocs) 1478 | 1479 | var cSourceParentId_allocs *cgoAllocMap 1480 | refea983e4e.SourceParentId, cSourceParentId_allocs = (C.ImGuiID)(x.SourceParentId), cgoAllocsUnknown 1481 | allocsea983e4e.Borrow(cSourceParentId_allocs) 1482 | 1483 | var cDataFrameCount_allocs *cgoAllocMap 1484 | refea983e4e.DataFrameCount, cDataFrameCount_allocs = (C.int)(x.DataFrameCount), cgoAllocsUnknown 1485 | allocsea983e4e.Borrow(cDataFrameCount_allocs) 1486 | 1487 | var cDataType_allocs *cgoAllocMap 1488 | refea983e4e.DataType, cDataType_allocs = *(*[9]C.char)(unsafe.Pointer(&x.DataType)), cgoAllocsUnknown 1489 | allocsea983e4e.Borrow(cDataType_allocs) 1490 | 1491 | var cPreview_allocs *cgoAllocMap 1492 | refea983e4e.Preview, cPreview_allocs = (C._Bool)(x.Preview), cgoAllocsUnknown 1493 | allocsea983e4e.Borrow(cPreview_allocs) 1494 | 1495 | var cDelivery_allocs *cgoAllocMap 1496 | refea983e4e.Delivery, cDelivery_allocs = (C._Bool)(x.Delivery), cgoAllocsUnknown 1497 | allocsea983e4e.Borrow(cDelivery_allocs) 1498 | 1499 | x.refea983e4e = refea983e4e 1500 | x.allocsea983e4e = allocsea983e4e 1501 | return refea983e4e, allocsea983e4e 1502 | 1503 | } 1504 | 1505 | // PassValue does the same as PassRef except that it will try to dereference the returned pointer. 1506 | func (x Payload) PassValue() (C.struct_ImGuiPayload, *cgoAllocMap) { 1507 | if x.refea983e4e != nil { 1508 | return *x.refea983e4e, nil 1509 | } 1510 | ref, allocs := x.PassRef() 1511 | return *ref, allocs 1512 | } 1513 | 1514 | // Deref uses the underlying reference to C object and fills the wrapping struct with values. 1515 | // Do not forget to call this method whether you get a struct for C object and want to read its values. 1516 | func (x *Payload) Deref() { 1517 | if x.refea983e4e == nil { 1518 | return 1519 | } 1520 | x.Data = (unsafe.Pointer)(unsafe.Pointer(x.refea983e4e.Data)) 1521 | x.DataSize = (int32)(x.refea983e4e.DataSize) 1522 | x.SourceId = (ID)(x.refea983e4e.SourceId) 1523 | x.SourceParentId = (ID)(x.refea983e4e.SourceParentId) 1524 | x.DataFrameCount = (int32)(x.refea983e4e.DataFrameCount) 1525 | x.DataType = *(*[9]byte)(unsafe.Pointer(&x.refea983e4e.DataType)) 1526 | x.Preview = (bool)(x.refea983e4e.Preview) 1527 | x.Delivery = (bool)(x.refea983e4e.Delivery) 1528 | } 1529 | 1530 | // allocStructImGuiSizeConstraintCallbackDataMemory allocates memory for type C.struct_ImGuiSizeConstraintCallbackData in C. 1531 | // The caller is responsible for freeing the this memory via C.free. 1532 | func allocStructImGuiSizeConstraintCallbackDataMemory(n int) unsafe.Pointer { 1533 | mem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfStructImGuiSizeConstraintCallbackDataValue)) 1534 | if err != nil { 1535 | panic("memory alloc error: " + err.Error()) 1536 | } 1537 | return mem 1538 | } 1539 | 1540 | const sizeOfStructImGuiSizeConstraintCallbackDataValue = unsafe.Sizeof([1]C.struct_ImGuiSizeConstraintCallbackData{}) 1541 | 1542 | // Ref returns the underlying reference to C object or nil if struct is nil. 1543 | func (x *SizeConstraintCallbackData) Ref() *C.struct_ImGuiSizeConstraintCallbackData { 1544 | if x == nil { 1545 | return nil 1546 | } 1547 | return x.ref24c5ad70 1548 | } 1549 | 1550 | // Free invokes alloc map's free mechanism that cleanups any allocated memory using C free. 1551 | // Does nothing if struct is nil or has no allocation map. 1552 | func (x *SizeConstraintCallbackData) Free() { 1553 | if x != nil && x.allocs24c5ad70 != nil { 1554 | x.allocs24c5ad70.(*cgoAllocMap).Free() 1555 | x.ref24c5ad70 = nil 1556 | } 1557 | } 1558 | 1559 | // NewSizeConstraintCallbackDataRef creates a new wrapper struct with underlying reference set to the original C object. 1560 | // Returns nil if the provided pointer to C object is nil too. 1561 | func NewSizeConstraintCallbackDataRef(ref unsafe.Pointer) *SizeConstraintCallbackData { 1562 | if ref == nil { 1563 | return nil 1564 | } 1565 | obj := new(SizeConstraintCallbackData) 1566 | obj.ref24c5ad70 = (*C.struct_ImGuiSizeConstraintCallbackData)(unsafe.Pointer(ref)) 1567 | return obj 1568 | } 1569 | 1570 | // PassRef returns the underlying C object, otherwise it will allocate one and set its values 1571 | // from this wrapping struct, counting allocations into an allocation map. 1572 | func (x *SizeConstraintCallbackData) PassRef() (*C.struct_ImGuiSizeConstraintCallbackData, *cgoAllocMap) { 1573 | if x == nil { 1574 | return nil, nil 1575 | } else if x.ref24c5ad70 != nil { 1576 | return x.ref24c5ad70, nil 1577 | } 1578 | mem24c5ad70 := allocStructImGuiSizeConstraintCallbackDataMemory(1) 1579 | ref24c5ad70 := (*C.struct_ImGuiSizeConstraintCallbackData)(mem24c5ad70) 1580 | allocs24c5ad70 := new(cgoAllocMap) 1581 | allocs24c5ad70.Add(mem24c5ad70) 1582 | 1583 | var cUserData_allocs *cgoAllocMap 1584 | ref24c5ad70.UserData, cUserData_allocs = *(*unsafe.Pointer)(unsafe.Pointer(&x.UserData)), cgoAllocsUnknown 1585 | allocs24c5ad70.Borrow(cUserData_allocs) 1586 | 1587 | var cPos_allocs *cgoAllocMap 1588 | ref24c5ad70.Pos, cPos_allocs = x.Pos.PassValue() 1589 | allocs24c5ad70.Borrow(cPos_allocs) 1590 | 1591 | var cCurrentSize_allocs *cgoAllocMap 1592 | ref24c5ad70.CurrentSize, cCurrentSize_allocs = x.CurrentSize.PassValue() 1593 | allocs24c5ad70.Borrow(cCurrentSize_allocs) 1594 | 1595 | var cDesiredSize_allocs *cgoAllocMap 1596 | ref24c5ad70.DesiredSize, cDesiredSize_allocs = x.DesiredSize.PassValue() 1597 | allocs24c5ad70.Borrow(cDesiredSize_allocs) 1598 | 1599 | x.ref24c5ad70 = ref24c5ad70 1600 | x.allocs24c5ad70 = allocs24c5ad70 1601 | return ref24c5ad70, allocs24c5ad70 1602 | 1603 | } 1604 | 1605 | // PassValue does the same as PassRef except that it will try to dereference the returned pointer. 1606 | func (x SizeConstraintCallbackData) PassValue() (C.struct_ImGuiSizeConstraintCallbackData, *cgoAllocMap) { 1607 | if x.ref24c5ad70 != nil { 1608 | return *x.ref24c5ad70, nil 1609 | } 1610 | ref, allocs := x.PassRef() 1611 | return *ref, allocs 1612 | } 1613 | 1614 | // Deref uses the underlying reference to C object and fills the wrapping struct with values. 1615 | // Do not forget to call this method whether you get a struct for C object and want to read its values. 1616 | func (x *SizeConstraintCallbackData) Deref() { 1617 | if x.ref24c5ad70 == nil { 1618 | return 1619 | } 1620 | x.UserData = (unsafe.Pointer)(unsafe.Pointer(x.ref24c5ad70.UserData)) 1621 | x.Pos = *NewVec2Ref(unsafe.Pointer(&x.ref24c5ad70.Pos)) 1622 | x.CurrentSize = *NewVec2Ref(unsafe.Pointer(&x.ref24c5ad70.CurrentSize)) 1623 | x.DesiredSize = *NewVec2Ref(unsafe.Pointer(&x.ref24c5ad70.DesiredSize)) 1624 | } 1625 | 1626 | // Ref returns a reference to C object as it is. 1627 | func (x *Storage) Ref() *C.struct_ImGuiStorage { 1628 | if x == nil { 1629 | return nil 1630 | } 1631 | return (*C.struct_ImGuiStorage)(unsafe.Pointer(x)) 1632 | } 1633 | 1634 | // Free cleanups the referenced memory using C free. 1635 | func (x *Storage) Free() { 1636 | if x != nil { 1637 | C.free(unsafe.Pointer(x)) 1638 | } 1639 | } 1640 | 1641 | // NewStorageRef converts the C object reference into a raw struct reference without wrapping. 1642 | func NewStorageRef(ref unsafe.Pointer) *Storage { 1643 | return (*Storage)(ref) 1644 | } 1645 | 1646 | // NewStorage allocates a new C object of this type and converts the reference into 1647 | // a raw struct reference without wrapping. 1648 | func NewStorage() *Storage { 1649 | return (*Storage)(allocStructImGuiStorageMemory(1)) 1650 | } 1651 | 1652 | // allocStructImGuiStorageMemory allocates memory for type C.struct_ImGuiStorage in C. 1653 | // The caller is responsible for freeing the this memory via C.free. 1654 | func allocStructImGuiStorageMemory(n int) unsafe.Pointer { 1655 | mem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfStructImGuiStorageValue)) 1656 | if err != nil { 1657 | panic("memory alloc error: " + err.Error()) 1658 | } 1659 | return mem 1660 | } 1661 | 1662 | const sizeOfStructImGuiStorageValue = unsafe.Sizeof([1]C.struct_ImGuiStorage{}) 1663 | 1664 | // PassRef returns a reference to C object as it is or allocates a new C object of this type. 1665 | func (x *Storage) PassRef() *C.struct_ImGuiStorage { 1666 | if x == nil { 1667 | x = (*Storage)(allocStructImGuiStorageMemory(1)) 1668 | } 1669 | return (*C.struct_ImGuiStorage)(unsafe.Pointer(x)) 1670 | } 1671 | 1672 | // allocStructImGuiStyleMemory allocates memory for type C.struct_ImGuiStyle in C. 1673 | // The caller is responsible for freeing the this memory via C.free. 1674 | func allocStructImGuiStyleMemory(n int) unsafe.Pointer { 1675 | mem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfStructImGuiStyleValue)) 1676 | if err != nil { 1677 | panic("memory alloc error: " + err.Error()) 1678 | } 1679 | return mem 1680 | } 1681 | 1682 | const sizeOfStructImGuiStyleValue = unsafe.Sizeof([1]C.struct_ImGuiStyle{}) 1683 | 1684 | // allocA43StructImVec4Memory allocates memory for type [43]C.struct_ImVec4 in C. 1685 | // The caller is responsible for freeing the this memory via C.free. 1686 | func allocA43StructImVec4Memory(n int) unsafe.Pointer { 1687 | mem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfA43StructImVec4Value)) 1688 | if err != nil { 1689 | panic("memory alloc error: " + err.Error()) 1690 | } 1691 | return mem 1692 | } 1693 | 1694 | const sizeOfA43StructImVec4Value = unsafe.Sizeof([1][43]C.struct_ImVec4{}) 1695 | 1696 | // unpackA43Vec4 transforms a sliced Go data structure into plain C format. 1697 | func unpackA43Vec4(x [43]Vec4) (unpacked [43]C.struct_ImVec4, allocs *cgoAllocMap) { 1698 | allocs = new(cgoAllocMap) 1699 | defer runtime.SetFinalizer(&unpacked, func(*[43]C.struct_ImVec4) { 1700 | go allocs.Free() 1701 | }) 1702 | 1703 | mem0 := allocA43StructImVec4Memory(1) 1704 | allocs.Add(mem0) 1705 | v0 := (*[43]C.struct_ImVec4)(mem0) 1706 | for i0 := range x { 1707 | allocs0 := new(cgoAllocMap) 1708 | v0[i0], allocs0 = x[i0].PassValue() 1709 | allocs.Borrow(allocs0) 1710 | } 1711 | unpacked = *(*[43]C.struct_ImVec4)(mem0) 1712 | return 1713 | } 1714 | 1715 | // packA43Vec4 reads sliced Go data structure out from plain C format. 1716 | func packA43Vec4(v *[43]Vec4, ptr0 *[43]C.struct_ImVec4) { 1717 | for i0 := range v { 1718 | ptr1 := ptr0[i0] 1719 | v[i0] = *NewVec4Ref(unsafe.Pointer(&ptr1)) 1720 | } 1721 | } 1722 | 1723 | // Ref returns the underlying reference to C object or nil if struct is nil. 1724 | func (x *Style) Ref() *C.struct_ImGuiStyle { 1725 | if x == nil { 1726 | return nil 1727 | } 1728 | return x.ref6e47ee0d 1729 | } 1730 | 1731 | // Free invokes alloc map's free mechanism that cleanups any allocated memory using C free. 1732 | // Does nothing if struct is nil or has no allocation map. 1733 | func (x *Style) Free() { 1734 | if x != nil && x.allocs6e47ee0d != nil { 1735 | x.allocs6e47ee0d.(*cgoAllocMap).Free() 1736 | x.ref6e47ee0d = nil 1737 | } 1738 | } 1739 | 1740 | // NewStyleRef creates a new wrapper struct with underlying reference set to the original C object. 1741 | // Returns nil if the provided pointer to C object is nil too. 1742 | func NewStyleRef(ref unsafe.Pointer) *Style { 1743 | if ref == nil { 1744 | return nil 1745 | } 1746 | obj := new(Style) 1747 | obj.ref6e47ee0d = (*C.struct_ImGuiStyle)(unsafe.Pointer(ref)) 1748 | return obj 1749 | } 1750 | 1751 | // PassRef returns the underlying C object, otherwise it will allocate one and set its values 1752 | // from this wrapping struct, counting allocations into an allocation map. 1753 | func (x *Style) PassRef() (*C.struct_ImGuiStyle, *cgoAllocMap) { 1754 | if x == nil { 1755 | return nil, nil 1756 | } else if x.ref6e47ee0d != nil { 1757 | return x.ref6e47ee0d, nil 1758 | } 1759 | mem6e47ee0d := allocStructImGuiStyleMemory(1) 1760 | ref6e47ee0d := (*C.struct_ImGuiStyle)(mem6e47ee0d) 1761 | allocs6e47ee0d := new(cgoAllocMap) 1762 | allocs6e47ee0d.Add(mem6e47ee0d) 1763 | 1764 | var cAlpha_allocs *cgoAllocMap 1765 | ref6e47ee0d.Alpha, cAlpha_allocs = (C.float)(x.Alpha), cgoAllocsUnknown 1766 | allocs6e47ee0d.Borrow(cAlpha_allocs) 1767 | 1768 | var cWindowPadding_allocs *cgoAllocMap 1769 | ref6e47ee0d.WindowPadding, cWindowPadding_allocs = x.WindowPadding.PassValue() 1770 | allocs6e47ee0d.Borrow(cWindowPadding_allocs) 1771 | 1772 | var cWindowRounding_allocs *cgoAllocMap 1773 | ref6e47ee0d.WindowRounding, cWindowRounding_allocs = (C.float)(x.WindowRounding), cgoAllocsUnknown 1774 | allocs6e47ee0d.Borrow(cWindowRounding_allocs) 1775 | 1776 | var cWindowBorderSize_allocs *cgoAllocMap 1777 | ref6e47ee0d.WindowBorderSize, cWindowBorderSize_allocs = (C.float)(x.WindowBorderSize), cgoAllocsUnknown 1778 | allocs6e47ee0d.Borrow(cWindowBorderSize_allocs) 1779 | 1780 | var cWindowMinSize_allocs *cgoAllocMap 1781 | ref6e47ee0d.WindowMinSize, cWindowMinSize_allocs = x.WindowMinSize.PassValue() 1782 | allocs6e47ee0d.Borrow(cWindowMinSize_allocs) 1783 | 1784 | var cWindowTitleAlign_allocs *cgoAllocMap 1785 | ref6e47ee0d.WindowTitleAlign, cWindowTitleAlign_allocs = x.WindowTitleAlign.PassValue() 1786 | allocs6e47ee0d.Borrow(cWindowTitleAlign_allocs) 1787 | 1788 | var cChildRounding_allocs *cgoAllocMap 1789 | ref6e47ee0d.ChildRounding, cChildRounding_allocs = (C.float)(x.ChildRounding), cgoAllocsUnknown 1790 | allocs6e47ee0d.Borrow(cChildRounding_allocs) 1791 | 1792 | var cChildBorderSize_allocs *cgoAllocMap 1793 | ref6e47ee0d.ChildBorderSize, cChildBorderSize_allocs = (C.float)(x.ChildBorderSize), cgoAllocsUnknown 1794 | allocs6e47ee0d.Borrow(cChildBorderSize_allocs) 1795 | 1796 | var cPopupRounding_allocs *cgoAllocMap 1797 | ref6e47ee0d.PopupRounding, cPopupRounding_allocs = (C.float)(x.PopupRounding), cgoAllocsUnknown 1798 | allocs6e47ee0d.Borrow(cPopupRounding_allocs) 1799 | 1800 | var cPopupBorderSize_allocs *cgoAllocMap 1801 | ref6e47ee0d.PopupBorderSize, cPopupBorderSize_allocs = (C.float)(x.PopupBorderSize), cgoAllocsUnknown 1802 | allocs6e47ee0d.Borrow(cPopupBorderSize_allocs) 1803 | 1804 | var cFramePadding_allocs *cgoAllocMap 1805 | ref6e47ee0d.FramePadding, cFramePadding_allocs = x.FramePadding.PassValue() 1806 | allocs6e47ee0d.Borrow(cFramePadding_allocs) 1807 | 1808 | var cFrameRounding_allocs *cgoAllocMap 1809 | ref6e47ee0d.FrameRounding, cFrameRounding_allocs = (C.float)(x.FrameRounding), cgoAllocsUnknown 1810 | allocs6e47ee0d.Borrow(cFrameRounding_allocs) 1811 | 1812 | var cFrameBorderSize_allocs *cgoAllocMap 1813 | ref6e47ee0d.FrameBorderSize, cFrameBorderSize_allocs = (C.float)(x.FrameBorderSize), cgoAllocsUnknown 1814 | allocs6e47ee0d.Borrow(cFrameBorderSize_allocs) 1815 | 1816 | var cItemSpacing_allocs *cgoAllocMap 1817 | ref6e47ee0d.ItemSpacing, cItemSpacing_allocs = x.ItemSpacing.PassValue() 1818 | allocs6e47ee0d.Borrow(cItemSpacing_allocs) 1819 | 1820 | var cItemInnerSpacing_allocs *cgoAllocMap 1821 | ref6e47ee0d.ItemInnerSpacing, cItemInnerSpacing_allocs = x.ItemInnerSpacing.PassValue() 1822 | allocs6e47ee0d.Borrow(cItemInnerSpacing_allocs) 1823 | 1824 | var cTouchExtraPadding_allocs *cgoAllocMap 1825 | ref6e47ee0d.TouchExtraPadding, cTouchExtraPadding_allocs = x.TouchExtraPadding.PassValue() 1826 | allocs6e47ee0d.Borrow(cTouchExtraPadding_allocs) 1827 | 1828 | var cIndentSpacing_allocs *cgoAllocMap 1829 | ref6e47ee0d.IndentSpacing, cIndentSpacing_allocs = (C.float)(x.IndentSpacing), cgoAllocsUnknown 1830 | allocs6e47ee0d.Borrow(cIndentSpacing_allocs) 1831 | 1832 | var cColumnsMinSpacing_allocs *cgoAllocMap 1833 | ref6e47ee0d.ColumnsMinSpacing, cColumnsMinSpacing_allocs = (C.float)(x.ColumnsMinSpacing), cgoAllocsUnknown 1834 | allocs6e47ee0d.Borrow(cColumnsMinSpacing_allocs) 1835 | 1836 | var cScrollbarSize_allocs *cgoAllocMap 1837 | ref6e47ee0d.ScrollbarSize, cScrollbarSize_allocs = (C.float)(x.ScrollbarSize), cgoAllocsUnknown 1838 | allocs6e47ee0d.Borrow(cScrollbarSize_allocs) 1839 | 1840 | var cScrollbarRounding_allocs *cgoAllocMap 1841 | ref6e47ee0d.ScrollbarRounding, cScrollbarRounding_allocs = (C.float)(x.ScrollbarRounding), cgoAllocsUnknown 1842 | allocs6e47ee0d.Borrow(cScrollbarRounding_allocs) 1843 | 1844 | var cGrabMinSize_allocs *cgoAllocMap 1845 | ref6e47ee0d.GrabMinSize, cGrabMinSize_allocs = (C.float)(x.GrabMinSize), cgoAllocsUnknown 1846 | allocs6e47ee0d.Borrow(cGrabMinSize_allocs) 1847 | 1848 | var cGrabRounding_allocs *cgoAllocMap 1849 | ref6e47ee0d.GrabRounding, cGrabRounding_allocs = (C.float)(x.GrabRounding), cgoAllocsUnknown 1850 | allocs6e47ee0d.Borrow(cGrabRounding_allocs) 1851 | 1852 | var cButtonTextAlign_allocs *cgoAllocMap 1853 | ref6e47ee0d.ButtonTextAlign, cButtonTextAlign_allocs = x.ButtonTextAlign.PassValue() 1854 | allocs6e47ee0d.Borrow(cButtonTextAlign_allocs) 1855 | 1856 | var cDisplayWindowPadding_allocs *cgoAllocMap 1857 | ref6e47ee0d.DisplayWindowPadding, cDisplayWindowPadding_allocs = x.DisplayWindowPadding.PassValue() 1858 | allocs6e47ee0d.Borrow(cDisplayWindowPadding_allocs) 1859 | 1860 | var cDisplaySafeAreaPadding_allocs *cgoAllocMap 1861 | ref6e47ee0d.DisplaySafeAreaPadding, cDisplaySafeAreaPadding_allocs = x.DisplaySafeAreaPadding.PassValue() 1862 | allocs6e47ee0d.Borrow(cDisplaySafeAreaPadding_allocs) 1863 | 1864 | var cAntiAliasedLines_allocs *cgoAllocMap 1865 | ref6e47ee0d.AntiAliasedLines, cAntiAliasedLines_allocs = (C._Bool)(x.AntiAliasedLines), cgoAllocsUnknown 1866 | allocs6e47ee0d.Borrow(cAntiAliasedLines_allocs) 1867 | 1868 | var cAntiAliasedFill_allocs *cgoAllocMap 1869 | ref6e47ee0d.AntiAliasedFill, cAntiAliasedFill_allocs = (C._Bool)(x.AntiAliasedFill), cgoAllocsUnknown 1870 | allocs6e47ee0d.Borrow(cAntiAliasedFill_allocs) 1871 | 1872 | var cCurveTessellationTol_allocs *cgoAllocMap 1873 | ref6e47ee0d.CurveTessellationTol, cCurveTessellationTol_allocs = (C.float)(x.CurveTessellationTol), cgoAllocsUnknown 1874 | allocs6e47ee0d.Borrow(cCurveTessellationTol_allocs) 1875 | 1876 | var cColors_allocs *cgoAllocMap 1877 | ref6e47ee0d.Colors, cColors_allocs = unpackA43Vec4(x.Colors) 1878 | allocs6e47ee0d.Borrow(cColors_allocs) 1879 | 1880 | x.ref6e47ee0d = ref6e47ee0d 1881 | x.allocs6e47ee0d = allocs6e47ee0d 1882 | return ref6e47ee0d, allocs6e47ee0d 1883 | 1884 | } 1885 | 1886 | // PassValue does the same as PassRef except that it will try to dereference the returned pointer. 1887 | func (x Style) PassValue() (C.struct_ImGuiStyle, *cgoAllocMap) { 1888 | if x.ref6e47ee0d != nil { 1889 | return *x.ref6e47ee0d, nil 1890 | } 1891 | ref, allocs := x.PassRef() 1892 | return *ref, allocs 1893 | } 1894 | 1895 | // Deref uses the underlying reference to C object and fills the wrapping struct with values. 1896 | // Do not forget to call this method whether you get a struct for C object and want to read its values. 1897 | func (x *Style) Deref() { 1898 | if x.ref6e47ee0d == nil { 1899 | return 1900 | } 1901 | x.Alpha = (float32)(x.ref6e47ee0d.Alpha) 1902 | x.WindowPadding = *NewVec2Ref(unsafe.Pointer(&x.ref6e47ee0d.WindowPadding)) 1903 | x.WindowRounding = (float32)(x.ref6e47ee0d.WindowRounding) 1904 | x.WindowBorderSize = (float32)(x.ref6e47ee0d.WindowBorderSize) 1905 | x.WindowMinSize = *NewVec2Ref(unsafe.Pointer(&x.ref6e47ee0d.WindowMinSize)) 1906 | x.WindowTitleAlign = *NewVec2Ref(unsafe.Pointer(&x.ref6e47ee0d.WindowTitleAlign)) 1907 | x.ChildRounding = (float32)(x.ref6e47ee0d.ChildRounding) 1908 | x.ChildBorderSize = (float32)(x.ref6e47ee0d.ChildBorderSize) 1909 | x.PopupRounding = (float32)(x.ref6e47ee0d.PopupRounding) 1910 | x.PopupBorderSize = (float32)(x.ref6e47ee0d.PopupBorderSize) 1911 | x.FramePadding = *NewVec2Ref(unsafe.Pointer(&x.ref6e47ee0d.FramePadding)) 1912 | x.FrameRounding = (float32)(x.ref6e47ee0d.FrameRounding) 1913 | x.FrameBorderSize = (float32)(x.ref6e47ee0d.FrameBorderSize) 1914 | x.ItemSpacing = *NewVec2Ref(unsafe.Pointer(&x.ref6e47ee0d.ItemSpacing)) 1915 | x.ItemInnerSpacing = *NewVec2Ref(unsafe.Pointer(&x.ref6e47ee0d.ItemInnerSpacing)) 1916 | x.TouchExtraPadding = *NewVec2Ref(unsafe.Pointer(&x.ref6e47ee0d.TouchExtraPadding)) 1917 | x.IndentSpacing = (float32)(x.ref6e47ee0d.IndentSpacing) 1918 | x.ColumnsMinSpacing = (float32)(x.ref6e47ee0d.ColumnsMinSpacing) 1919 | x.ScrollbarSize = (float32)(x.ref6e47ee0d.ScrollbarSize) 1920 | x.ScrollbarRounding = (float32)(x.ref6e47ee0d.ScrollbarRounding) 1921 | x.GrabMinSize = (float32)(x.ref6e47ee0d.GrabMinSize) 1922 | x.GrabRounding = (float32)(x.ref6e47ee0d.GrabRounding) 1923 | x.ButtonTextAlign = *NewVec2Ref(unsafe.Pointer(&x.ref6e47ee0d.ButtonTextAlign)) 1924 | x.DisplayWindowPadding = *NewVec2Ref(unsafe.Pointer(&x.ref6e47ee0d.DisplayWindowPadding)) 1925 | x.DisplaySafeAreaPadding = *NewVec2Ref(unsafe.Pointer(&x.ref6e47ee0d.DisplaySafeAreaPadding)) 1926 | x.AntiAliasedLines = (bool)(x.ref6e47ee0d.AntiAliasedLines) 1927 | x.AntiAliasedFill = (bool)(x.ref6e47ee0d.AntiAliasedFill) 1928 | x.CurveTessellationTol = (float32)(x.ref6e47ee0d.CurveTessellationTol) 1929 | packA43Vec4(&x.Colors, (*[43]C.struct_ImVec4)(unsafe.Pointer(&x.ref6e47ee0d.Colors))) 1930 | } 1931 | 1932 | // allocStructImGuiTextEditCallbackDataMemory allocates memory for type C.struct_ImGuiTextEditCallbackData in C. 1933 | // The caller is responsible for freeing the this memory via C.free. 1934 | func allocStructImGuiTextEditCallbackDataMemory(n int) unsafe.Pointer { 1935 | mem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfStructImGuiTextEditCallbackDataValue)) 1936 | if err != nil { 1937 | panic("memory alloc error: " + err.Error()) 1938 | } 1939 | return mem 1940 | } 1941 | 1942 | const sizeOfStructImGuiTextEditCallbackDataValue = unsafe.Sizeof([1]C.struct_ImGuiTextEditCallbackData{}) 1943 | 1944 | // Ref returns the underlying reference to C object or nil if struct is nil. 1945 | func (x *TextEditCallbackData) Ref() *C.struct_ImGuiTextEditCallbackData { 1946 | if x == nil { 1947 | return nil 1948 | } 1949 | return x.ref61acec8 1950 | } 1951 | 1952 | // Free invokes alloc map's free mechanism that cleanups any allocated memory using C free. 1953 | // Does nothing if struct is nil or has no allocation map. 1954 | func (x *TextEditCallbackData) Free() { 1955 | if x != nil && x.allocs61acec8 != nil { 1956 | x.allocs61acec8.(*cgoAllocMap).Free() 1957 | x.ref61acec8 = nil 1958 | } 1959 | } 1960 | 1961 | // NewTextEditCallbackDataRef creates a new wrapper struct with underlying reference set to the original C object. 1962 | // Returns nil if the provided pointer to C object is nil too. 1963 | func NewTextEditCallbackDataRef(ref unsafe.Pointer) *TextEditCallbackData { 1964 | if ref == nil { 1965 | return nil 1966 | } 1967 | obj := new(TextEditCallbackData) 1968 | obj.ref61acec8 = (*C.struct_ImGuiTextEditCallbackData)(unsafe.Pointer(ref)) 1969 | return obj 1970 | } 1971 | 1972 | // PassRef returns the underlying C object, otherwise it will allocate one and set its values 1973 | // from this wrapping struct, counting allocations into an allocation map. 1974 | func (x *TextEditCallbackData) PassRef() (*C.struct_ImGuiTextEditCallbackData, *cgoAllocMap) { 1975 | if x == nil { 1976 | return nil, nil 1977 | } else if x.ref61acec8 != nil { 1978 | return x.ref61acec8, nil 1979 | } 1980 | mem61acec8 := allocStructImGuiTextEditCallbackDataMemory(1) 1981 | ref61acec8 := (*C.struct_ImGuiTextEditCallbackData)(mem61acec8) 1982 | allocs61acec8 := new(cgoAllocMap) 1983 | allocs61acec8.Add(mem61acec8) 1984 | 1985 | var cEventFlag_allocs *cgoAllocMap 1986 | ref61acec8.EventFlag, cEventFlag_allocs = (C.ImGuiInputTextFlags)(x.EventFlag), cgoAllocsUnknown 1987 | allocs61acec8.Borrow(cEventFlag_allocs) 1988 | 1989 | var cFlags_allocs *cgoAllocMap 1990 | ref61acec8.Flags, cFlags_allocs = (C.ImGuiInputTextFlags)(x.Flags), cgoAllocsUnknown 1991 | allocs61acec8.Borrow(cFlags_allocs) 1992 | 1993 | var cUserData_allocs *cgoAllocMap 1994 | ref61acec8.UserData, cUserData_allocs = *(*unsafe.Pointer)(unsafe.Pointer(&x.UserData)), cgoAllocsUnknown 1995 | allocs61acec8.Borrow(cUserData_allocs) 1996 | 1997 | var cReadOnly_allocs *cgoAllocMap 1998 | ref61acec8.ReadOnly, cReadOnly_allocs = (C._Bool)(x.ReadOnly), cgoAllocsUnknown 1999 | allocs61acec8.Borrow(cReadOnly_allocs) 2000 | 2001 | var cEventChar_allocs *cgoAllocMap 2002 | ref61acec8.EventChar, cEventChar_allocs = (C.ImWchar)(x.EventChar), cgoAllocsUnknown 2003 | allocs61acec8.Borrow(cEventChar_allocs) 2004 | 2005 | var cEventKey_allocs *cgoAllocMap 2006 | ref61acec8.EventKey, cEventKey_allocs = (C.ImGuiKey)(x.EventKey), cgoAllocsUnknown 2007 | allocs61acec8.Borrow(cEventKey_allocs) 2008 | 2009 | var cBuf_allocs *cgoAllocMap 2010 | ref61acec8.Buf, cBuf_allocs = (*C.char)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&x.Buf)).Data)), cgoAllocsUnknown 2011 | allocs61acec8.Borrow(cBuf_allocs) 2012 | 2013 | var cBufTextLen_allocs *cgoAllocMap 2014 | ref61acec8.BufTextLen, cBufTextLen_allocs = (C.int)(x.BufTextLen), cgoAllocsUnknown 2015 | allocs61acec8.Borrow(cBufTextLen_allocs) 2016 | 2017 | var cBufSize_allocs *cgoAllocMap 2018 | ref61acec8.BufSize, cBufSize_allocs = (C.int)(x.BufSize), cgoAllocsUnknown 2019 | allocs61acec8.Borrow(cBufSize_allocs) 2020 | 2021 | var cBufDirty_allocs *cgoAllocMap 2022 | ref61acec8.BufDirty, cBufDirty_allocs = (C._Bool)(x.BufDirty), cgoAllocsUnknown 2023 | allocs61acec8.Borrow(cBufDirty_allocs) 2024 | 2025 | var cCursorPos_allocs *cgoAllocMap 2026 | ref61acec8.CursorPos, cCursorPos_allocs = (C.int)(x.CursorPos), cgoAllocsUnknown 2027 | allocs61acec8.Borrow(cCursorPos_allocs) 2028 | 2029 | var cSelectionStart_allocs *cgoAllocMap 2030 | ref61acec8.SelectionStart, cSelectionStart_allocs = (C.int)(x.SelectionStart), cgoAllocsUnknown 2031 | allocs61acec8.Borrow(cSelectionStart_allocs) 2032 | 2033 | var cSelectionEnd_allocs *cgoAllocMap 2034 | ref61acec8.SelectionEnd, cSelectionEnd_allocs = (C.int)(x.SelectionEnd), cgoAllocsUnknown 2035 | allocs61acec8.Borrow(cSelectionEnd_allocs) 2036 | 2037 | x.ref61acec8 = ref61acec8 2038 | x.allocs61acec8 = allocs61acec8 2039 | return ref61acec8, allocs61acec8 2040 | 2041 | } 2042 | 2043 | // PassValue does the same as PassRef except that it will try to dereference the returned pointer. 2044 | func (x TextEditCallbackData) PassValue() (C.struct_ImGuiTextEditCallbackData, *cgoAllocMap) { 2045 | if x.ref61acec8 != nil { 2046 | return *x.ref61acec8, nil 2047 | } 2048 | ref, allocs := x.PassRef() 2049 | return *ref, allocs 2050 | } 2051 | 2052 | // Deref uses the underlying reference to C object and fills the wrapping struct with values. 2053 | // Do not forget to call this method whether you get a struct for C object and want to read its values. 2054 | func (x *TextEditCallbackData) Deref() { 2055 | if x.ref61acec8 == nil { 2056 | return 2057 | } 2058 | x.EventFlag = (InputTextFlags)(x.ref61acec8.EventFlag) 2059 | x.Flags = (InputTextFlags)(x.ref61acec8.Flags) 2060 | x.UserData = (unsafe.Pointer)(unsafe.Pointer(x.ref61acec8.UserData)) 2061 | x.ReadOnly = (bool)(x.ref61acec8.ReadOnly) 2062 | x.EventChar = (Wchar)(x.ref61acec8.EventChar) 2063 | x.EventKey = (Key)(x.ref61acec8.EventKey) 2064 | hxfa3f05c := (*sliceHeader)(unsafe.Pointer(&x.Buf)) 2065 | hxfa3f05c.Data = uintptr(unsafe.Pointer(x.ref61acec8.Buf)) 2066 | hxfa3f05c.Cap = 0x7fffffff 2067 | // hxfa3f05c.Len = ? 2068 | 2069 | x.BufTextLen = (int32)(x.ref61acec8.BufTextLen) 2070 | x.BufSize = (int32)(x.ref61acec8.BufSize) 2071 | x.BufDirty = (bool)(x.ref61acec8.BufDirty) 2072 | x.CursorPos = (int32)(x.ref61acec8.CursorPos) 2073 | x.SelectionStart = (int32)(x.ref61acec8.SelectionStart) 2074 | x.SelectionEnd = (int32)(x.ref61acec8.SelectionEnd) 2075 | } 2076 | 2077 | // Ref returns a reference to C object as it is. 2078 | func (x *TextFilter) Ref() *C.struct_ImGuiTextFilter { 2079 | if x == nil { 2080 | return nil 2081 | } 2082 | return (*C.struct_ImGuiTextFilter)(unsafe.Pointer(x)) 2083 | } 2084 | 2085 | // Free cleanups the referenced memory using C free. 2086 | func (x *TextFilter) Free() { 2087 | if x != nil { 2088 | C.free(unsafe.Pointer(x)) 2089 | } 2090 | } 2091 | 2092 | // NewTextFilterRef converts the C object reference into a raw struct reference without wrapping. 2093 | func NewTextFilterRef(ref unsafe.Pointer) *TextFilter { 2094 | return (*TextFilter)(ref) 2095 | } 2096 | 2097 | // NewTextFilter allocates a new C object of this type and converts the reference into 2098 | // a raw struct reference without wrapping. 2099 | func NewTextFilter() *TextFilter { 2100 | return (*TextFilter)(allocStructImGuiTextFilterMemory(1)) 2101 | } 2102 | 2103 | // allocStructImGuiTextFilterMemory allocates memory for type C.struct_ImGuiTextFilter in C. 2104 | // The caller is responsible for freeing the this memory via C.free. 2105 | func allocStructImGuiTextFilterMemory(n int) unsafe.Pointer { 2106 | mem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfStructImGuiTextFilterValue)) 2107 | if err != nil { 2108 | panic("memory alloc error: " + err.Error()) 2109 | } 2110 | return mem 2111 | } 2112 | 2113 | const sizeOfStructImGuiTextFilterValue = unsafe.Sizeof([1]C.struct_ImGuiTextFilter{}) 2114 | 2115 | // PassRef returns a reference to C object as it is or allocates a new C object of this type. 2116 | func (x *TextFilter) PassRef() *C.struct_ImGuiTextFilter { 2117 | if x == nil { 2118 | x = (*TextFilter)(allocStructImGuiTextFilterMemory(1)) 2119 | } 2120 | return (*C.struct_ImGuiTextFilter)(unsafe.Pointer(x)) 2121 | } 2122 | 2123 | // allocStructImVec2Memory allocates memory for type C.struct_ImVec2 in C. 2124 | // The caller is responsible for freeing the this memory via C.free. 2125 | func allocStructImVec2Memory(n int) unsafe.Pointer { 2126 | mem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfStructImVec2Value)) 2127 | if err != nil { 2128 | panic("memory alloc error: " + err.Error()) 2129 | } 2130 | return mem 2131 | } 2132 | 2133 | const sizeOfStructImVec2Value = unsafe.Sizeof([1]C.struct_ImVec2{}) 2134 | 2135 | // Ref returns the underlying reference to C object or nil if struct is nil. 2136 | func (x *Vec2) Ref() *C.struct_ImVec2 { 2137 | if x == nil { 2138 | return nil 2139 | } 2140 | return x.ref74e98a33 2141 | } 2142 | 2143 | // Free invokes alloc map's free mechanism that cleanups any allocated memory using C free. 2144 | // Does nothing if struct is nil or has no allocation map. 2145 | func (x *Vec2) Free() { 2146 | if x != nil && x.allocs74e98a33 != nil { 2147 | x.allocs74e98a33.(*cgoAllocMap).Free() 2148 | x.ref74e98a33 = nil 2149 | } 2150 | } 2151 | 2152 | // NewVec2Ref creates a new wrapper struct with underlying reference set to the original C object. 2153 | // Returns nil if the provided pointer to C object is nil too. 2154 | func NewVec2Ref(ref unsafe.Pointer) *Vec2 { 2155 | if ref == nil { 2156 | return nil 2157 | } 2158 | obj := new(Vec2) 2159 | obj.ref74e98a33 = (*C.struct_ImVec2)(unsafe.Pointer(ref)) 2160 | return obj 2161 | } 2162 | 2163 | // PassRef returns the underlying C object, otherwise it will allocate one and set its values 2164 | // from this wrapping struct, counting allocations into an allocation map. 2165 | func (x *Vec2) PassRef() (*C.struct_ImVec2, *cgoAllocMap) { 2166 | if x == nil { 2167 | return nil, nil 2168 | } else if x.ref74e98a33 != nil { 2169 | return x.ref74e98a33, nil 2170 | } 2171 | mem74e98a33 := allocStructImVec2Memory(1) 2172 | ref74e98a33 := (*C.struct_ImVec2)(mem74e98a33) 2173 | allocs74e98a33 := new(cgoAllocMap) 2174 | allocs74e98a33.Add(mem74e98a33) 2175 | 2176 | var cx_allocs *cgoAllocMap 2177 | ref74e98a33.x, cx_allocs = (C.float)(x.X), cgoAllocsUnknown 2178 | allocs74e98a33.Borrow(cx_allocs) 2179 | 2180 | var cy_allocs *cgoAllocMap 2181 | ref74e98a33.y, cy_allocs = (C.float)(x.Y), cgoAllocsUnknown 2182 | allocs74e98a33.Borrow(cy_allocs) 2183 | 2184 | x.ref74e98a33 = ref74e98a33 2185 | x.allocs74e98a33 = allocs74e98a33 2186 | return ref74e98a33, allocs74e98a33 2187 | 2188 | } 2189 | 2190 | // PassValue does the same as PassRef except that it will try to dereference the returned pointer. 2191 | func (x Vec2) PassValue() (C.struct_ImVec2, *cgoAllocMap) { 2192 | if x.ref74e98a33 != nil { 2193 | return *x.ref74e98a33, nil 2194 | } 2195 | ref, allocs := x.PassRef() 2196 | return *ref, allocs 2197 | } 2198 | 2199 | // Deref uses the underlying reference to C object and fills the wrapping struct with values. 2200 | // Do not forget to call this method whether you get a struct for C object and want to read its values. 2201 | func (x *Vec2) Deref() { 2202 | if x.ref74e98a33 == nil { 2203 | return 2204 | } 2205 | x.X = (float32)(x.ref74e98a33.x) 2206 | x.Y = (float32)(x.ref74e98a33.y) 2207 | } 2208 | 2209 | // allocStructImVec4Memory allocates memory for type C.struct_ImVec4 in C. 2210 | // The caller is responsible for freeing the this memory via C.free. 2211 | func allocStructImVec4Memory(n int) unsafe.Pointer { 2212 | mem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfStructImVec4Value)) 2213 | if err != nil { 2214 | panic("memory alloc error: " + err.Error()) 2215 | } 2216 | return mem 2217 | } 2218 | 2219 | const sizeOfStructImVec4Value = unsafe.Sizeof([1]C.struct_ImVec4{}) 2220 | 2221 | // Ref returns the underlying reference to C object or nil if struct is nil. 2222 | func (x *Vec4) Ref() *C.struct_ImVec4 { 2223 | if x == nil { 2224 | return nil 2225 | } 2226 | return x.ref9d8a2f06 2227 | } 2228 | 2229 | // Free invokes alloc map's free mechanism that cleanups any allocated memory using C free. 2230 | // Does nothing if struct is nil or has no allocation map. 2231 | func (x *Vec4) Free() { 2232 | if x != nil && x.allocs9d8a2f06 != nil { 2233 | x.allocs9d8a2f06.(*cgoAllocMap).Free() 2234 | x.ref9d8a2f06 = nil 2235 | } 2236 | } 2237 | 2238 | // NewVec4Ref creates a new wrapper struct with underlying reference set to the original C object. 2239 | // Returns nil if the provided pointer to C object is nil too. 2240 | func NewVec4Ref(ref unsafe.Pointer) *Vec4 { 2241 | if ref == nil { 2242 | return nil 2243 | } 2244 | obj := new(Vec4) 2245 | obj.ref9d8a2f06 = (*C.struct_ImVec4)(unsafe.Pointer(ref)) 2246 | return obj 2247 | } 2248 | 2249 | // PassRef returns the underlying C object, otherwise it will allocate one and set its values 2250 | // from this wrapping struct, counting allocations into an allocation map. 2251 | func (x *Vec4) PassRef() (*C.struct_ImVec4, *cgoAllocMap) { 2252 | if x == nil { 2253 | return nil, nil 2254 | } else if x.ref9d8a2f06 != nil { 2255 | return x.ref9d8a2f06, nil 2256 | } 2257 | mem9d8a2f06 := allocStructImVec4Memory(1) 2258 | ref9d8a2f06 := (*C.struct_ImVec4)(mem9d8a2f06) 2259 | allocs9d8a2f06 := new(cgoAllocMap) 2260 | allocs9d8a2f06.Add(mem9d8a2f06) 2261 | 2262 | var cx_allocs *cgoAllocMap 2263 | ref9d8a2f06.x, cx_allocs = (C.float)(x.X), cgoAllocsUnknown 2264 | allocs9d8a2f06.Borrow(cx_allocs) 2265 | 2266 | var cy_allocs *cgoAllocMap 2267 | ref9d8a2f06.y, cy_allocs = (C.float)(x.Y), cgoAllocsUnknown 2268 | allocs9d8a2f06.Borrow(cy_allocs) 2269 | 2270 | var cz_allocs *cgoAllocMap 2271 | ref9d8a2f06.z, cz_allocs = (C.float)(x.Z), cgoAllocsUnknown 2272 | allocs9d8a2f06.Borrow(cz_allocs) 2273 | 2274 | var cw_allocs *cgoAllocMap 2275 | ref9d8a2f06.w, cw_allocs = (C.float)(x.W), cgoAllocsUnknown 2276 | allocs9d8a2f06.Borrow(cw_allocs) 2277 | 2278 | x.ref9d8a2f06 = ref9d8a2f06 2279 | x.allocs9d8a2f06 = allocs9d8a2f06 2280 | return ref9d8a2f06, allocs9d8a2f06 2281 | 2282 | } 2283 | 2284 | // PassValue does the same as PassRef except that it will try to dereference the returned pointer. 2285 | func (x Vec4) PassValue() (C.struct_ImVec4, *cgoAllocMap) { 2286 | if x.ref9d8a2f06 != nil { 2287 | return *x.ref9d8a2f06, nil 2288 | } 2289 | ref, allocs := x.PassRef() 2290 | return *ref, allocs 2291 | } 2292 | 2293 | // Deref uses the underlying reference to C object and fills the wrapping struct with values. 2294 | // Do not forget to call this method whether you get a struct for C object and want to read its values. 2295 | func (x *Vec4) Deref() { 2296 | if x.ref9d8a2f06 == nil { 2297 | return 2298 | } 2299 | x.X = (float32)(x.ref9d8a2f06.x) 2300 | x.Y = (float32)(x.ref9d8a2f06.y) 2301 | x.Z = (float32)(x.ref9d8a2f06.z) 2302 | x.W = (float32)(x.ref9d8a2f06.w) 2303 | } 2304 | 2305 | // allocPCharMemory allocates memory for type *C.char in C. 2306 | // The caller is responsible for freeing the this memory via C.free. 2307 | func allocPCharMemory(n int) unsafe.Pointer { 2308 | mem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfPCharValue)) 2309 | if err != nil { 2310 | panic("memory alloc error: " + err.Error()) 2311 | } 2312 | return mem 2313 | } 2314 | 2315 | const sizeOfPCharValue = unsafe.Sizeof([1]*C.char{}) 2316 | 2317 | // unpackArgSString transforms a sliced Go data structure into plain C format. 2318 | func unpackArgSString(x []string) (unpacked **C.char, allocs *cgoAllocMap) { 2319 | if x == nil { 2320 | return nil, nil 2321 | } 2322 | allocs = new(cgoAllocMap) 2323 | defer runtime.SetFinalizer(&unpacked, func(***C.char) { 2324 | go allocs.Free() 2325 | }) 2326 | 2327 | len0 := len(x) 2328 | mem0 := allocPCharMemory(len0) 2329 | allocs.Add(mem0) 2330 | h0 := &sliceHeader{ 2331 | Data: uintptr(mem0), 2332 | Cap: len0, 2333 | Len: len0, 2334 | } 2335 | v0 := *(*[]*C.char)(unsafe.Pointer(h0)) 2336 | for i0 := range x { 2337 | v0[i0], _ = unpackPCharString(x[i0]) 2338 | } 2339 | h := (*sliceHeader)(unsafe.Pointer(&v0)) 2340 | unpacked = (**C.char)(unsafe.Pointer(h.Data)) 2341 | return 2342 | } 2343 | 2344 | // packSString reads sliced Go data structure out from plain C format. 2345 | func packSString(v []string, ptr0 **C.char) { 2346 | const m = 0x7fffffff 2347 | for i0 := range v { 2348 | ptr1 := (*(*[m / sizeOfPtr]*C.char)(unsafe.Pointer(ptr0)))[i0] 2349 | v[i0] = packPCharString(ptr1) 2350 | } 2351 | } 2352 | 2353 | // unpackArgSStyle transforms a sliced Go data structure into plain C format. 2354 | func unpackArgSStyle(x []Style) (unpacked *C.struct_ImGuiStyle, allocs *cgoAllocMap) { 2355 | if x == nil { 2356 | return nil, nil 2357 | } 2358 | allocs = new(cgoAllocMap) 2359 | defer runtime.SetFinalizer(&unpacked, func(**C.struct_ImGuiStyle) { 2360 | go allocs.Free() 2361 | }) 2362 | 2363 | len0 := len(x) 2364 | mem0 := allocStructImGuiStyleMemory(len0) 2365 | allocs.Add(mem0) 2366 | h0 := &sliceHeader{ 2367 | Data: uintptr(mem0), 2368 | Cap: len0, 2369 | Len: len0, 2370 | } 2371 | v0 := *(*[]C.struct_ImGuiStyle)(unsafe.Pointer(h0)) 2372 | for i0 := range x { 2373 | allocs0 := new(cgoAllocMap) 2374 | v0[i0], allocs0 = x[i0].PassValue() 2375 | allocs.Borrow(allocs0) 2376 | } 2377 | h := (*sliceHeader)(unsafe.Pointer(&v0)) 2378 | unpacked = (*C.struct_ImGuiStyle)(unsafe.Pointer(h.Data)) 2379 | return 2380 | } 2381 | 2382 | // packSStyle reads sliced Go data structure out from plain C format. 2383 | func packSStyle(v []Style, ptr0 *C.struct_ImGuiStyle) { 2384 | const m = 0x7fffffff 2385 | for i0 := range v { 2386 | ptr1 := (*(*[m / sizeOfStructImGuiStyleValue]C.struct_ImGuiStyle)(unsafe.Pointer(ptr0)))[i0] 2387 | v[i0] = *NewStyleRef(unsafe.Pointer(&ptr1)) 2388 | } 2389 | } 2390 | 2391 | // unpackArgSVec2 transforms a sliced Go data structure into plain C format. 2392 | func unpackArgSVec2(x []Vec2) (unpacked *C.struct_ImVec2, allocs *cgoAllocMap) { 2393 | if x == nil { 2394 | return nil, nil 2395 | } 2396 | allocs = new(cgoAllocMap) 2397 | defer runtime.SetFinalizer(&unpacked, func(**C.struct_ImVec2) { 2398 | go allocs.Free() 2399 | }) 2400 | 2401 | len0 := len(x) 2402 | mem0 := allocStructImVec2Memory(len0) 2403 | allocs.Add(mem0) 2404 | h0 := &sliceHeader{ 2405 | Data: uintptr(mem0), 2406 | Cap: len0, 2407 | Len: len0, 2408 | } 2409 | v0 := *(*[]C.struct_ImVec2)(unsafe.Pointer(h0)) 2410 | for i0 := range x { 2411 | allocs0 := new(cgoAllocMap) 2412 | v0[i0], allocs0 = x[i0].PassValue() 2413 | allocs.Borrow(allocs0) 2414 | } 2415 | h := (*sliceHeader)(unsafe.Pointer(&v0)) 2416 | unpacked = (*C.struct_ImVec2)(unsafe.Pointer(h.Data)) 2417 | return 2418 | } 2419 | 2420 | // packSVec2 reads sliced Go data structure out from plain C format. 2421 | func packSVec2(v []Vec2, ptr0 *C.struct_ImVec2) { 2422 | const m = 0x7fffffff 2423 | for i0 := range v { 2424 | ptr1 := (*(*[m / sizeOfStructImVec2Value]C.struct_ImVec2)(unsafe.Pointer(ptr0)))[i0] 2425 | v[i0] = *NewVec2Ref(unsafe.Pointer(&ptr1)) 2426 | } 2427 | } 2428 | 2429 | // unpackArgSVec4 transforms a sliced Go data structure into plain C format. 2430 | func unpackArgSVec4(x []Vec4) (unpacked *C.struct_ImVec4, allocs *cgoAllocMap) { 2431 | if x == nil { 2432 | return nil, nil 2433 | } 2434 | allocs = new(cgoAllocMap) 2435 | defer runtime.SetFinalizer(&unpacked, func(**C.struct_ImVec4) { 2436 | go allocs.Free() 2437 | }) 2438 | 2439 | len0 := len(x) 2440 | mem0 := allocStructImVec4Memory(len0) 2441 | allocs.Add(mem0) 2442 | h0 := &sliceHeader{ 2443 | Data: uintptr(mem0), 2444 | Cap: len0, 2445 | Len: len0, 2446 | } 2447 | v0 := *(*[]C.struct_ImVec4)(unsafe.Pointer(h0)) 2448 | for i0 := range x { 2449 | allocs0 := new(cgoAllocMap) 2450 | v0[i0], allocs0 = x[i0].PassValue() 2451 | allocs.Borrow(allocs0) 2452 | } 2453 | h := (*sliceHeader)(unsafe.Pointer(&v0)) 2454 | unpacked = (*C.struct_ImVec4)(unsafe.Pointer(h.Data)) 2455 | return 2456 | } 2457 | 2458 | // packSVec4 reads sliced Go data structure out from plain C format. 2459 | func packSVec4(v []Vec4, ptr0 *C.struct_ImVec4) { 2460 | const m = 0x7fffffff 2461 | for i0 := range v { 2462 | ptr1 := (*(*[m / sizeOfStructImVec4Value]C.struct_ImVec4)(unsafe.Pointer(ptr0)))[i0] 2463 | v[i0] = *NewVec4Ref(unsafe.Pointer(&ptr1)) 2464 | } 2465 | } 2466 | 2467 | // unpackArgSFontConfig transforms a sliced Go data structure into plain C format. 2468 | func unpackArgSFontConfig(x []FontConfig) (unpacked *C.struct_ImFontConfig, allocs *cgoAllocMap) { 2469 | if x == nil { 2470 | return nil, nil 2471 | } 2472 | allocs = new(cgoAllocMap) 2473 | defer runtime.SetFinalizer(&unpacked, func(**C.struct_ImFontConfig) { 2474 | go allocs.Free() 2475 | }) 2476 | 2477 | len0 := len(x) 2478 | mem0 := allocStructImFontConfigMemory(len0) 2479 | allocs.Add(mem0) 2480 | h0 := &sliceHeader{ 2481 | Data: uintptr(mem0), 2482 | Cap: len0, 2483 | Len: len0, 2484 | } 2485 | v0 := *(*[]C.struct_ImFontConfig)(unsafe.Pointer(h0)) 2486 | for i0 := range x { 2487 | allocs0 := new(cgoAllocMap) 2488 | v0[i0], allocs0 = x[i0].PassValue() 2489 | allocs.Borrow(allocs0) 2490 | } 2491 | h := (*sliceHeader)(unsafe.Pointer(&v0)) 2492 | unpacked = (*C.struct_ImFontConfig)(unsafe.Pointer(h.Data)) 2493 | return 2494 | } 2495 | 2496 | // packSFontConfig reads sliced Go data structure out from plain C format. 2497 | func packSFontConfig(v []FontConfig, ptr0 *C.struct_ImFontConfig) { 2498 | const m = 0x7fffffff 2499 | for i0 := range v { 2500 | ptr1 := (*(*[m / sizeOfStructImFontConfigValue]C.struct_ImFontConfig)(unsafe.Pointer(ptr0)))[i0] 2501 | v[i0] = *NewFontConfigRef(unsafe.Pointer(&ptr1)) 2502 | } 2503 | } 2504 | 2505 | // unpackArgSListClipper transforms a sliced Go data structure into plain C format. 2506 | func unpackArgSListClipper(x []ListClipper) (unpacked *C.struct_ImGuiListClipper, allocs *cgoAllocMap) { 2507 | if x == nil { 2508 | return nil, nil 2509 | } 2510 | allocs = new(cgoAllocMap) 2511 | defer runtime.SetFinalizer(&unpacked, func(**C.struct_ImGuiListClipper) { 2512 | go allocs.Free() 2513 | }) 2514 | 2515 | len0 := len(x) 2516 | mem0 := allocStructImGuiListClipperMemory(len0) 2517 | allocs.Add(mem0) 2518 | h0 := &sliceHeader{ 2519 | Data: uintptr(mem0), 2520 | Cap: len0, 2521 | Len: len0, 2522 | } 2523 | v0 := *(*[]C.struct_ImGuiListClipper)(unsafe.Pointer(h0)) 2524 | for i0 := range x { 2525 | allocs0 := new(cgoAllocMap) 2526 | v0[i0], allocs0 = x[i0].PassValue() 2527 | allocs.Borrow(allocs0) 2528 | } 2529 | h := (*sliceHeader)(unsafe.Pointer(&v0)) 2530 | unpacked = (*C.struct_ImGuiListClipper)(unsafe.Pointer(h.Data)) 2531 | return 2532 | } 2533 | 2534 | // packSListClipper reads sliced Go data structure out from plain C format. 2535 | func packSListClipper(v []ListClipper, ptr0 *C.struct_ImGuiListClipper) { 2536 | const m = 0x7fffffff 2537 | for i0 := range v { 2538 | ptr1 := (*(*[m / sizeOfStructImGuiListClipperValue]C.struct_ImGuiListClipper)(unsafe.Pointer(ptr0)))[i0] 2539 | v[i0] = *NewListClipperRef(unsafe.Pointer(&ptr1)) 2540 | } 2541 | } 2542 | 2543 | // unpackArgSDrawData transforms a sliced Go data structure into plain C format. 2544 | func unpackArgSDrawData(x []DrawData) (unpacked *C.struct_ImDrawData, allocs *cgoAllocMap) { 2545 | if x == nil { 2546 | return nil, nil 2547 | } 2548 | allocs = new(cgoAllocMap) 2549 | defer runtime.SetFinalizer(&unpacked, func(**C.struct_ImDrawData) { 2550 | go allocs.Free() 2551 | }) 2552 | 2553 | len0 := len(x) 2554 | mem0 := allocStructImDrawDataMemory(len0) 2555 | allocs.Add(mem0) 2556 | h0 := &sliceHeader{ 2557 | Data: uintptr(mem0), 2558 | Cap: len0, 2559 | Len: len0, 2560 | } 2561 | v0 := *(*[]C.struct_ImDrawData)(unsafe.Pointer(h0)) 2562 | for i0 := range x { 2563 | allocs0 := new(cgoAllocMap) 2564 | v0[i0], allocs0 = x[i0].PassValue() 2565 | allocs.Borrow(allocs0) 2566 | } 2567 | h := (*sliceHeader)(unsafe.Pointer(&v0)) 2568 | unpacked = (*C.struct_ImDrawData)(unsafe.Pointer(h.Data)) 2569 | return 2570 | } 2571 | 2572 | // packSDrawData reads sliced Go data structure out from plain C format. 2573 | func packSDrawData(v []DrawData, ptr0 *C.struct_ImDrawData) { 2574 | const m = 0x7fffffff 2575 | for i0 := range v { 2576 | ptr1 := (*(*[m / sizeOfStructImDrawDataValue]C.struct_ImDrawData)(unsafe.Pointer(ptr0)))[i0] 2577 | v[i0] = *NewDrawDataRef(unsafe.Pointer(&ptr1)) 2578 | } 2579 | } 2580 | 2581 | // allocPUcharMemory allocates memory for type *C.uchar in C. 2582 | // The caller is responsible for freeing the this memory via C.free. 2583 | func allocPUcharMemory(n int) unsafe.Pointer { 2584 | mem, err := C.calloc(C.size_t(n), (C.size_t)(sizeOfPUcharValue)) 2585 | if err != nil { 2586 | panic("memory alloc error: " + err.Error()) 2587 | } 2588 | return mem 2589 | } 2590 | 2591 | const sizeOfPUcharValue = unsafe.Sizeof([1]*C.uchar{}) 2592 | 2593 | // unpackArgSSByte transforms a sliced Go data structure into plain C format. 2594 | func unpackArgSSByte(x [][]byte) (unpacked **C.uchar, allocs *cgoAllocMap) { 2595 | if x == nil { 2596 | return nil, nil 2597 | } 2598 | allocs = new(cgoAllocMap) 2599 | defer runtime.SetFinalizer(&unpacked, func(***C.uchar) { 2600 | go allocs.Free() 2601 | }) 2602 | 2603 | len0 := len(x) 2604 | mem0 := allocPUcharMemory(len0) 2605 | allocs.Add(mem0) 2606 | h0 := &sliceHeader{ 2607 | Data: uintptr(mem0), 2608 | Cap: len0, 2609 | Len: len0, 2610 | } 2611 | v0 := *(*[]*C.uchar)(unsafe.Pointer(h0)) 2612 | for i0 := range x { 2613 | h := (*sliceHeader)(unsafe.Pointer(&x[i0])) 2614 | v0[i0] = (*C.uchar)(unsafe.Pointer(h.Data)) 2615 | } 2616 | h := (*sliceHeader)(unsafe.Pointer(&v0)) 2617 | unpacked = (**C.uchar)(unsafe.Pointer(h.Data)) 2618 | return 2619 | } 2620 | 2621 | // packSSByte reads sliced Go data structure out from plain C format. 2622 | func packSSByte(v [][]byte, ptr0 **C.uchar) { 2623 | const m = 0x7fffffff 2624 | for i0 := range v { 2625 | ptr1 := (*(*[m / sizeOfPtr]*C.uchar)(unsafe.Pointer(ptr0)))[i0] 2626 | hxf0d18b7 := (*sliceHeader)(unsafe.Pointer(&v[i0])) 2627 | hxf0d18b7.Data = uintptr(unsafe.Pointer(ptr1)) 2628 | hxf0d18b7.Cap = 0x7fffffff 2629 | // hxf0d18b7.Len = ? 2630 | } 2631 | } 2632 | --------------------------------------------------------------------------------