imgui 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE.txt +21 -0
- data/README.md +273 -0
- data/Rakefile +97 -0
- data/api/v1.json +53 -0
- data/ext/CMakeLists.txt +128 -0
- data/ext/Rakefile +31 -0
- data/ext/backend_function_bridge.cpp +180 -0
- data/ext/backend_function_bridge.h +40 -0
- data/ext/build_cimgui.rb +59 -0
- data/ext/extconf.rb +25 -0
- data/ext/glfw_vulkan_bridge.cpp +14 -0
- data/ext/imgui_ruby_build_config.h +17 -0
- data/ext/imgui_ruby_glfw.cpp +73 -0
- data/ext/imgui_ruby_sdl3.cpp +70 -0
- data/ext/imgui_ruby_wgpu.cpp +75 -0
- data/ext/install_cimgui.rb +25 -0
- data/ext/webgpu_function_bridge.cpp +245 -0
- data/generator/api_emitter.rb +164 -0
- data/generator/emitter.rb +317 -0
- data/generator/generate.rb +47 -0
- data/generator/native-dependencies.yml +88 -0
- data/generator/native_dependency_lock.rb +78 -0
- data/generator/native_dependency_snapshot.rb +159 -0
- data/generator/overrides.yml +11 -0
- data/generator/type_mapper.rb +112 -0
- data/generator/update_vendor.rb +30 -0
- data/lib/imgui/api.rb +88 -0
- data/lib/imgui/api_generated.rb +1633 -0
- data/lib/imgui/api_support.rb +144 -0
- data/lib/imgui/backends/glfw.rb +75 -0
- data/lib/imgui/backends/opengl3.rb +44 -0
- data/lib/imgui/backends/sdl3.rb +133 -0
- data/lib/imgui/backends/wgpu.rb +176 -0
- data/lib/imgui/backends.rb +60 -0
- data/lib/imgui/draw_data.rb +43 -0
- data/lib/imgui/dsl.rb +311 -0
- data/lib/imgui/dsl_support.rb +107 -0
- data/lib/imgui/easy_loop.rb +25 -0
- data/lib/imgui/errors.rb +11 -0
- data/lib/imgui/fonts.rb +46 -0
- data/lib/imgui/io.rb +91 -0
- data/lib/imgui/layout.rb +138 -0
- data/lib/imgui/memory_pool.rb +18 -0
- data/lib/imgui/native/enums.rb +2251 -0
- data/lib/imgui/native/functions.rb +1470 -0
- data/lib/imgui/native/structs.rb +1926 -0
- data/lib/imgui/native/typedefs.rb +93 -0
- data/lib/imgui/native.rb +130 -0
- data/lib/imgui/plot/api.rb +273 -0
- data/lib/imgui/plot/native/enums.rb +593 -0
- data/lib/imgui/plot/native/functions.rb +749 -0
- data/lib/imgui/plot/native/structs.rb +363 -0
- data/lib/imgui/plot/native/typedefs.rb +79 -0
- data/lib/imgui/plot.rb +13 -0
- data/lib/imgui/struct_value.rb +33 -0
- data/lib/imgui/style.rb +44 -0
- data/lib/imgui/value.rb +104 -0
- data/lib/imgui/version.rb +5 -0
- data/lib/imgui/widgets.rb +187 -0
- data/lib/imgui.rb +30 -0
- data/rakelib/platform_gem.rake +54 -0
- data/rakelib/source_gem.rake +75 -0
- metadata +129 -0
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# This file is generated by `rake generate`. Do not edit it manually.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
module ImGui
|
|
7
|
+
module Native
|
|
8
|
+
class Formatter_Time_Data < FFI::Struct; end
|
|
9
|
+
class ImPlotAlignmentData < FFI::Struct; end
|
|
10
|
+
class ImPlotAnnotation < FFI::Struct; end
|
|
11
|
+
class ImPlotAnnotationCollection < FFI::Struct; end
|
|
12
|
+
class ImPlotAxis < FFI::Struct; end
|
|
13
|
+
class ImPlotColormapData < FFI::Struct; end
|
|
14
|
+
class ImPlotContext < FFI::Struct; end
|
|
15
|
+
class ImPlotDateTimeSpec < FFI::Struct; end
|
|
16
|
+
class ImPlotInputMap < FFI::Struct; end
|
|
17
|
+
class ImPlotItem < FFI::Struct; end
|
|
18
|
+
class ImPlotItemGroup < FFI::Struct; end
|
|
19
|
+
class ImPlotLegend < FFI::Struct; end
|
|
20
|
+
class ImPlotNextItemData < FFI::Struct; end
|
|
21
|
+
class ImPlotNextPlotData < FFI::Struct; end
|
|
22
|
+
class ImPlotPlot < FFI::Struct; end
|
|
23
|
+
class ImPlotPoint < FFI::Struct; end
|
|
24
|
+
class ImPlotPointError < FFI::Struct; end
|
|
25
|
+
class ImPlotRange < FFI::Struct; end
|
|
26
|
+
class ImPlotRect < FFI::Struct; end
|
|
27
|
+
class ImPlotStyle < FFI::Struct; end
|
|
28
|
+
class ImPlotSubplot < FFI::Struct; end
|
|
29
|
+
class ImPlotTag < FFI::Struct; end
|
|
30
|
+
class ImPlotTagCollection < FFI::Struct; end
|
|
31
|
+
class ImPlotTick < FFI::Struct; end
|
|
32
|
+
class ImPlotTicker < FFI::Struct; end
|
|
33
|
+
class ImPlotTime < FFI::Struct; end
|
|
34
|
+
|
|
35
|
+
ImPlotTime.layout(
|
|
36
|
+
"S", :pointer,
|
|
37
|
+
"Us", :int
|
|
38
|
+
)
|
|
39
|
+
ImPlotDateTimeSpec.layout(
|
|
40
|
+
"Date", :int,
|
|
41
|
+
"Time", :int,
|
|
42
|
+
"UseISO8601", :bool,
|
|
43
|
+
"Use24HourClock", :bool
|
|
44
|
+
)
|
|
45
|
+
Formatter_Time_Data.layout(
|
|
46
|
+
"Time", ImPlotTime.by_value,
|
|
47
|
+
"Spec", ImPlotDateTimeSpec.by_value,
|
|
48
|
+
"UserFormatter", :ImPlotFormatter,
|
|
49
|
+
"UserFormatterData", :pointer
|
|
50
|
+
)
|
|
51
|
+
ImPlotAlignmentData.layout(
|
|
52
|
+
"Vertical", :bool,
|
|
53
|
+
"PadA", :float,
|
|
54
|
+
"PadB", :float,
|
|
55
|
+
"PadAMax", :float,
|
|
56
|
+
"PadBMax", :float
|
|
57
|
+
)
|
|
58
|
+
ImPlotAnnotation.layout(
|
|
59
|
+
"Pos", ImGui::Native::ImVec2.by_value,
|
|
60
|
+
"Offset", ImGui::Native::ImVec2.by_value,
|
|
61
|
+
"ColorBg", :uint,
|
|
62
|
+
"ColorFg", :uint,
|
|
63
|
+
"TextOffset", :int,
|
|
64
|
+
"Clamp", :bool
|
|
65
|
+
)
|
|
66
|
+
ImPlotAnnotationCollection.layout(
|
|
67
|
+
"Annotations", ImGui::Native::ImVector.by_value,
|
|
68
|
+
"TextBuffer", ImGui::Native::ImGuiTextBuffer.by_value,
|
|
69
|
+
"Size", :int
|
|
70
|
+
)
|
|
71
|
+
ImPlotRange.layout(
|
|
72
|
+
"Min", :double,
|
|
73
|
+
"Max", :double
|
|
74
|
+
)
|
|
75
|
+
ImPlotTicker.layout(
|
|
76
|
+
"Ticks", ImGui::Native::ImVector.by_value,
|
|
77
|
+
"TextBuffer", ImGui::Native::ImGuiTextBuffer.by_value,
|
|
78
|
+
"MaxSize", ImGui::Native::ImVec2.by_value,
|
|
79
|
+
"LateSize", ImGui::Native::ImVec2.by_value,
|
|
80
|
+
"Levels", :int
|
|
81
|
+
)
|
|
82
|
+
ImPlotAxis.layout(
|
|
83
|
+
"ID", :uint,
|
|
84
|
+
"Flags", :int,
|
|
85
|
+
"PreviousFlags", :int,
|
|
86
|
+
"Range", ImPlotRange.by_value,
|
|
87
|
+
"RangeCond", :int,
|
|
88
|
+
"Scale", :int,
|
|
89
|
+
"FitExtents", ImPlotRange.by_value,
|
|
90
|
+
"OrthoAxis", :pointer,
|
|
91
|
+
"ConstraintRange", ImPlotRange.by_value,
|
|
92
|
+
"ConstraintZoom", ImPlotRange.by_value,
|
|
93
|
+
"Ticker", ImPlotTicker.by_value,
|
|
94
|
+
"Formatter", :ImPlotFormatter,
|
|
95
|
+
"FormatterData", :pointer,
|
|
96
|
+
"FormatSpec[16]", [:char, 16],
|
|
97
|
+
"Locator", :ImPlotLocator,
|
|
98
|
+
"LinkedMin", :pointer,
|
|
99
|
+
"LinkedMax", :pointer,
|
|
100
|
+
"PickerLevel", :int,
|
|
101
|
+
"PickerTimeMin", ImPlotTime.by_value,
|
|
102
|
+
"PickerTimeMax", ImPlotTime.by_value,
|
|
103
|
+
"TransformForward", :ImPlotTransform,
|
|
104
|
+
"TransformInverse", :ImPlotTransform,
|
|
105
|
+
"TransformData", :pointer,
|
|
106
|
+
"PixelMin", :float,
|
|
107
|
+
"PixelMax", :float,
|
|
108
|
+
"ScaleMin", :double,
|
|
109
|
+
"ScaleMax", :double,
|
|
110
|
+
"ScaleToPixel", :double,
|
|
111
|
+
"Datum1", :float,
|
|
112
|
+
"Datum2", :float,
|
|
113
|
+
"HoverRect", ImGui::Native::ImRect.by_value,
|
|
114
|
+
"LabelOffset", :int,
|
|
115
|
+
"ColorMaj", :uint,
|
|
116
|
+
"ColorMin", :uint,
|
|
117
|
+
"ColorTick", :uint,
|
|
118
|
+
"ColorTxt", :uint,
|
|
119
|
+
"ColorBg", :uint,
|
|
120
|
+
"ColorHov", :uint,
|
|
121
|
+
"ColorAct", :uint,
|
|
122
|
+
"ColorHiLi", :uint,
|
|
123
|
+
"Enabled", :bool,
|
|
124
|
+
"Vertical", :bool,
|
|
125
|
+
"FitThisFrame", :bool,
|
|
126
|
+
"HasRange", :bool,
|
|
127
|
+
"HasFormatSpec", :bool,
|
|
128
|
+
"ShowDefaultTicks", :bool,
|
|
129
|
+
"Hovered", :bool,
|
|
130
|
+
"Held", :bool
|
|
131
|
+
)
|
|
132
|
+
ImPlotColormapData.layout(
|
|
133
|
+
"Keys", ImGui::Native::ImVector.by_value,
|
|
134
|
+
"KeyCounts", ImGui::Native::ImVector.by_value,
|
|
135
|
+
"KeyOffsets", ImGui::Native::ImVector.by_value,
|
|
136
|
+
"Tables", ImGui::Native::ImVector.by_value,
|
|
137
|
+
"TableSizes", ImGui::Native::ImVector.by_value,
|
|
138
|
+
"TableOffsets", ImGui::Native::ImVector.by_value,
|
|
139
|
+
"Text", ImGui::Native::ImGuiTextBuffer.by_value,
|
|
140
|
+
"TextOffsets", ImGui::Native::ImVector.by_value,
|
|
141
|
+
"Quals", ImGui::Native::ImVector.by_value,
|
|
142
|
+
"Map", ImGui::Native::ImGuiStorage.by_value,
|
|
143
|
+
"Count", :int
|
|
144
|
+
)
|
|
145
|
+
ImPlotTagCollection.layout(
|
|
146
|
+
"Tags", ImGui::Native::ImVector.by_value,
|
|
147
|
+
"TextBuffer", ImGui::Native::ImGuiTextBuffer.by_value,
|
|
148
|
+
"Size", :int
|
|
149
|
+
)
|
|
150
|
+
ImPlotStyle.layout(
|
|
151
|
+
"LineWeight", :float,
|
|
152
|
+
"Marker", :int,
|
|
153
|
+
"MarkerSize", :float,
|
|
154
|
+
"MarkerWeight", :float,
|
|
155
|
+
"FillAlpha", :float,
|
|
156
|
+
"ErrorBarSize", :float,
|
|
157
|
+
"ErrorBarWeight", :float,
|
|
158
|
+
"DigitalBitHeight", :float,
|
|
159
|
+
"DigitalBitGap", :float,
|
|
160
|
+
"PlotBorderSize", :float,
|
|
161
|
+
"MinorAlpha", :float,
|
|
162
|
+
"MajorTickLen", ImGui::Native::ImVec2.by_value,
|
|
163
|
+
"MinorTickLen", ImGui::Native::ImVec2.by_value,
|
|
164
|
+
"MajorTickSize", ImGui::Native::ImVec2.by_value,
|
|
165
|
+
"MinorTickSize", ImGui::Native::ImVec2.by_value,
|
|
166
|
+
"MajorGridSize", ImGui::Native::ImVec2.by_value,
|
|
167
|
+
"MinorGridSize", ImGui::Native::ImVec2.by_value,
|
|
168
|
+
"PlotPadding", ImGui::Native::ImVec2.by_value,
|
|
169
|
+
"LabelPadding", ImGui::Native::ImVec2.by_value,
|
|
170
|
+
"LegendPadding", ImGui::Native::ImVec2.by_value,
|
|
171
|
+
"LegendInnerPadding", ImGui::Native::ImVec2.by_value,
|
|
172
|
+
"LegendSpacing", ImGui::Native::ImVec2.by_value,
|
|
173
|
+
"MousePosPadding", ImGui::Native::ImVec2.by_value,
|
|
174
|
+
"AnnotationPadding", ImGui::Native::ImVec2.by_value,
|
|
175
|
+
"FitPadding", ImGui::Native::ImVec2.by_value,
|
|
176
|
+
"PlotDefaultSize", ImGui::Native::ImVec2.by_value,
|
|
177
|
+
"PlotMinSize", ImGui::Native::ImVec2.by_value,
|
|
178
|
+
"Colors[ImPlotCol_COUNT]", [ImGui::Native::ImVec4.by_value, 21],
|
|
179
|
+
"Colormap", :int,
|
|
180
|
+
"UseLocalTime", :bool,
|
|
181
|
+
"UseISO8601", :bool,
|
|
182
|
+
"Use24HourClock", :bool
|
|
183
|
+
)
|
|
184
|
+
ImPlotNextPlotData.layout(
|
|
185
|
+
"RangeCond[ImAxis_COUNT]", [:int, 6],
|
|
186
|
+
"Range[ImAxis_COUNT]", [ImPlotRange.by_value, 6],
|
|
187
|
+
"HasRange[ImAxis_COUNT]", [:bool, 6],
|
|
188
|
+
"Fit[ImAxis_COUNT]", [:bool, 6],
|
|
189
|
+
"LinkedMin[ImAxis_COUNT]", [:pointer, 6],
|
|
190
|
+
"LinkedMax[ImAxis_COUNT]", [:pointer, 6]
|
|
191
|
+
)
|
|
192
|
+
ImPlotNextItemData.layout(
|
|
193
|
+
"Colors[5]", [ImGui::Native::ImVec4.by_value, 5],
|
|
194
|
+
"LineWeight", :float,
|
|
195
|
+
"Marker", :int,
|
|
196
|
+
"MarkerSize", :float,
|
|
197
|
+
"MarkerWeight", :float,
|
|
198
|
+
"FillAlpha", :float,
|
|
199
|
+
"ErrorBarSize", :float,
|
|
200
|
+
"ErrorBarWeight", :float,
|
|
201
|
+
"DigitalBitHeight", :float,
|
|
202
|
+
"DigitalBitGap", :float,
|
|
203
|
+
"RenderLine", :bool,
|
|
204
|
+
"RenderFill", :bool,
|
|
205
|
+
"RenderMarkerLine", :bool,
|
|
206
|
+
"RenderMarkerFill", :bool,
|
|
207
|
+
"HasHidden", :bool,
|
|
208
|
+
"Hidden", :bool,
|
|
209
|
+
"HiddenCond", :int
|
|
210
|
+
)
|
|
211
|
+
ImPlotInputMap.layout(
|
|
212
|
+
"Pan", :int,
|
|
213
|
+
"PanMod", :int,
|
|
214
|
+
"Fit", :int,
|
|
215
|
+
"Select", :int,
|
|
216
|
+
"SelectCancel", :int,
|
|
217
|
+
"SelectMod", :int,
|
|
218
|
+
"SelectHorzMod", :int,
|
|
219
|
+
"SelectVertMod", :int,
|
|
220
|
+
"Menu", :int,
|
|
221
|
+
"OverrideMod", :int,
|
|
222
|
+
"ZoomMod", :int,
|
|
223
|
+
"ZoomRate", :float
|
|
224
|
+
)
|
|
225
|
+
ImPlotContext.layout(
|
|
226
|
+
"Plots", :pointer,
|
|
227
|
+
"Subplots", :pointer,
|
|
228
|
+
"CurrentPlot", :pointer,
|
|
229
|
+
"CurrentSubplot", :pointer,
|
|
230
|
+
"CurrentItems", :pointer,
|
|
231
|
+
"CurrentItem", :pointer,
|
|
232
|
+
"PreviousItem", :pointer,
|
|
233
|
+
"CTicker", ImPlotTicker.by_value,
|
|
234
|
+
"Annotations", ImPlotAnnotationCollection.by_value,
|
|
235
|
+
"Tags", ImPlotTagCollection.by_value,
|
|
236
|
+
"Style", ImPlotStyle.by_value,
|
|
237
|
+
"ColorModifiers", ImGui::Native::ImVector.by_value,
|
|
238
|
+
"StyleModifiers", ImGui::Native::ImVector.by_value,
|
|
239
|
+
"ColormapData", ImPlotColormapData.by_value,
|
|
240
|
+
"ColormapModifiers", ImGui::Native::ImVector.by_value,
|
|
241
|
+
"Tm", :pointer,
|
|
242
|
+
"TempDouble1", ImGui::Native::ImVector.by_value,
|
|
243
|
+
"TempDouble2", ImGui::Native::ImVector.by_value,
|
|
244
|
+
"TempInt1", ImGui::Native::ImVector.by_value,
|
|
245
|
+
"DigitalPlotItemCnt", :int,
|
|
246
|
+
"DigitalPlotOffset", :int,
|
|
247
|
+
"NextPlotData", ImPlotNextPlotData.by_value,
|
|
248
|
+
"NextItemData", ImPlotNextItemData.by_value,
|
|
249
|
+
"InputMap", ImPlotInputMap.by_value,
|
|
250
|
+
"OpenContextThisFrame", :bool,
|
|
251
|
+
"MousePosStringBuilder", ImGui::Native::ImGuiTextBuffer.by_value,
|
|
252
|
+
"SortItems", :pointer,
|
|
253
|
+
"AlignmentData", :pointer,
|
|
254
|
+
"CurrentAlignmentH", :pointer,
|
|
255
|
+
"CurrentAlignmentV", :pointer
|
|
256
|
+
)
|
|
257
|
+
ImPlotItem.layout(
|
|
258
|
+
"ID", :uint,
|
|
259
|
+
"Color", :uint,
|
|
260
|
+
"LegendHoverRect", ImGui::Native::ImRect.by_value,
|
|
261
|
+
"NameOffset", :int,
|
|
262
|
+
"Show", :bool,
|
|
263
|
+
"LegendHovered", :bool,
|
|
264
|
+
"SeenThisFrame", :bool
|
|
265
|
+
)
|
|
266
|
+
ImPlotLegend.layout(
|
|
267
|
+
"Flags", :int,
|
|
268
|
+
"PreviousFlags", :int,
|
|
269
|
+
"Location", :int,
|
|
270
|
+
"PreviousLocation", :int,
|
|
271
|
+
"Scroll", ImGui::Native::ImVec2.by_value,
|
|
272
|
+
"Indices", ImGui::Native::ImVector.by_value,
|
|
273
|
+
"Labels", ImGui::Native::ImGuiTextBuffer.by_value,
|
|
274
|
+
"Rect", ImGui::Native::ImRect.by_value,
|
|
275
|
+
"RectClamped", ImGui::Native::ImRect.by_value,
|
|
276
|
+
"Hovered", :bool,
|
|
277
|
+
"Held", :bool,
|
|
278
|
+
"CanGoInside", :bool
|
|
279
|
+
)
|
|
280
|
+
ImPlotItemGroup.layout(
|
|
281
|
+
"ID", :uint,
|
|
282
|
+
"Legend", ImPlotLegend.by_value,
|
|
283
|
+
"ItemPool", :pointer,
|
|
284
|
+
"ColormapIdx", :int
|
|
285
|
+
)
|
|
286
|
+
ImPlotPlot.layout(
|
|
287
|
+
"ID", :uint,
|
|
288
|
+
"Flags", :int,
|
|
289
|
+
"PreviousFlags", :int,
|
|
290
|
+
"MouseTextLocation", :int,
|
|
291
|
+
"MouseTextFlags", :int,
|
|
292
|
+
"Axes[ImAxis_COUNT]", [ImPlotAxis.by_value, 6],
|
|
293
|
+
"TextBuffer", ImGui::Native::ImGuiTextBuffer.by_value,
|
|
294
|
+
"Items", ImPlotItemGroup.by_value,
|
|
295
|
+
"CurrentX", :int,
|
|
296
|
+
"CurrentY", :int,
|
|
297
|
+
"FrameRect", ImGui::Native::ImRect.by_value,
|
|
298
|
+
"CanvasRect", ImGui::Native::ImRect.by_value,
|
|
299
|
+
"PlotRect", ImGui::Native::ImRect.by_value,
|
|
300
|
+
"AxesRect", ImGui::Native::ImRect.by_value,
|
|
301
|
+
"SelectRect", ImGui::Native::ImRect.by_value,
|
|
302
|
+
"SelectStart", ImGui::Native::ImVec2.by_value,
|
|
303
|
+
"TitleOffset", :int,
|
|
304
|
+
"JustCreated", :bool,
|
|
305
|
+
"Initialized", :bool,
|
|
306
|
+
"SetupLocked", :bool,
|
|
307
|
+
"FitThisFrame", :bool,
|
|
308
|
+
"Hovered", :bool,
|
|
309
|
+
"Held", :bool,
|
|
310
|
+
"Selecting", :bool,
|
|
311
|
+
"Selected", :bool,
|
|
312
|
+
"ContextLocked", :bool
|
|
313
|
+
)
|
|
314
|
+
ImPlotPointError.layout(
|
|
315
|
+
"X", :double,
|
|
316
|
+
"Y", :double,
|
|
317
|
+
"Neg", :double,
|
|
318
|
+
"Pos", :double
|
|
319
|
+
)
|
|
320
|
+
ImPlotRect.layout(
|
|
321
|
+
"X", ImPlotRange.by_value,
|
|
322
|
+
"Y", ImPlotRange.by_value
|
|
323
|
+
)
|
|
324
|
+
ImPlotSubplot.layout(
|
|
325
|
+
"ID", :uint,
|
|
326
|
+
"Flags", :int,
|
|
327
|
+
"PreviousFlags", :int,
|
|
328
|
+
"Items", ImPlotItemGroup.by_value,
|
|
329
|
+
"Rows", :int,
|
|
330
|
+
"Cols", :int,
|
|
331
|
+
"CurrentIdx", :int,
|
|
332
|
+
"FrameRect", ImGui::Native::ImRect.by_value,
|
|
333
|
+
"GridRect", ImGui::Native::ImRect.by_value,
|
|
334
|
+
"CellSize", ImGui::Native::ImVec2.by_value,
|
|
335
|
+
"RowAlignmentData", ImGui::Native::ImVector.by_value,
|
|
336
|
+
"ColAlignmentData", ImGui::Native::ImVector.by_value,
|
|
337
|
+
"RowRatios", ImGui::Native::ImVector.by_value,
|
|
338
|
+
"ColRatios", ImGui::Native::ImVector.by_value,
|
|
339
|
+
"RowLinkData", ImGui::Native::ImVector.by_value,
|
|
340
|
+
"ColLinkData", ImGui::Native::ImVector.by_value,
|
|
341
|
+
"TempSizes[2]", [:float, 2],
|
|
342
|
+
"FrameHovered", :bool,
|
|
343
|
+
"HasTitle", :bool
|
|
344
|
+
)
|
|
345
|
+
ImPlotTag.layout(
|
|
346
|
+
"Axis", :int,
|
|
347
|
+
"Value", :double,
|
|
348
|
+
"ColorBg", :uint,
|
|
349
|
+
"ColorFg", :uint,
|
|
350
|
+
"TextOffset", :int
|
|
351
|
+
)
|
|
352
|
+
ImPlotTick.layout(
|
|
353
|
+
"PlotPos", :double,
|
|
354
|
+
"PixelPos", :float,
|
|
355
|
+
"LabelSize", ImGui::Native::ImVec2.by_value,
|
|
356
|
+
"TextOffset", :int,
|
|
357
|
+
"Major", :bool,
|
|
358
|
+
"ShowLabel", :bool,
|
|
359
|
+
"Level", :int,
|
|
360
|
+
"Idx", :int
|
|
361
|
+
)
|
|
362
|
+
end
|
|
363
|
+
end
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# This file is generated by `rake generate`. Do not edit it manually.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
module ImGui
|
|
7
|
+
module Native
|
|
8
|
+
class Formatter_Time_Data < FFI::Struct; end
|
|
9
|
+
class ImPlotAlignmentData < FFI::Struct; end
|
|
10
|
+
class ImPlotAnnotation < FFI::Struct; end
|
|
11
|
+
class ImPlotAnnotationCollection < FFI::Struct; end
|
|
12
|
+
class ImPlotAxis < FFI::Struct; end
|
|
13
|
+
class ImPlotColormapData < FFI::Struct; end
|
|
14
|
+
class ImPlotContext < FFI::Struct; end
|
|
15
|
+
class ImPlotDateTimeSpec < FFI::Struct; end
|
|
16
|
+
class ImPlotInputMap < FFI::Struct; end
|
|
17
|
+
class ImPlotItem < FFI::Struct; end
|
|
18
|
+
class ImPlotItemGroup < FFI::Struct; end
|
|
19
|
+
class ImPlotLegend < FFI::Struct; end
|
|
20
|
+
class ImPlotNextItemData < FFI::Struct; end
|
|
21
|
+
class ImPlotNextPlotData < FFI::Struct; end
|
|
22
|
+
class ImPlotPlot < FFI::Struct; end
|
|
23
|
+
class ImPlotPoint < FFI::Struct; end
|
|
24
|
+
class ImPlotPointError < FFI::Struct; end
|
|
25
|
+
class ImPlotRange < FFI::Struct; end
|
|
26
|
+
class ImPlotRect < FFI::Struct; end
|
|
27
|
+
class ImPlotStyle < FFI::Struct; end
|
|
28
|
+
class ImPlotSubplot < FFI::Struct; end
|
|
29
|
+
class ImPlotTag < FFI::Struct; end
|
|
30
|
+
class ImPlotTagCollection < FFI::Struct; end
|
|
31
|
+
class ImPlotTick < FFI::Struct; end
|
|
32
|
+
class ImPlotTicker < FFI::Struct; end
|
|
33
|
+
class ImPlotTime < FFI::Struct; end
|
|
34
|
+
ImPlotPoint.layout(
|
|
35
|
+
"x", :double,
|
|
36
|
+
"y", :double
|
|
37
|
+
)
|
|
38
|
+
typedef :int, :ImAxis
|
|
39
|
+
typedef :int, :ImPlotAxisFlags
|
|
40
|
+
typedef :int, :ImPlotBarGroupsFlags
|
|
41
|
+
typedef :int, :ImPlotBarsFlags
|
|
42
|
+
typedef :int, :ImPlotBin
|
|
43
|
+
typedef :int, :ImPlotCol
|
|
44
|
+
typedef :int, :ImPlotColormap
|
|
45
|
+
typedef :int, :ImPlotColormapScaleFlags
|
|
46
|
+
typedef :int, :ImPlotCond
|
|
47
|
+
typedef :int, :ImPlotDateFmt
|
|
48
|
+
typedef :int, :ImPlotDigitalFlags
|
|
49
|
+
typedef :int, :ImPlotDragToolFlags
|
|
50
|
+
typedef :int, :ImPlotDummyFlags
|
|
51
|
+
typedef :int, :ImPlotErrorBarsFlags
|
|
52
|
+
typedef :int, :ImPlotFlags
|
|
53
|
+
callback :ImPlotFormatter, [:double, :pointer, :int, :pointer], :int
|
|
54
|
+
callback :ImPlotGetter, [:int, :pointer], ImPlotPoint.by_value
|
|
55
|
+
typedef :int, :ImPlotHeatmapFlags
|
|
56
|
+
typedef :int, :ImPlotHistogramFlags
|
|
57
|
+
typedef :int, :ImPlotImageFlags
|
|
58
|
+
typedef :int, :ImPlotInfLinesFlags
|
|
59
|
+
typedef :int, :ImPlotItemFlags
|
|
60
|
+
typedef :int, :ImPlotLegendFlags
|
|
61
|
+
typedef :int, :ImPlotLineFlags
|
|
62
|
+
typedef :int, :ImPlotLocation
|
|
63
|
+
callback :ImPlotLocator, [:pointer, :pointer, :float, :bool, :ImPlotFormatter, :pointer], :void
|
|
64
|
+
typedef :int, :ImPlotMarker
|
|
65
|
+
typedef :int, :ImPlotMouseTextFlags
|
|
66
|
+
typedef :int, :ImPlotPieChartFlags
|
|
67
|
+
typedef :int, :ImPlotScale
|
|
68
|
+
typedef :int, :ImPlotScatterFlags
|
|
69
|
+
typedef :int, :ImPlotShadedFlags
|
|
70
|
+
typedef :int, :ImPlotStairsFlags
|
|
71
|
+
typedef :int, :ImPlotStemsFlags
|
|
72
|
+
typedef :int, :ImPlotStyleVar
|
|
73
|
+
typedef :int, :ImPlotSubplotFlags
|
|
74
|
+
typedef :int, :ImPlotTextFlags
|
|
75
|
+
typedef :int, :ImPlotTimeFmt
|
|
76
|
+
typedef :int, :ImPlotTimeUnit
|
|
77
|
+
callback :ImPlotTransform, [:double, :pointer], :double
|
|
78
|
+
end
|
|
79
|
+
end
|
data/lib/imgui/plot.rb
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "imgui"
|
|
4
|
+
|
|
5
|
+
require_relative "plot/native/typedefs"
|
|
6
|
+
require_relative "plot/native/enums"
|
|
7
|
+
require_relative "plot/native/structs"
|
|
8
|
+
require_relative "plot/native/functions"
|
|
9
|
+
require_relative "plot/api"
|
|
10
|
+
|
|
11
|
+
module ImPlot
|
|
12
|
+
Native = ImGui::Native
|
|
13
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ImGui
|
|
4
|
+
module StructValue
|
|
5
|
+
module_function
|
|
6
|
+
|
|
7
|
+
def vec2(value)
|
|
8
|
+
values = Array(value)
|
|
9
|
+
raise ArgumentError, "expected [x, y]" unless values.length == 2
|
|
10
|
+
|
|
11
|
+
Native::ImVec2.new.tap do |vector|
|
|
12
|
+
vector[:x] = Float(values[0])
|
|
13
|
+
vector[:y] = Float(values[1])
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def vec4(value)
|
|
18
|
+
values = Array(value)
|
|
19
|
+
raise ArgumentError, "expected [x, y, z, w]" unless values.length == 4
|
|
20
|
+
|
|
21
|
+
Native::ImVec4.new.tap do |vector|
|
|
22
|
+
vector[:x] = Float(values[0])
|
|
23
|
+
vector[:y] = Float(values[1])
|
|
24
|
+
vector[:z] = Float(values[2])
|
|
25
|
+
vector[:w] = Float(values[3])
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def to_a(vector, count)
|
|
30
|
+
%i[x y z w].first(count).map { |field| vector[field] }
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
data/lib/imgui/style.rb
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ImGui
|
|
4
|
+
class Style
|
|
5
|
+
attr_reader :pointer
|
|
6
|
+
|
|
7
|
+
def initialize(pointer)
|
|
8
|
+
@pointer = pointer
|
|
9
|
+
@native = Native::ImGuiStyle.new(pointer)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def alpha
|
|
13
|
+
@native[:Alpha]
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def alpha=(value)
|
|
17
|
+
@native[:Alpha] = Float(value)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def window_padding
|
|
21
|
+
StructValue.to_a(@native[:WindowPadding], 2)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def window_padding=(value)
|
|
25
|
+
@native[:WindowPadding] = StructValue.vec2(value)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def color(index)
|
|
29
|
+
vector = @native[:Colors][Integer(index)]
|
|
30
|
+
StructValue.to_a(vector, 4)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def set_color(index, value)
|
|
34
|
+
@native[:Colors][Integer(index)] = StructValue.vec4(value)
|
|
35
|
+
value
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def scale_all_sizes(scale)
|
|
39
|
+
ImGui.__send__(:guard_context!)
|
|
40
|
+
Native.ImGuiStyle_ScaleAllSizes(pointer, Float(scale))
|
|
41
|
+
self
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
data/lib/imgui/value.rb
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ImGui
|
|
4
|
+
class Value
|
|
5
|
+
TYPES = {
|
|
6
|
+
bool: [:bool, 1],
|
|
7
|
+
float: [:float, 1],
|
|
8
|
+
int: [:int, 1],
|
|
9
|
+
vec2: [:float, 2],
|
|
10
|
+
vec3: [:float, 3],
|
|
11
|
+
vec4: [:float, 4]
|
|
12
|
+
}.freeze
|
|
13
|
+
|
|
14
|
+
attr_reader :pointer, :type, :capacity
|
|
15
|
+
|
|
16
|
+
class << self
|
|
17
|
+
TYPES.each_key do |type|
|
|
18
|
+
define_method(type) { |initial| new(type, initial) }
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def text(initial = "", capacity: nil)
|
|
22
|
+
new(:text, initial, capacity: capacity)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def initialize(type, initial, capacity: nil)
|
|
27
|
+
@type = type.to_sym
|
|
28
|
+
if @type == :text
|
|
29
|
+
initialize_text(initial, capacity)
|
|
30
|
+
else
|
|
31
|
+
initialize_numeric(initial)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def get
|
|
36
|
+
return pointer.read_string.force_encoding(Encoding::UTF_8) if type == :text
|
|
37
|
+
|
|
38
|
+
ffi_type, count = TYPES.fetch(type)
|
|
39
|
+
return pointer.get(ffi_type, 0) if count == 1
|
|
40
|
+
|
|
41
|
+
pointer.public_send("read_array_of_#{ffi_type}", count)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def set(value)
|
|
45
|
+
if type == :text
|
|
46
|
+
write_text(value)
|
|
47
|
+
else
|
|
48
|
+
write_numeric(value)
|
|
49
|
+
end
|
|
50
|
+
self
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def text?
|
|
54
|
+
type == :text
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
private
|
|
58
|
+
|
|
59
|
+
def initialize_text(initial, requested_capacity)
|
|
60
|
+
string = String(initial).encode(Encoding::UTF_8)
|
|
61
|
+
@capacity = Integer(requested_capacity || [string.bytesize + 1, 256].max)
|
|
62
|
+
raise ArgumentError, "capacity must be positive" unless @capacity.positive?
|
|
63
|
+
|
|
64
|
+
@pointer = FFI::MemoryPointer.new(:char, @capacity, true)
|
|
65
|
+
write_text(string)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def initialize_numeric(initial)
|
|
69
|
+
ffi_type, count = TYPES.fetch(type) do
|
|
70
|
+
raise ArgumentError, "unknown value type: #{type.inspect}"
|
|
71
|
+
end
|
|
72
|
+
@capacity = FFI.type_size(ffi_type) * count
|
|
73
|
+
@pointer = FFI::MemoryPointer.new(ffi_type, count)
|
|
74
|
+
write_numeric(initial)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def write_text(value)
|
|
78
|
+
bytes = String(value).encode(Encoding::UTF_8).byteslice(0, capacity - 1)
|
|
79
|
+
pointer.clear
|
|
80
|
+
pointer.put_bytes(0, bytes)
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def write_numeric(value)
|
|
84
|
+
ffi_type, count = TYPES.fetch(type)
|
|
85
|
+
if count == 1
|
|
86
|
+
pointer.put(ffi_type, 0, coerce_scalar(value))
|
|
87
|
+
return
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
values = Array(value)
|
|
91
|
+
raise ArgumentError, "#{type} requires #{count} values" unless values.length == count
|
|
92
|
+
|
|
93
|
+
pointer.public_send("write_array_of_#{ffi_type}", values.map { |item| coerce_scalar(item) })
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def coerce_scalar(value)
|
|
97
|
+
case type
|
|
98
|
+
when :bool then !!value
|
|
99
|
+
when :int then Integer(value)
|
|
100
|
+
else Float(value)
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
end
|