imgui-bindings 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/lib/imnodes.rb CHANGED
@@ -1,161 +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
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
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: imgui-bindings
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - vaiorabbit
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-07 00:00:00.000000000 Z
11
+ date: 2023-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -50,9 +50,11 @@ files:
50
50
  - ChangeLog
51
51
  - LICENSE.txt
52
52
  - README.md
53
+ - lib/imgui.aarch64.so
53
54
  - lib/imgui.dll
54
55
  - lib/imgui.dylib
55
56
  - lib/imgui.rb
57
+ - lib/imgui.x86_64.so
56
58
  - lib/imgui_impl_glfw.rb
57
59
  - lib/imgui_impl_opengl2.rb
58
60
  - lib/imgui_impl_opengl3.rb
@@ -60,9 +62,11 @@ files:
60
62
  - lib/imgui_impl_sdl2.rb
61
63
  - lib/imgui_impl_sdlrenderer.rb
62
64
  - lib/imgui_internal.rb
65
+ - lib/imnodes.aarch64.so
63
66
  - lib/imnodes.dll
64
67
  - lib/imnodes.dylib
65
68
  - lib/imnodes.rb
69
+ - lib/imnodes.x86_64.so
66
70
  homepage: https://github.com/vaiorabbit/ruby-imgui
67
71
  licenses:
68
72
  - Zlib