imgui-bindings 0.1.10-arm64-darwin

Sign up to get free protection for your applications and to get access to all the features.
data/lib/imnodes.rb ADDED
@@ -0,0 +1,161 @@
1
+ # imgui-bindings : Yet another ImGui wrapper for Ruby
2
+ #
3
+ # * https://github.com/vaiorabbit/ruby-imgui
4
+
5
+ require 'ffi'
6
+
7
+ # ImNodes::StyleColor
8
+ ImNodesStyleColor_ColCanvasLines = 0
9
+ ImNodesStyleColor_ColNodeBg = 1
10
+ ImNodesStyleColor_ColNodeActiveBg = 2
11
+ ImNodesStyleColor_ColNodeBorder = 3
12
+ ImNodesStyleColor_ColConnection = 4
13
+ ImNodesStyleColor_ColConnectionActive = 5
14
+ ImNodesStyleColor_ColSelectBg = 6
15
+ ImNodesStyleColor_ColSelectBorder = 7
16
+ ImNodesStyleColor_ColMax = 8
17
+
18
+ # ImNodesStyleVar
19
+ ImNodesStyleVar_GridSpacing = 0 # float
20
+ ImNodesStyleVar_CurveThickness = 1 # float
21
+ ImNodesStyleVar_CurveStrength = 2 # float
22
+ ImNodesStyleVar_SlotRadius = 3 # float
23
+ ImNodesStyleVar_NodeRounding = 4 # float
24
+ ImNodesStyleVar_NodeSpacing = 5 # ImVec2
25
+ ImNodesStyleVar_ItemSpacing = 6 # ImVec2
26
+ ImNodesStyleVar_COUNT = 7
27
+
28
+ # ImNodesStyleCol
29
+ ImNodesStyleCol_GridLines = 0
30
+ ImNodesStyleCol_NodeBodyBg = 1
31
+ ImNodesStyleCol_NodeBodyBgHovered = 2
32
+ ImNodesStyleCol_NodeBodyBgActive = 3
33
+ ImNodesStyleCol_NodeBorder = 4
34
+ ImNodesStyleCol_Connection = 5
35
+ ImNodesStyleCol_ConnectionActive = 6
36
+ ImNodesStyleCol_SelectBg = 7
37
+ ImNodesStyleCol_SelectBorder = 8
38
+ ImNodesStyleCol_NodeTitleBarBg = 9
39
+ ImNodesStyleCol_NodeTitleBarBgHovered = 10
40
+ ImNodesStyleCol_NodeTitleBarBgActive = 11
41
+ ImNodesStyleCol_COUNT = 12
42
+
43
+ module ImNodes
44
+
45
+ extend FFI::Library
46
+
47
+ @@imnodes_import_done = false
48
+
49
+ class CanvasStyle < FFI::Struct
50
+ layout(
51
+ # Thickness of curves that connect slots together.
52
+ :CurveThickness, :float,
53
+ # Indent connection into slot widget a little. Useful when slot content covers connection end with some kind
54
+ # of icon (like a circle) and then no seam between icon and connection end is visible.
55
+ :ConnectionIndent, :float,
56
+ :GridSpacing, :float,
57
+ :CurveStrength, :float,
58
+ :NodeRounding, :float,
59
+ :NodeSpacing, ImVec2.by_value
60
+ )
61
+ end
62
+
63
+ class CanvasState < FFI::Struct
64
+ layout(
65
+ # Current zoom of canvas.
66
+ :Zoom, :float,
67
+ # Current scroll offset of canvas.
68
+ :Offset, ImVec2.by_value,
69
+ # Colors used to style elements of this canvas.
70
+ :Colors, [ImColor.by_value, ImNodesStyleColor_ColMax],
71
+ # Style parameters
72
+ :Style, CanvasStyle.by_value,
73
+ # Implementation detail.
74
+ :_Impl, :pointer
75
+ )
76
+
77
+ def self.create()
78
+ return CanvasState.new(ImNodesCanvasStateCtor())
79
+ end
80
+
81
+ def destroy()
82
+ ImNodesCanvasStateDtor(self)
83
+ end
84
+ end
85
+
86
+ class SlotInfo < FFI::Struct
87
+ layout(
88
+ :title, :pointer,
89
+ :kind, :int
90
+ )
91
+
92
+ def self.create(title, kind)
93
+ instance = SlotInfo.new
94
+ instance[:title] = FFI::MemoryPointer.from_string(title)
95
+ instance[:kind] = kind
96
+ return instance
97
+ end
98
+ end
99
+
100
+ def self.load_lib(libpath = './imnodes.dylib', output_error = false)
101
+ ffi_lib_flags :now, :global
102
+ ffi_lib libpath
103
+ import_symbols(output_error) unless @@imnodes_import_done
104
+ end
105
+
106
+ def self.import_symbols(output_error = false)
107
+
108
+ symbols = [
109
+ # name, func, args, returns
110
+ [:CanvasStateCtor, :ImNodesCanvasStateCtor, [], :pointer],
111
+ [:CanvasStateDtor, :ImNodesCanvasStateDtor, [:pointer], :void],
112
+ [:BeginCanvas, :ImNodesBeginCanvas, [:pointer], :void],
113
+ [:EndCanvas, :ImNodesEndCanvas, [], :void],
114
+ [:BeginNode, :ImNodesBeginNode, [:pointer, :pointer, :pointer], :bool],
115
+ [:EndNode, :ImNodesEndNode, [], :void],
116
+ [:IsNodeHovered, :ImNodesIsNodeHovered, [], :bool],
117
+ [:AutoPositionNode, :ImNodesAutoPositionNode, [:pointer], :void],
118
+ [:GetNewConnection, :ImNodesGetNewConnection, [:pointer, :pointer, :pointer, :pointer], :bool],
119
+ [:GetPendingConnection, :ImNodesGetPendingConnection, [:pointer, :pointer, :pointer], :bool],
120
+ [:Connection, :ImNodesConnection, [:pointer, :pointer, :pointer, :pointer], :bool],
121
+ [:GetCurrentCanvas, :ImNodesGetCurrentCanvas, [], :pointer],
122
+ [:InputSlotKind, :ImNodesInputSlotKind, [:int], :int],
123
+ [:OutputSlotKind, :ImNodesOutputSlotKind, [:int], :int],
124
+ [:IsInputSlotKind, :ImNodesIsInputSlotKind, [:int], :bool],
125
+ [:IsOutputSlotKind, :ImNodesIsOutputSlotKind, [:int], :bool],
126
+ [:BeginSlot, :ImNodesBeginSlot, [:pointer, :int], :bool],
127
+ [:BeginInputSlot, :ImNodesBeginInputSlot, [:pointer, :int], :bool],
128
+ [:BeginOutputSlot, :ImNodesBeginOutputSlot, [:pointer, :int], :bool],
129
+ [:EndSlot, :ImNodesEndSlot, [], :void],
130
+ [:IsSlotCurveHovered, :ImNodesIsSlotCurveHovered, [], :bool],
131
+ [:IsConnectingCompatibleSlot, :ImNodesIsConnectingCompatibleSlot, [], :bool],
132
+ [:EzCreateContext, :ImNodesEzCreateContext, [], :pointer],
133
+ [:EzFreeContext, :ImNodesEzFreeContext, [:pointer], :void],
134
+ [:EzSetContext, :ImNodesEzSetContext, [:pointer], :void],
135
+ [:EzGetState, :ImNodesEzGetState, [], :pointer],
136
+ [:EzBeginCanvas, :ImNodesEzBeginCanvas, [], :void],
137
+ [:EzEndCanvas, :ImNodesEzEndCanvas, [], :void],
138
+ [:EzBeginNode, :ImNodesEzBeginNode, [:pointer, :pointer, :pointer, :pointer], :bool],
139
+ [:EzEndNode, :ImNodesEzEndNode, [], :void],
140
+ [:EzInputSlots, :ImNodesEzInputSlots, [:pointer, :int], :void],
141
+ [:EzOutputSlots, :ImNodesEzOutputSlots, [:pointer, :int], :void],
142
+ [:EzConnection, :ImNodesEzConnection, [:pointer, :pointer, :pointer, :pointer], :bool],
143
+ [:EzPushStyleVarFloat, :ImNodesEzPushStyleVarFloat, [:int, :float], :void],
144
+ [:EzPushStyleVarVec2, :ImNodesEzPushStyleVarVec2, [:int, :pointer], :void],
145
+ [:EzPopStyleVar, :ImNodesEzPopStyleVar, [:int], :void],
146
+ [:EzPushStyleColorU32, :ImNodesEzPushStyleColorU32, [:int, :uint], :void],
147
+ [:EzPushStyleColorVec4, :ImNodesEzPushStyleColorVec4, [:int, :pointer], :void],
148
+ [:EzPopStyleColor, :ImNodesEzPopStyleColor, [:int], :void],
149
+ ]
150
+
151
+ symbols.each do |sym|
152
+ begin
153
+ attach_function *sym
154
+ rescue FFI::NotFoundError
155
+ $stderr.puts("[Warning] Failed to import #{sym}.\n") if output_error
156
+ end
157
+ end
158
+
159
+ end # self.import_symbols
160
+
161
+ end # module ImNodes
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: imgui-bindings
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.10
5
+ platform: arm64-darwin
6
+ authors:
7
+ - vaiorabbit
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2024-01-13 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: ffi
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.16'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.16'
27
+ - !ruby/object:Gem::Dependency
28
+ name: opengl-bindings2
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2'
41
+ description: 'Ruby bindings for Dear ImGui ( https://github.com/ocornut/imgui ).
42
+
43
+ '
44
+ email:
45
+ - vaiorabbit@gmail.com
46
+ executables: []
47
+ extensions: []
48
+ extra_rdoc_files: []
49
+ files:
50
+ - ChangeLog
51
+ - LICENSE.txt
52
+ - README.md
53
+ - lib/imgui.arm64.dylib
54
+ - lib/imgui.rb
55
+ - lib/imgui_impl_glfw.rb
56
+ - lib/imgui_impl_opengl2.rb
57
+ - lib/imgui_impl_opengl3.rb
58
+ - lib/imgui_impl_raylib.rb
59
+ - lib/imgui_impl_sdl2.rb
60
+ - lib/imgui_impl_sdlrenderer.rb
61
+ - lib/imgui_internal.rb
62
+ - lib/imnodes.arm64.dylib
63
+ - lib/imnodes.rb
64
+ homepage: https://github.com/vaiorabbit/ruby-imgui
65
+ licenses:
66
+ - Zlib
67
+ metadata: {}
68
+ post_install_message:
69
+ rdoc_options: []
70
+ require_paths:
71
+ - lib
72
+ required_ruby_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: 3.0.0
77
+ required_rubygems_version: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ requirements: []
83
+ rubygems_version: 3.5.3
84
+ signing_key:
85
+ specification_version: 4
86
+ summary: Bindings for Dear ImGui
87
+ test_files: []