forked from AllenDang/cimgui-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cimgui_structs.go
4234 lines (3495 loc) · 154 KB
/
cimgui_structs.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Code generated by cmd/codegen from https://github.com/AllenDang/cimgui-go.
// DO NOT EDIT.
package imgui
// #include <stdlib.h>
// #include <memory.h>
// #include "extra_types.h"
// #include "cimgui_wrapper.h"
import "C"
import "unsafe"
// Helper: ImBitVector
// Store 1-bit per value.
type BitVector struct {
FieldStorage Vector[*uint32]
}
func (self BitVector) handle() (result *C.ImBitVector, releaseFn func()) {
result = new(C.ImBitVector)
FieldStorage := self.FieldStorage
FieldStorageData := FieldStorage.Data
FieldStorageDataArg, FieldStorageDataFin := WrapNumberPtr[C.ImU32, uint32](FieldStorageData)
FieldStorageVecArg := new(C.ImVector_ImU32)
FieldStorageVecArg.Size = C.int(FieldStorage.Size)
FieldStorageVecArg.Capacity = C.int(FieldStorage.Capacity)
FieldStorageVecArg.Data = FieldStorageDataArg
FieldStorage.pinner.Pin(FieldStorageVecArg.Data)
result.Storage = *FieldStorageVecArg
releaseFn = func() {
FieldStorageDataFin()
FieldStorage.pinner.Unpin()
}
return result, releaseFn
}
func (self BitVector) c() (result C.ImBitVector, fin func()) {
resultPtr, finFn := self.handle()
return *resultPtr, finFn
}
func newBitVectorFromC(cvalue *C.ImBitVector) *BitVector {
result := new(BitVector)
result.FieldStorage = newVectorFromC(cvalue.Storage.Size, cvalue.Storage.Capacity, (*uint32)(cvalue.Storage.Data))
return result
}
// [Internal] For use by ImDrawListSplitter
type DrawChannel struct {
FieldCmdBuffer Vector[*DrawCmd]
FieldIdxBuffer Vector[*DrawIdx]
}
func (self DrawChannel) handle() (result *C.ImDrawChannel, releaseFn func()) {
result = new(C.ImDrawChannel)
FieldCmdBuffer := self.FieldCmdBuffer
FieldCmdBufferData := FieldCmdBuffer.Data
FieldCmdBufferDataArg, FieldCmdBufferDataFin := FieldCmdBufferData.handle()
FieldCmdBufferVecArg := new(C.ImVector_ImDrawCmd)
FieldCmdBufferVecArg.Size = C.int(FieldCmdBuffer.Size)
FieldCmdBufferVecArg.Capacity = C.int(FieldCmdBuffer.Capacity)
FieldCmdBufferVecArg.Data = FieldCmdBufferDataArg
FieldCmdBuffer.pinner.Pin(FieldCmdBufferVecArg.Data)
result._CmdBuffer = *FieldCmdBufferVecArg
FieldIdxBuffer := self.FieldIdxBuffer
FieldIdxBufferData := FieldIdxBuffer.Data
FieldIdxBufferDataArg, FieldIdxBufferDataFin := WrapNumberPtr[C.ImDrawIdx, DrawIdx](FieldIdxBufferData)
FieldIdxBufferVecArg := new(C.ImVector_ImDrawIdx)
FieldIdxBufferVecArg.Size = C.int(FieldIdxBuffer.Size)
FieldIdxBufferVecArg.Capacity = C.int(FieldIdxBuffer.Capacity)
FieldIdxBufferVecArg.Data = FieldIdxBufferDataArg
FieldIdxBuffer.pinner.Pin(FieldIdxBufferVecArg.Data)
result._IdxBuffer = *FieldIdxBufferVecArg
releaseFn = func() {
FieldCmdBufferDataFin()
FieldCmdBuffer.pinner.Unpin()
FieldIdxBufferDataFin()
FieldIdxBuffer.pinner.Unpin()
}
return result, releaseFn
}
func (self DrawChannel) c() (result C.ImDrawChannel, fin func()) {
resultPtr, finFn := self.handle()
return *resultPtr, finFn
}
func newDrawChannelFromC(cvalue *C.ImDrawChannel) *DrawChannel {
result := new(DrawChannel)
result.FieldCmdBuffer = newVectorFromC(cvalue._CmdBuffer.Size, cvalue._CmdBuffer.Capacity, newDrawCmdFromC(cvalue._CmdBuffer.Data))
result.FieldIdxBuffer = newVectorFromC(cvalue._IdxBuffer.Size, cvalue._IdxBuffer.Capacity, (*DrawIdx)(cvalue._IdxBuffer.Data))
return result
}
// Typically, 1 command = 1 GPU draw call (unless command is a callback)
// - VtxOffset: When 'io.BackendFlags & ImGuiBackendFlags_RendererHasVtxOffset' is enabled,
// this fields allow us to render meshes larger than 64K vertices while keeping 16-bit indices.
// Backends made for <1.71. will typically ignore the VtxOffset fields.
// - The ClipRect/TextureId/VtxOffset fields must be contiguous as we memcmp() them together (this is asserted for).
type DrawCmd struct {
// TODO: contains unsupported fields
data unsafe.Pointer
}
func (self DrawCmd) handle() (result *C.ImDrawCmd, releaseFn func()) {
result = (*C.ImDrawCmd)(self.data)
return result, func() {}
}
func (self DrawCmd) c() (result C.ImDrawCmd, fin func()) {
resultPtr, finFn := self.handle()
return *resultPtr, finFn
}
func newDrawCmdFromC(cvalue *C.ImDrawCmd) *DrawCmd {
result := new(DrawCmd)
result.data = unsafe.Pointer(cvalue)
return result
}
// [Internal] For use by ImDrawList
type DrawCmdHeader struct {
FieldClipRect Vec4
FieldTextureId TextureID
FieldVtxOffset uint32
}
func (self DrawCmdHeader) handle() (result *C.ImDrawCmdHeader, releaseFn func()) {
result = new(C.ImDrawCmdHeader)
FieldClipRect := self.FieldClipRect
result.ClipRect = FieldClipRect.toC()
FieldTextureId := self.FieldTextureId
result.TextureId = C.ImTextureID(FieldTextureId)
FieldVtxOffset := self.FieldVtxOffset
result.VtxOffset = C.uint(FieldVtxOffset)
releaseFn = func() {
}
return result, releaseFn
}
func (self DrawCmdHeader) c() (result C.ImDrawCmdHeader, fin func()) {
resultPtr, finFn := self.handle()
return *resultPtr, finFn
}
func newDrawCmdHeaderFromC(cvalue *C.ImDrawCmdHeader) *DrawCmdHeader {
result := new(DrawCmdHeader)
result.FieldClipRect = *(&Vec4{}).fromC(cvalue.ClipRect)
result.FieldTextureId = TextureID(cvalue.TextureId)
result.FieldVtxOffset = uint32(cvalue.VtxOffset)
return result
}
// All draw data to render a Dear ImGui frame
// (NB: the style and the naming convention here is a little inconsistent, we currently preserve them for backward compatibility purpose,
// as this is one of the oldest structure exposed by the library! Basically, ImDrawList == CmdList)
type DrawData struct {
// TODO: contains unsupported fields
data unsafe.Pointer
}
func (self DrawData) handle() (result *C.ImDrawData, releaseFn func()) {
result = (*C.ImDrawData)(self.data)
return result, func() {}
}
func (self DrawData) c() (result C.ImDrawData, fin func()) {
resultPtr, finFn := self.handle()
return *resultPtr, finFn
}
func newDrawDataFromC(cvalue *C.ImDrawData) *DrawData {
result := new(DrawData)
result.data = unsafe.Pointer(cvalue)
return result
}
type DrawDataBuilder struct {
// TODO: contains unsupported fields
data unsafe.Pointer
}
func (self DrawDataBuilder) handle() (result *C.ImDrawDataBuilder, releaseFn func()) {
result = (*C.ImDrawDataBuilder)(self.data)
return result, func() {}
}
func (self DrawDataBuilder) c() (result C.ImDrawDataBuilder, fin func()) {
resultPtr, finFn := self.handle()
return *resultPtr, finFn
}
func newDrawDataBuilderFromC(cvalue *C.ImDrawDataBuilder) *DrawDataBuilder {
result := new(DrawDataBuilder)
result.data = unsafe.Pointer(cvalue)
return result
}
// Draw command list
// This is the low-level list of polygons that ImGui:: functions are filling. At the end of the frame,
// all command lists are passed to your ImGuiIO::RenderDrawListFn function for rendering.
// Each dear imgui window contains its own ImDrawList. You can use ImGui::GetWindowDrawList() to
// access the current window draw list and draw custom primitives.
// You can interleave normal ImGui:: calls and adding primitives to the current draw list.
// In single viewport mode, top-left is == GetMainViewport()->Pos (generally 0,0), bottom-right is == GetMainViewport()->Pos+Size (generally io.DisplaySize).
// You are totally free to apply whatever transformation matrix to want to the data (depending on the use of the transformation you may want to apply it to ClipRect as well!)
// Important: Primitives are always added to the list and not culled (culling is done at higher-level by ImGui:: functions), if you use this API a lot consider coarse culling your drawn objects.
type DrawList struct {
// TODO: contains unsupported fields
data unsafe.Pointer
}
func (self DrawList) handle() (result *C.ImDrawList, releaseFn func()) {
result = (*C.ImDrawList)(self.data)
return result, func() {}
}
func (self DrawList) c() (result C.ImDrawList, fin func()) {
resultPtr, finFn := self.handle()
return *resultPtr, finFn
}
func newDrawListFromC(cvalue *C.ImDrawList) *DrawList {
result := new(DrawList)
result.data = unsafe.Pointer(cvalue)
return result
}
// Data shared between all ImDrawList instances
// You may want to create your own instance of this if you want to use ImDrawList completely without ImGui. In that case, watch out for future changes to this structure.
type DrawListSharedData struct {
// TODO: contains unsupported fields
data unsafe.Pointer
}
func (self DrawListSharedData) handle() (result *C.ImDrawListSharedData, releaseFn func()) {
result = (*C.ImDrawListSharedData)(self.data)
return result, func() {}
}
func (self DrawListSharedData) c() (result C.ImDrawListSharedData, fin func()) {
resultPtr, finFn := self.handle()
return *resultPtr, finFn
}
func newDrawListSharedDataFromC(cvalue *C.ImDrawListSharedData) *DrawListSharedData {
result := new(DrawListSharedData)
result.data = unsafe.Pointer(cvalue)
return result
}
// Split/Merge functions are used to split the draw list into different layers which can be drawn into out of order.
// This is used by the Columns/Tables API, so items of each column can be batched together in a same draw call.
type DrawListSplitter struct {
FieldCurrent int32 // Current channel number (0)
FieldCount int32 // Number of active channels (1+)
FieldChannels Vector[*DrawChannel] // Draw channels (not resized down so _Count might be < Channels.Size)
}
func (self DrawListSplitter) handle() (result *C.ImDrawListSplitter, releaseFn func()) {
result = new(C.ImDrawListSplitter)
FieldCurrent := self.FieldCurrent
result._Current = C.int(FieldCurrent)
FieldCount := self.FieldCount
result._Count = C.int(FieldCount)
FieldChannels := self.FieldChannels
FieldChannelsData := FieldChannels.Data
FieldChannelsDataArg, FieldChannelsDataFin := FieldChannelsData.handle()
FieldChannelsVecArg := new(C.ImVector_ImDrawChannel)
FieldChannelsVecArg.Size = C.int(FieldChannels.Size)
FieldChannelsVecArg.Capacity = C.int(FieldChannels.Capacity)
FieldChannelsVecArg.Data = FieldChannelsDataArg
FieldChannels.pinner.Pin(FieldChannelsVecArg.Data)
result._Channels = *FieldChannelsVecArg
releaseFn = func() {
FieldChannelsDataFin()
FieldChannels.pinner.Unpin()
}
return result, releaseFn
}
func (self DrawListSplitter) c() (result C.ImDrawListSplitter, fin func()) {
resultPtr, finFn := self.handle()
return *resultPtr, finFn
}
func newDrawListSplitterFromC(cvalue *C.ImDrawListSplitter) *DrawListSplitter {
result := new(DrawListSplitter)
result.FieldCurrent = int32(cvalue._Current)
result.FieldCount = int32(cvalue._Count)
result.FieldChannels = newVectorFromC(cvalue._Channels.Size, cvalue._Channels.Capacity, newDrawChannelFromC(cvalue._Channels.Data))
return result
}
type DrawVert struct {
FieldPos Vec2
FieldUv Vec2
FieldCol uint32
}
func (self DrawVert) handle() (result *C.ImDrawVert, releaseFn func()) {
result = new(C.ImDrawVert)
FieldPos := self.FieldPos
result.pos = FieldPos.toC()
FieldUv := self.FieldUv
result.uv = FieldUv.toC()
FieldCol := self.FieldCol
result.col = C.ImU32(FieldCol)
releaseFn = func() {
}
return result, releaseFn
}
func (self DrawVert) c() (result C.ImDrawVert, fin func()) {
resultPtr, finFn := self.handle()
return *resultPtr, finFn
}
func newDrawVertFromC(cvalue *C.ImDrawVert) *DrawVert {
result := new(DrawVert)
result.FieldPos = *(&Vec2{}).fromC(cvalue.pos)
result.FieldUv = *(&Vec2{}).fromC(cvalue.uv)
result.FieldCol = uint32(cvalue.col)
return result
}
// Font runtime data and rendering
// ImFontAtlas automatically loads a default embedded font for you when you call GetTexDataAsAlpha8() or GetTexDataAsRGBA32().
type Font struct {
// TODO: contains unsupported fields
data unsafe.Pointer
}
func (self Font) handle() (result *C.ImFont, releaseFn func()) {
result = (*C.ImFont)(self.data)
return result, func() {}
}
func (self Font) c() (result C.ImFont, fin func()) {
resultPtr, finFn := self.handle()
return *resultPtr, finFn
}
func newFontFromC(cvalue *C.ImFont) *Font {
result := new(Font)
result.data = unsafe.Pointer(cvalue)
return result
}
// Load and rasterize multiple TTF/OTF fonts into a same texture. The font atlas will build a single texture holding:
// - One or more fonts.
// - Custom graphics data needed to render the shapes needed by Dear ImGui.
// - Mouse cursor shapes for software cursor rendering (unless setting 'Flags |= ImFontAtlasFlags_NoMouseCursors' in the font atlas).
//
// It is the user-code responsibility to setup/build the atlas, then upload the pixel data into a texture accessible by your graphics api.
// - Optionally, call any of the AddFont*** functions. If you don't call any, the default font embedded in the code will be loaded for you.
// - Call GetTexDataAsAlpha8() or GetTexDataAsRGBA32() to build and retrieve pixels data.
// - Upload the pixels data into a texture within your graphics system (see imgui_impl_xxxx.cpp examples)
// - Call SetTexID(my_tex_id); and pass the pointer/identifier to your texture in a format natural to your graphics API.
// This value will be passed back to you during rendering to identify the texture. Read FAQ entry about ImTextureID for more details.
//
// Common pitfalls:
// - If you pass a 'glyph_ranges' array to AddFont*** functions, you need to make sure that your array persist up until the
// atlas is build (when calling GetTexData*** or Build()). We only copy the pointer, not the data.
// - Important: By default, AddFontFromMemoryTTF() takes ownership of the data. Even though we are not writing to it, we will free the pointer on destruction.
// You can set font_cfg->FontDataOwnedByAtlas=false to keep ownership of your data and it won't be freed,
// - Even though many functions are suffixed with "TTF", OTF data is supported just as well.
// - This is an old API and it is currently awkward for those and various other reasons! We will address them in the future!
type FontAtlas struct {
// TODO: contains unsupported fields
data unsafe.Pointer
}
func (self FontAtlas) handle() (result *C.ImFontAtlas, releaseFn func()) {
result = (*C.ImFontAtlas)(self.data)
return result, func() {}
}
func (self FontAtlas) c() (result C.ImFontAtlas, fin func()) {
resultPtr, finFn := self.handle()
return *resultPtr, finFn
}
func newFontAtlasFromC(cvalue *C.ImFontAtlas) *FontAtlas {
result := new(FontAtlas)
result.data = unsafe.Pointer(cvalue)
return result
}
// See ImFontAtlas::AddCustomRectXXX functions.
type FontAtlasCustomRect struct {
FieldWidth uint16 // Input // Desired rectangle dimension
FieldHeight uint16 // Input // Desired rectangle dimension
FieldX uint16 // Output // Packed position in Atlas
FieldY uint16 // Output // Packed position in Atlas
FieldGlyphID uint32 // Input // For custom font glyphs only (ID < 0x110000)
FieldGlyphAdvanceX float32 // Input // For custom font glyphs only: glyph xadvance
FieldGlyphOffset Vec2 // Input // For custom font glyphs only: glyph display offset
FieldFont *Font // Input // For custom font glyphs only: target font
}
func (self FontAtlasCustomRect) handle() (result *C.ImFontAtlasCustomRect, releaseFn func()) {
result = new(C.ImFontAtlasCustomRect)
FieldWidth := self.FieldWidth
result.Width = C.ushort(FieldWidth)
FieldHeight := self.FieldHeight
result.Height = C.ushort(FieldHeight)
FieldX := self.FieldX
result.X = C.ushort(FieldX)
FieldY := self.FieldY
result.Y = C.ushort(FieldY)
FieldGlyphID := self.FieldGlyphID
result.GlyphID = C.uint(FieldGlyphID)
FieldGlyphAdvanceX := self.FieldGlyphAdvanceX
result.GlyphAdvanceX = C.float(FieldGlyphAdvanceX)
FieldGlyphOffset := self.FieldGlyphOffset
result.GlyphOffset = FieldGlyphOffset.toC()
FieldFont := self.FieldFont
FieldFontArg, FieldFontFin := FieldFont.handle()
result.Font = FieldFontArg
releaseFn = func() {
FieldFontFin()
}
return result, releaseFn
}
func (self FontAtlasCustomRect) c() (result C.ImFontAtlasCustomRect, fin func()) {
resultPtr, finFn := self.handle()
return *resultPtr, finFn
}
func newFontAtlasCustomRectFromC(cvalue *C.ImFontAtlasCustomRect) *FontAtlasCustomRect {
result := new(FontAtlasCustomRect)
result.FieldWidth = uint16(cvalue.Width)
result.FieldHeight = uint16(cvalue.Height)
result.FieldX = uint16(cvalue.X)
result.FieldY = uint16(cvalue.Y)
result.FieldGlyphID = uint32(cvalue.GlyphID)
result.FieldGlyphAdvanceX = float32(cvalue.GlyphAdvanceX)
result.FieldGlyphOffset = *(&Vec2{}).fromC(cvalue.GlyphOffset)
result.FieldFont = newFontFromC(cvalue.Font)
return result
}
// This structure is likely to evolve as we add support for incremental atlas updates
type FontBuilderIO struct {
// TODO: contains unsupported fields
data unsafe.Pointer
}
func (self FontBuilderIO) handle() (result *C.ImFontBuilderIO, releaseFn func()) {
result = (*C.ImFontBuilderIO)(self.data)
return result, func() {}
}
func (self FontBuilderIO) c() (result C.ImFontBuilderIO, fin func()) {
resultPtr, finFn := self.handle()
return *resultPtr, finFn
}
func newFontBuilderIOFromC(cvalue *C.ImFontBuilderIO) *FontBuilderIO {
result := new(FontBuilderIO)
result.data = unsafe.Pointer(cvalue)
return result
}
type FontConfig struct {
// TODO: contains unsupported fields
data unsafe.Pointer
}
func (self FontConfig) handle() (result *C.ImFontConfig, releaseFn func()) {
result = (*C.ImFontConfig)(self.data)
return result, func() {}
}
func (self FontConfig) c() (result C.ImFontConfig, fin func()) {
resultPtr, finFn := self.handle()
return *resultPtr, finFn
}
func newFontConfigFromC(cvalue *C.ImFontConfig) *FontConfig {
result := new(FontConfig)
result.data = unsafe.Pointer(cvalue)
return result
}
// Hold rendering data for one glyph.
// (Note: some language parsers may fail to convert the 31+1 bitfield members, in this case maybe drop store a single u32 or we can rework this)
type FontGlyph struct {
// TODO: contains unsupported fields
data unsafe.Pointer
}
func (self FontGlyph) handle() (result *C.ImFontGlyph, releaseFn func()) {
result = (*C.ImFontGlyph)(self.data)
return result, func() {}
}
func (self FontGlyph) c() (result C.ImFontGlyph, fin func()) {
resultPtr, finFn := self.handle()
return *resultPtr, finFn
}
func newFontGlyphFromC(cvalue *C.ImFontGlyph) *FontGlyph {
result := new(FontGlyph)
result.data = unsafe.Pointer(cvalue)
return result
}
// Helper to build glyph ranges from text/string data. Feed your application strings/characters to it then call BuildRanges().
// This is essentially a tightly packed of vector of 64k booleans = 8KB storage.
type FontGlyphRangesBuilder struct {
FieldUsedChars Vector[*uint32] // Store 1-bit per Unicode code point (0=unused, 1=used)
}
func (self FontGlyphRangesBuilder) handle() (result *C.ImFontGlyphRangesBuilder, releaseFn func()) {
result = new(C.ImFontGlyphRangesBuilder)
FieldUsedChars := self.FieldUsedChars
FieldUsedCharsData := FieldUsedChars.Data
FieldUsedCharsDataArg, FieldUsedCharsDataFin := WrapNumberPtr[C.ImU32, uint32](FieldUsedCharsData)
FieldUsedCharsVecArg := new(C.ImVector_ImU32)
FieldUsedCharsVecArg.Size = C.int(FieldUsedChars.Size)
FieldUsedCharsVecArg.Capacity = C.int(FieldUsedChars.Capacity)
FieldUsedCharsVecArg.Data = FieldUsedCharsDataArg
FieldUsedChars.pinner.Pin(FieldUsedCharsVecArg.Data)
result.UsedChars = *FieldUsedCharsVecArg
releaseFn = func() {
FieldUsedCharsDataFin()
FieldUsedChars.pinner.Unpin()
}
return result, releaseFn
}
func (self FontGlyphRangesBuilder) c() (result C.ImFontGlyphRangesBuilder, fin func()) {
resultPtr, finFn := self.handle()
return *resultPtr, finFn
}
func newFontGlyphRangesBuilderFromC(cvalue *C.ImFontGlyphRangesBuilder) *FontGlyphRangesBuilder {
result := new(FontGlyphRangesBuilder)
result.FieldUsedChars = newVectorFromC(cvalue.UsedChars.Size, cvalue.UsedChars.Capacity, (*uint32)(cvalue.UsedChars.Data))
return result
}
// Stacked color modifier, backup of modified data so we can restore it
type ColorMod struct {
FieldCol Col
FieldBackupValue Vec4
}
func (self ColorMod) handle() (result *C.ImGuiColorMod, releaseFn func()) {
result = new(C.ImGuiColorMod)
FieldCol := self.FieldCol
result.Col = C.ImGuiCol(FieldCol)
FieldBackupValue := self.FieldBackupValue
result.BackupValue = FieldBackupValue.toC()
releaseFn = func() {
}
return result, releaseFn
}
func (self ColorMod) c() (result C.ImGuiColorMod, fin func()) {
resultPtr, finFn := self.handle()
return *resultPtr, finFn
}
func newColorModFromC(cvalue *C.ImGuiColorMod) *ColorMod {
result := new(ColorMod)
result.FieldCol = Col(cvalue.Col)
result.FieldBackupValue = *(&Vec4{}).fromC(cvalue.BackupValue)
return result
}
// Storage data for BeginComboPreview()/EndComboPreview()
type ComboPreviewData struct {
FieldPreviewRect Rect
FieldBackupCursorPos Vec2
FieldBackupCursorMaxPos Vec2
FieldBackupCursorPosPrevLine Vec2
FieldBackupPrevLineTextBaseOffset float32
FieldBackupLayout LayoutType
}
func (self ComboPreviewData) handle() (result *C.ImGuiComboPreviewData, releaseFn func()) {
result = new(C.ImGuiComboPreviewData)
FieldPreviewRect := self.FieldPreviewRect
result.PreviewRect = FieldPreviewRect.toC()
FieldBackupCursorPos := self.FieldBackupCursorPos
result.BackupCursorPos = FieldBackupCursorPos.toC()
FieldBackupCursorMaxPos := self.FieldBackupCursorMaxPos
result.BackupCursorMaxPos = FieldBackupCursorMaxPos.toC()
FieldBackupCursorPosPrevLine := self.FieldBackupCursorPosPrevLine
result.BackupCursorPosPrevLine = FieldBackupCursorPosPrevLine.toC()
FieldBackupPrevLineTextBaseOffset := self.FieldBackupPrevLineTextBaseOffset
result.BackupPrevLineTextBaseOffset = C.float(FieldBackupPrevLineTextBaseOffset)
FieldBackupLayout := self.FieldBackupLayout
result.BackupLayout = C.ImGuiLayoutType(FieldBackupLayout)
releaseFn = func() {
}
return result, releaseFn
}
func (self ComboPreviewData) c() (result C.ImGuiComboPreviewData, fin func()) {
resultPtr, finFn := self.handle()
return *resultPtr, finFn
}
func newComboPreviewDataFromC(cvalue *C.ImGuiComboPreviewData) *ComboPreviewData {
result := new(ComboPreviewData)
result.FieldPreviewRect = *(&Rect{}).fromC(cvalue.PreviewRect)
result.FieldBackupCursorPos = *(&Vec2{}).fromC(cvalue.BackupCursorPos)
result.FieldBackupCursorMaxPos = *(&Vec2{}).fromC(cvalue.BackupCursorMaxPos)
result.FieldBackupCursorPosPrevLine = *(&Vec2{}).fromC(cvalue.BackupCursorPosPrevLine)
result.FieldBackupPrevLineTextBaseOffset = float32(cvalue.BackupPrevLineTextBaseOffset)
result.FieldBackupLayout = LayoutType(cvalue.BackupLayout)
return result
}
type Context struct {
// TODO: contains unsupported fields
data unsafe.Pointer
}
func (self Context) handle() (result *C.ImGuiContext, releaseFn func()) {
result = (*C.ImGuiContext)(self.data)
return result, func() {}
}
func (self Context) c() (result C.ImGuiContext, fin func()) {
resultPtr, finFn := self.handle()
return *resultPtr, finFn
}
func newContextFromC(cvalue *C.ImGuiContext) *Context {
result := new(Context)
result.data = unsafe.Pointer(cvalue)
return result
}
type ContextHook struct {
// TODO: contains unsupported fields
data unsafe.Pointer
}
func (self ContextHook) handle() (result *C.ImGuiContextHook, releaseFn func()) {
result = (*C.ImGuiContextHook)(self.data)
return result, func() {}
}
func (self ContextHook) c() (result C.ImGuiContextHook, fin func()) {
resultPtr, finFn := self.handle()
return *resultPtr, finFn
}
func newContextHookFromC(cvalue *C.ImGuiContextHook) *ContextHook {
result := new(ContextHook)
result.data = unsafe.Pointer(cvalue)
return result
}
// Type information associated to one ImGuiDataType. Retrieve with DataTypeGetInfo().
type DataTypeInfo struct {
FieldSize uint64 // Size in bytes
FieldName string // Short descriptive name for the type, for debugging
FieldPrintFmt string // Default printf format for the type
FieldScanFmt string // Default scanf format for the type
}
func (self DataTypeInfo) handle() (result *C.ImGuiDataTypeInfo, releaseFn func()) {
result = new(C.ImGuiDataTypeInfo)
FieldSize := self.FieldSize
result.Size = C.xulong(FieldSize)
FieldName := self.FieldName
FieldNameArg, FieldNameFin := WrapString(FieldName)
result.Name = FieldNameArg
FieldPrintFmt := self.FieldPrintFmt
FieldPrintFmtArg, FieldPrintFmtFin := WrapString(FieldPrintFmt)
result.PrintFmt = FieldPrintFmtArg
FieldScanFmt := self.FieldScanFmt
FieldScanFmtArg, FieldScanFmtFin := WrapString(FieldScanFmt)
result.ScanFmt = FieldScanFmtArg
releaseFn = func() {
FieldNameFin()
FieldPrintFmtFin()
FieldScanFmtFin()
}
return result, releaseFn
}
func (self DataTypeInfo) c() (result C.ImGuiDataTypeInfo, fin func()) {
resultPtr, finFn := self.handle()
return *resultPtr, finFn
}
func newDataTypeInfoFromC(cvalue *C.ImGuiDataTypeInfo) *DataTypeInfo {
result := new(DataTypeInfo)
result.FieldSize = uint64(cvalue.Size)
result.FieldName = C.GoString(cvalue.Name)
result.FieldPrintFmt = C.GoString(cvalue.PrintFmt)
result.FieldScanFmt = C.GoString(cvalue.ScanFmt)
return result
}
type DataTypeTempStorage struct {
// TODO: contains unsupported fields
data unsafe.Pointer
}
func (self DataTypeTempStorage) handle() (result *C.ImGuiDataTypeTempStorage, releaseFn func()) {
result = (*C.ImGuiDataTypeTempStorage)(self.data)
return result, func() {}
}
func (self DataTypeTempStorage) c() (result C.ImGuiDataTypeTempStorage, fin func()) {
resultPtr, finFn := self.handle()
return *resultPtr, finFn
}
func newDataTypeTempStorageFromC(cvalue *C.ImGuiDataTypeTempStorage) *DataTypeTempStorage {
result := new(DataTypeTempStorage)
result.data = unsafe.Pointer(cvalue)
return result
}
type DataVarInfo struct {
FieldType DataType
FieldCount uint32 // 1+
FieldOffset uint32 // Offset in parent structure
}
func (self DataVarInfo) handle() (result *C.ImGuiDataVarInfo, releaseFn func()) {
result = new(C.ImGuiDataVarInfo)
FieldType := self.FieldType
result.Type = C.ImGuiDataType(FieldType)
FieldCount := self.FieldCount
result.Count = C.ImU32(FieldCount)
FieldOffset := self.FieldOffset
result.Offset = C.ImU32(FieldOffset)
releaseFn = func() {
}
return result, releaseFn
}
func (self DataVarInfo) c() (result C.ImGuiDataVarInfo, fin func()) {
resultPtr, finFn := self.handle()
return *resultPtr, finFn
}
func newDataVarInfoFromC(cvalue *C.ImGuiDataVarInfo) *DataVarInfo {
result := new(DataVarInfo)
result.FieldType = DataType(cvalue.Type)
result.FieldCount = uint32(cvalue.Count)
result.FieldOffset = uint32(cvalue.Offset)
return result
}
type DockContext struct {
// TODO: contains unsupported fields
data unsafe.Pointer
}
func (self DockContext) handle() (result *C.ImGuiDockContext, releaseFn func()) {
result = (*C.ImGuiDockContext)(self.data)
return result, func() {}
}
func (self DockContext) c() (result C.ImGuiDockContext, fin func()) {
resultPtr, finFn := self.handle()
return *resultPtr, finFn
}
func newDockContextFromC(cvalue *C.ImGuiDockContext) *DockContext {
result := new(DockContext)
result.data = unsafe.Pointer(cvalue)
return result
}
// sizeof() 156~192
type DockNode struct {
// TODO: contains unsupported fields
data unsafe.Pointer
}
func (self DockNode) handle() (result *C.ImGuiDockNode, releaseFn func()) {
result = (*C.ImGuiDockNode)(self.data)
return result, func() {}
}
func (self DockNode) c() (result C.ImGuiDockNode, fin func()) {
resultPtr, finFn := self.handle()
return *resultPtr, finFn
}
func newDockNodeFromC(cvalue *C.ImGuiDockNode) *DockNode {
result := new(DockNode)
result.data = unsafe.Pointer(cvalue)
return result
}
// Stacked storage data for BeginGroup()/EndGroup()
type GroupData struct {
FieldWindowID ID
FieldBackupCursorPos Vec2
FieldBackupCursorMaxPos Vec2
FieldBackupIndent Vec1
FieldBackupGroupOffset Vec1
FieldBackupCurrLineSize Vec2
FieldBackupCurrLineTextBaseOffset float32
FieldBackupActiveIdIsAlive ID
FieldBackupActiveIdPreviousFrameIsAlive bool
FieldBackupHoveredIdIsAlive bool
FieldEmitItem bool
}
func (self GroupData) handle() (result *C.ImGuiGroupData, releaseFn func()) {
result = new(C.ImGuiGroupData)
FieldWindowID := self.FieldWindowID
result.WindowID = C.ImGuiID(FieldWindowID)
FieldBackupCursorPos := self.FieldBackupCursorPos
result.BackupCursorPos = FieldBackupCursorPos.toC()
FieldBackupCursorMaxPos := self.FieldBackupCursorMaxPos
result.BackupCursorMaxPos = FieldBackupCursorMaxPos.toC()
FieldBackupIndent := self.FieldBackupIndent
FieldBackupIndentArg, FieldBackupIndentFin := FieldBackupIndent.c()
result.BackupIndent = FieldBackupIndentArg
FieldBackupGroupOffset := self.FieldBackupGroupOffset
FieldBackupGroupOffsetArg, FieldBackupGroupOffsetFin := FieldBackupGroupOffset.c()
result.BackupGroupOffset = FieldBackupGroupOffsetArg
FieldBackupCurrLineSize := self.FieldBackupCurrLineSize
result.BackupCurrLineSize = FieldBackupCurrLineSize.toC()
FieldBackupCurrLineTextBaseOffset := self.FieldBackupCurrLineTextBaseOffset
result.BackupCurrLineTextBaseOffset = C.float(FieldBackupCurrLineTextBaseOffset)
FieldBackupActiveIdIsAlive := self.FieldBackupActiveIdIsAlive
result.BackupActiveIdIsAlive = C.ImGuiID(FieldBackupActiveIdIsAlive)
FieldBackupActiveIdPreviousFrameIsAlive := self.FieldBackupActiveIdPreviousFrameIsAlive
result.BackupActiveIdPreviousFrameIsAlive = C.bool(FieldBackupActiveIdPreviousFrameIsAlive)
FieldBackupHoveredIdIsAlive := self.FieldBackupHoveredIdIsAlive
result.BackupHoveredIdIsAlive = C.bool(FieldBackupHoveredIdIsAlive)
FieldEmitItem := self.FieldEmitItem
result.EmitItem = C.bool(FieldEmitItem)
releaseFn = func() {
FieldBackupIndentFin()
FieldBackupGroupOffsetFin()
}
return result, releaseFn
}
func (self GroupData) c() (result C.ImGuiGroupData, fin func()) {
resultPtr, finFn := self.handle()
return *resultPtr, finFn
}
func newGroupDataFromC(cvalue *C.ImGuiGroupData) *GroupData {
result := new(GroupData)
result.FieldWindowID = ID(cvalue.WindowID)
result.FieldBackupCursorPos = *(&Vec2{}).fromC(cvalue.BackupCursorPos)
result.FieldBackupCursorMaxPos = *(&Vec2{}).fromC(cvalue.BackupCursorMaxPos)
result.FieldBackupIndent = *newVec1FromC(func() *C.ImVec1 { result := cvalue.BackupIndent; return &result }())
result.FieldBackupGroupOffset = *newVec1FromC(func() *C.ImVec1 { result := cvalue.BackupGroupOffset; return &result }())
result.FieldBackupCurrLineSize = *(&Vec2{}).fromC(cvalue.BackupCurrLineSize)
result.FieldBackupCurrLineTextBaseOffset = float32(cvalue.BackupCurrLineTextBaseOffset)
result.FieldBackupActiveIdIsAlive = ID(cvalue.BackupActiveIdIsAlive)
result.FieldBackupActiveIdPreviousFrameIsAlive = cvalue.BackupActiveIdPreviousFrameIsAlive == C.bool(true)
result.FieldBackupHoveredIdIsAlive = cvalue.BackupHoveredIdIsAlive == C.bool(true)
result.FieldEmitItem = cvalue.EmitItem == C.bool(true)
return result
}
type IO struct {
// TODO: contains unsupported fields
data unsafe.Pointer
}
func (self IO) handle() (result *C.ImGuiIO, releaseFn func()) {
result = (*C.ImGuiIO)(self.data)
return result, func() {}
}
func (self IO) c() (result C.ImGuiIO, fin func()) {
resultPtr, finFn := self.handle()
return *resultPtr, finFn
}
func newIOFromC(cvalue *C.ImGuiIO) *IO {
result := new(IO)
result.data = unsafe.Pointer(cvalue)
return result
}
type InputEvent struct {
// TODO: contains unsupported fields
data unsafe.Pointer
}
func (self InputEvent) handle() (result *C.ImGuiInputEvent, releaseFn func()) {
result = (*C.ImGuiInputEvent)(self.data)
return result, func() {}
}
func (self InputEvent) c() (result C.ImGuiInputEvent, fin func()) {
resultPtr, finFn := self.handle()
return *resultPtr, finFn
}
func newInputEventFromC(cvalue *C.ImGuiInputEvent) *InputEvent {
result := new(InputEvent)
result.data = unsafe.Pointer(cvalue)
return result
}
type InputEventAppFocused struct {
FieldFocused bool
}
func (self InputEventAppFocused) handle() (result *C.ImGuiInputEventAppFocused, releaseFn func()) {
result = new(C.ImGuiInputEventAppFocused)
FieldFocused := self.FieldFocused
result.Focused = C.bool(FieldFocused)
releaseFn = func() {
}
return result, releaseFn
}
func (self InputEventAppFocused) c() (result C.ImGuiInputEventAppFocused, fin func()) {
resultPtr, finFn := self.handle()
return *resultPtr, finFn
}
func newInputEventAppFocusedFromC(cvalue *C.ImGuiInputEventAppFocused) *InputEventAppFocused {
result := new(InputEventAppFocused)
result.FieldFocused = cvalue.Focused == C.bool(true)
return result
}
type InputEventKey struct {
FieldKey Key
FieldDown bool
FieldAnalogValue float32
}
func (self InputEventKey) handle() (result *C.ImGuiInputEventKey, releaseFn func()) {
result = new(C.ImGuiInputEventKey)
FieldKey := self.FieldKey
result.Key = C.ImGuiKey(FieldKey)
FieldDown := self.FieldDown
result.Down = C.bool(FieldDown)
FieldAnalogValue := self.FieldAnalogValue
result.AnalogValue = C.float(FieldAnalogValue)
releaseFn = func() {
}
return result, releaseFn
}