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
data/lib/imgui/layout.rb
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ImGui
|
|
4
|
+
class << self
|
|
5
|
+
def separator
|
|
6
|
+
guarded_native_call(:igSeparator)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def spacing
|
|
10
|
+
guarded_native_call(:igSpacing)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def new_line
|
|
14
|
+
guarded_native_call(:igNewLine)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def same_line(offset: 0.0, spacing: -1.0)
|
|
18
|
+
guarded_native_call(:igSameLine, Float(offset), Float(spacing))
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def dummy(size)
|
|
22
|
+
guarded_native_call(:igDummy, StructValue.vec2(size))
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def indent(width = 0.0)
|
|
26
|
+
guarded_native_call(:igIndent, Float(width))
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def unindent(width = 0.0)
|
|
30
|
+
guarded_native_call(:igUnindent, Float(width))
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def set_next_window_pos(position, condition: 0, pivot: [0, 0])
|
|
34
|
+
guarded_native_call(
|
|
35
|
+
:igSetNextWindowPos,
|
|
36
|
+
StructValue.vec2(position),
|
|
37
|
+
Integer(condition),
|
|
38
|
+
StructValue.vec2(pivot)
|
|
39
|
+
)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def set_next_window_size(size, condition: 0)
|
|
43
|
+
guarded_native_call(:igSetNextWindowSize, StructValue.vec2(size), Integer(condition))
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def set_next_window_collapsed(collapsed, condition: 0)
|
|
47
|
+
guarded_native_call(:igSetNextWindowCollapsed, !!collapsed, Integer(condition))
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def set_next_window_focus
|
|
51
|
+
guarded_native_call(:igSetNextWindowFocus)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def window_pos
|
|
55
|
+
vector_result(:igGetWindowPos)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
alias get_window_pos window_pos
|
|
59
|
+
|
|
60
|
+
def window_size
|
|
61
|
+
vector_result(:igGetWindowSize)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
alias get_window_size window_size
|
|
65
|
+
|
|
66
|
+
def content_region_available
|
|
67
|
+
vector_result(:igGetContentRegionAvail)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
alias get_content_region_avail content_region_available
|
|
71
|
+
|
|
72
|
+
def cursor_pos
|
|
73
|
+
vector_result(:igGetCursorPos)
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
alias get_cursor_pos cursor_pos
|
|
77
|
+
|
|
78
|
+
def cursor_screen_pos
|
|
79
|
+
vector_result(:igGetCursorScreenPos)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
alias get_cursor_screen_pos cursor_screen_pos
|
|
83
|
+
|
|
84
|
+
def cursor_start_pos
|
|
85
|
+
vector_result(:igGetCursorStartPos)
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
alias get_cursor_start_pos cursor_start_pos
|
|
89
|
+
|
|
90
|
+
def mouse_pos
|
|
91
|
+
vector_result(:igGetMousePos)
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
alias get_mouse_pos mouse_pos
|
|
95
|
+
|
|
96
|
+
def mouse_drag_delta(button: 0, threshold: -1.0)
|
|
97
|
+
vector_result(:igGetMouseDragDelta, Integer(button), Float(threshold))
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
alias get_mouse_drag_delta mouse_drag_delta
|
|
101
|
+
|
|
102
|
+
def item_rect_min
|
|
103
|
+
vector_result(:igGetItemRectMin)
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
alias get_item_rect_min item_rect_min
|
|
107
|
+
|
|
108
|
+
def item_rect_max
|
|
109
|
+
vector_result(:igGetItemRectMax)
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
alias get_item_rect_max item_rect_max
|
|
113
|
+
|
|
114
|
+
def item_rect_size
|
|
115
|
+
vector_result(:igGetItemRectSize)
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
alias get_item_rect_size item_rect_size
|
|
119
|
+
|
|
120
|
+
def calc_text_size(text, hide_after_double_hash: false, wrap_width: -1.0)
|
|
121
|
+
vector_result(
|
|
122
|
+
:igCalcTextSize,
|
|
123
|
+
text.to_s,
|
|
124
|
+
nil,
|
|
125
|
+
!!hide_after_double_hash,
|
|
126
|
+
Float(wrap_width)
|
|
127
|
+
)
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
def set_cursor_pos(position)
|
|
131
|
+
guarded_native_call(:igSetCursorPos, StructValue.vec2(position))
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
def set_cursor_screen_pos(position)
|
|
135
|
+
guarded_native_call(:igSetCursorScreenPos, StructValue.vec2(position))
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ImGui
|
|
4
|
+
module MemoryPool
|
|
5
|
+
THREAD_KEY = :imgui_ruby_memory_pool
|
|
6
|
+
|
|
7
|
+
module_function
|
|
8
|
+
|
|
9
|
+
def pointer(type, count = 1)
|
|
10
|
+
pool = Thread.current.thread_variable_get(THREAD_KEY)
|
|
11
|
+
unless pool
|
|
12
|
+
pool = {}
|
|
13
|
+
Thread.current.thread_variable_set(THREAD_KEY, pool)
|
|
14
|
+
end
|
|
15
|
+
pool[[type, count]] ||= FFI::MemoryPointer.new(type, count)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|