white_gold 0.0.2 → 0.0.3
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 +4 -4
- data/ext/dll/tgui.dll +0 -0
- data/ext/so/libtgui.so +0 -0
- data/lib/white_gold/abi/extern_object.rb +6 -1
- data/lib/white_gold/abi/unpacker.rb +4 -2
- data/lib/white_gold/convention/bang_nest.rb +12 -2
- data/lib/white_gold/convention/bang_nested_caller.rb +34 -34
- data/lib/white_gold/convention/container_widgets.rb +29 -24
- data/lib/white_gold/convention/page.rb +20 -2
- data/lib/white_gold/convention/theme/text_styles_attribute.rb +7 -2
- data/lib/white_gold/convention/theme/theme_attributed.rb +1 -1
- data/lib/white_gold/convention/tree_node.rb +43 -0
- data/lib/white_gold/convention/widget_like.rb +0 -6
- data/lib/white_gold/dsl/backend_gui.rb +1 -0
- data/lib/white_gold/dsl/canvas.rb +40 -0
- data/lib/white_gold/dsl/chat_box.rb +1 -1
- data/lib/white_gold/dsl/child_window.rb +1 -1
- data/lib/white_gold/dsl/color.rb +5 -2
- data/lib/white_gold/dsl/combo_box.rb +2 -2
- data/lib/white_gold/dsl/container.rb +17 -11
- data/lib/white_gold/dsl/font.rb +5 -1
- data/lib/white_gold/dsl/grid.rb +3 -3
- data/lib/white_gold/dsl/list_box.rb +7 -11
- data/lib/white_gold/dsl/list_view.rb +6 -6
- data/lib/white_gold/dsl/menu_bar.rb +5 -48
- data/lib/white_gold/dsl/message_box.rb +2 -2
- data/lib/white_gold/dsl/panel_list_box.rb +3 -3
- data/lib/white_gold/dsl/sfml/circle_shape.rb +7 -0
- data/lib/white_gold/dsl/sfml/convex_shape.rb +15 -0
- data/lib/white_gold/dsl/sfml/rectangle_shape.rb +7 -0
- data/lib/white_gold/dsl/sfml/shape.rb +19 -0
- data/lib/white_gold/dsl/sfml/text.rb +22 -0
- data/lib/white_gold/dsl/signal/global_signal.rb +1 -1
- data/lib/white_gold/dsl/signal/signal.rb +1 -1
- data/lib/white_gold/dsl/signal/signal_animation_type.rb +1 -1
- data/lib/white_gold/dsl/signal/signal_bool.rb +1 -1
- data/lib/white_gold/dsl/signal/signal_color.rb +1 -1
- data/lib/white_gold/dsl/signal/signal_float.rb +1 -1
- data/lib/white_gold/dsl/signal/signal_int.rb +1 -1
- data/lib/white_gold/dsl/signal/signal_pointer.rb +1 -1
- data/lib/white_gold/dsl/signal/signal_range.rb +1 -1
- data/lib/white_gold/dsl/signal/signal_show_effect.rb +1 -1
- data/lib/white_gold/dsl/signal/signal_string.rb +1 -1
- data/lib/white_gold/dsl/signal/signal_u_int.rb +1 -1
- data/lib/white_gold/dsl/signal/signal_vector2f.rb +1 -1
- data/lib/white_gold/dsl/tab_container.rb +2 -2
- data/lib/white_gold/dsl/tabs.rb +2 -2
- data/lib/white_gold/dsl/theme.rb +1 -1
- data/lib/white_gold/dsl/tree_view.rb +21 -33
- data/lib/white_gold/dsl/widget.rb +71 -38
- data/lib/white_gold/generated/tgui-abi-loader.gf.rb +197 -47
- data/lib/white_gold/master.rb +21 -40
- data/lib/white_gold/tgui-abi.rb +16 -16
- data/lib/white_gold/version.rb +3 -0
- data/lib/white_gold.rb +29 -28
- metadata +16 -5
@@ -29,7 +29,7 @@ module Tgui
|
|
29
29
|
def block_caller &b
|
30
30
|
Fiddle::Closure::BlockCaller.new(0, [Fiddle::TYPE_VOIDP, Fiddle::TYPE_VOIDP]) do |str1, str2|
|
31
31
|
id = @widget.abi_unpack_string(str2)
|
32
|
-
@widget.
|
32
|
+
@widget.send! do
|
33
33
|
b.(@widget.self_get_object_by_id(id), @widget)
|
34
34
|
end
|
35
35
|
end
|
@@ -55,26 +55,22 @@ module Tgui
|
|
55
55
|
abi_signal :on_scroll, SignalUInt
|
56
56
|
abi_attr :text_alignment, TextAlignment
|
57
57
|
|
58
|
-
class Item
|
59
|
-
def initialize list_box, id
|
60
|
-
@list_box = list_box
|
61
|
-
@id = id
|
62
|
-
end
|
58
|
+
class Item < WidgetLike
|
63
59
|
|
64
60
|
def object=(object)
|
65
|
-
|
61
|
+
host.self_objects[id] = object
|
66
62
|
end
|
67
63
|
|
68
64
|
def object
|
69
|
-
return
|
65
|
+
return host.self_objects[id]
|
70
66
|
end
|
71
67
|
|
72
68
|
def text=(text)
|
73
|
-
|
69
|
+
host._abi_change_item_by_id id, abi_pack_string(text)
|
74
70
|
end
|
75
71
|
|
76
72
|
def remove
|
77
|
-
|
73
|
+
host._abi_remove_item_by_id id
|
78
74
|
end
|
79
75
|
end
|
80
76
|
|
@@ -84,7 +80,7 @@ module Tgui
|
|
84
80
|
_abi_add_item abi_pack_string(text), abi_pack_string(id)
|
85
81
|
item = Item.new self, id
|
86
82
|
na[:object] ||= object
|
87
|
-
|
83
|
+
item.send! **na, &b
|
88
84
|
end
|
89
85
|
|
90
86
|
def remove_all
|
@@ -31,7 +31,7 @@ module Tgui
|
|
31
31
|
class ListViewItemSignal < Tgui::SignalInt
|
32
32
|
def block_caller &b
|
33
33
|
Fiddle::Closure::BlockCaller.new(0, [Fiddle::TYPE_INT]) do |index|
|
34
|
-
@widget.
|
34
|
+
@widget.send! do
|
35
35
|
b.(@widget.self_objects[index], @widget)
|
36
36
|
end
|
37
37
|
end
|
@@ -41,7 +41,7 @@ module Tgui
|
|
41
41
|
class ListViewColumnSignal < Tgui::SignalInt
|
42
42
|
def block_caller &b
|
43
43
|
Fiddle::Closure::BlockCaller.new(0, [Fiddle::TYPE_INT]) do |index|
|
44
|
-
@widget.
|
44
|
+
@widget.send! do
|
45
45
|
b.(@widget.columns[index], @widget)
|
46
46
|
end
|
47
47
|
end
|
@@ -93,14 +93,14 @@ module Tgui
|
|
93
93
|
index = _abi_add_column
|
94
94
|
column = Column.new self, index
|
95
95
|
columns << column
|
96
|
-
|
96
|
+
column.send! **na, &b
|
97
97
|
end
|
98
98
|
|
99
99
|
def! :item do |object, **na, &b|
|
100
100
|
self_add_object object, na[:index]
|
101
101
|
item = Item.new self, object
|
102
102
|
na.delete :index
|
103
|
-
|
103
|
+
item.send! **na, &b
|
104
104
|
end
|
105
105
|
|
106
106
|
def items=(items)
|
@@ -173,7 +173,7 @@ module Tgui
|
|
173
173
|
|
174
174
|
def! :grid_lines do | **na, &b|
|
175
175
|
lines = GridLines.new self
|
176
|
-
|
176
|
+
lines.send! **na, &b
|
177
177
|
end
|
178
178
|
|
179
179
|
def grid_lines=(grid_lines)
|
@@ -199,7 +199,7 @@ module Tgui
|
|
199
199
|
|
200
200
|
def! :header do |**na, &b|
|
201
201
|
header = Header.new self
|
202
|
-
|
202
|
+
header.send! **na, &b
|
203
203
|
end
|
204
204
|
|
205
205
|
def header=(header)
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require_relative 'widget'
|
2
|
+
require_relative '../convention/tree_node'
|
2
3
|
require_relative '../convention/widget_like'
|
3
4
|
require_relative 'signal/signal_item_hierarchy'
|
4
5
|
|
@@ -29,7 +30,7 @@ module Tgui
|
|
29
30
|
|
30
31
|
def connect &b
|
31
32
|
on_press = Fiddle::Closure::BlockCaller.new(0, [0]) do
|
32
|
-
@menu_bar.
|
33
|
+
@menu_bar.send! do
|
33
34
|
b.(@path.last, @path, @menu_bar)
|
34
35
|
end
|
35
36
|
end
|
@@ -56,57 +57,13 @@ module Tgui
|
|
56
57
|
end
|
57
58
|
SignalItemHierarchy.fetch_path vector, loader
|
58
59
|
object_path = @widget.self_object_path path
|
59
|
-
@widget.
|
60
|
+
@widget.send! do
|
60
61
|
b.(object_path.last, object_path, @widget)
|
61
62
|
end
|
62
63
|
end
|
63
64
|
end
|
64
65
|
end
|
65
66
|
|
66
|
-
class TreeNode
|
67
|
-
def initialize text
|
68
|
-
@text = text
|
69
|
-
@nodes = {}
|
70
|
-
end
|
71
|
-
|
72
|
-
attr_accessor :text
|
73
|
-
attr :nodes
|
74
|
-
|
75
|
-
def [](*path, grow: false)
|
76
|
-
if grow
|
77
|
-
path.reduce(self){|node, o| node.nodes[o] ||= TreeNode.new(nil) }
|
78
|
-
else
|
79
|
-
path.reduce(self){|node, o| node&.nodes[o] }
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
def cut *path, last
|
84
|
-
self[*path].nodes.delete last
|
85
|
-
end
|
86
|
-
|
87
|
-
def cut_branches *path
|
88
|
-
self[*path].nodes = {}
|
89
|
-
end
|
90
|
-
|
91
|
-
def path_str_to_object *path
|
92
|
-
object_path = []
|
93
|
-
path.reduce self do |node, str|
|
94
|
-
o, node = *node.nodes.find{|k, v| v.text == str }
|
95
|
-
object_path << o
|
96
|
-
node
|
97
|
-
end
|
98
|
-
object_path
|
99
|
-
end
|
100
|
-
|
101
|
-
def path_object_to_str *path
|
102
|
-
str_path = []
|
103
|
-
path.reduce self do |node, o|
|
104
|
-
node[o].tap{ str_path << _1.text }
|
105
|
-
end
|
106
|
-
str_path
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
67
|
api_attr :self_tree do
|
111
68
|
TreeNode.new nil
|
112
69
|
end
|
@@ -122,7 +79,7 @@ module Tgui
|
|
122
79
|
host._abi_add_menu_item _1, _2
|
123
80
|
end
|
124
81
|
item = Item.new host, item_path
|
125
|
-
|
82
|
+
item.send! **na, &b
|
126
83
|
end
|
127
84
|
|
128
85
|
def! :separator do
|
@@ -208,7 +165,7 @@ module Tgui
|
|
208
165
|
self_tree[object, grow: true].text = text
|
209
166
|
_abi_add_menu abi_pack_string(text)
|
210
167
|
item = Menu.new self, object
|
211
|
-
|
168
|
+
item.send! **na, &b
|
212
169
|
end
|
213
170
|
|
214
171
|
def items=(items)
|
@@ -37,7 +37,7 @@ module Tgui
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def press_signal_execute
|
40
|
-
host.
|
40
|
+
host.send! do
|
41
41
|
@on_press_callbacks.each do |c|
|
42
42
|
c.(id, self, host)
|
43
43
|
end
|
@@ -52,7 +52,7 @@ module Tgui
|
|
52
52
|
_abi_add_button abi_pack_string(text)
|
53
53
|
button = Button.new self, object
|
54
54
|
self_buttons[text] = button
|
55
|
-
|
55
|
+
button.send! **na, &b
|
56
56
|
end
|
57
57
|
|
58
58
|
def [](object)
|
@@ -8,7 +8,7 @@ module Tgui
|
|
8
8
|
class SignalPanelListBoxItem < Tgui::SignalPanelListBoxItem
|
9
9
|
def block_caller &b
|
10
10
|
Fiddle::Closure::BlockCaller.new(0, [Fiddle::TYPE_VOIDP]) do |id|
|
11
|
-
@widget.
|
11
|
+
@widget.send! do
|
12
12
|
b.(@widget.self_objects.key(@widget.abi_unpack_string(id)), @widget)
|
13
13
|
end
|
14
14
|
end
|
@@ -22,7 +22,7 @@ module Tgui
|
|
22
22
|
panel = Panel.new pointer: _abi_add_item(id, abi_pack_integer(index))
|
23
23
|
panel.page = page
|
24
24
|
self_objects[object] = id
|
25
|
-
|
25
|
+
panel.send! **na, &b
|
26
26
|
end
|
27
27
|
|
28
28
|
def [](object)
|
@@ -71,7 +71,7 @@ module Tgui
|
|
71
71
|
def! :template do |**na, &b|
|
72
72
|
panel = Panel.new(pointer: _abi_get_panel_template)
|
73
73
|
panel.page = page
|
74
|
-
|
74
|
+
panel.send! **na, &b
|
75
75
|
end
|
76
76
|
|
77
77
|
# internal
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require_relative 'shape'
|
2
|
+
|
3
|
+
module Tgui
|
4
|
+
class ConvexShape < Shape
|
5
|
+
def initialized
|
6
|
+
@point_count = 0
|
7
|
+
end
|
8
|
+
|
9
|
+
def! :point do |x, y|
|
10
|
+
_abi_set_point_count @point_count + 1
|
11
|
+
_abi_set_point @point_count, *abi_pack(Vector2f, x, y)
|
12
|
+
@point_count += 1
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require_relative '../../abi/extern_object'
|
2
|
+
require_relative '../../convention/bang_nest'
|
3
|
+
|
4
|
+
module Tgui
|
5
|
+
class Shape < ExternObject
|
6
|
+
include BangNest
|
7
|
+
|
8
|
+
abi_attr :texture, Texture
|
9
|
+
abi_attr :radius, Float
|
10
|
+
abi_attr :point_count, Integer
|
11
|
+
abi_attr :color, Color, :fill_color
|
12
|
+
abi_attr :border_color, Color, :outline_color
|
13
|
+
abi_attr :border, Float, :outline_thickness
|
14
|
+
abi_attr :position, Vector2f
|
15
|
+
abi_attr :rotation, Float
|
16
|
+
abi_attr :scale, Vector2f
|
17
|
+
abi_attr :origin, Vector2f
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require_relative '../../abi/extern_object'
|
2
|
+
|
3
|
+
module Tgui
|
4
|
+
class Text < ExternObject
|
5
|
+
include BangNest
|
6
|
+
|
7
|
+
abi_attr :string, String
|
8
|
+
abi_attr :font, Font
|
9
|
+
abi_attr :character_size, Integer
|
10
|
+
abi_attr :line_spacing, Float
|
11
|
+
abi_attr :letter_spacing, Float
|
12
|
+
abi_attr :style, TextStyles
|
13
|
+
abi_attr :color, Color, :fill_color
|
14
|
+
abi_attr :border_color, Color, :outline_color
|
15
|
+
abi_attr :border, Float, :outline_thickness
|
16
|
+
abi_def :character_position, :find_character_pos, Integer => Vector2f
|
17
|
+
abi_attr :position, Vector2f
|
18
|
+
abi_attr :rotation, Float
|
19
|
+
abi_attr :scale, Vector2f
|
20
|
+
abi_attr :origin, Vector2f
|
21
|
+
end
|
22
|
+
end
|
@@ -7,7 +7,7 @@ module Tgui
|
|
7
7
|
Fiddle::Closure::BlockCaller.new(0, [Fiddle::TYPE_INT, Fiddle::TYPE_INT]) do |show_effect_type, shown|
|
8
8
|
effect_type = @widget.abi_unpack ShowEffectType, show_effect_type
|
9
9
|
shown = @widget.abi_unpack Boolean, shown
|
10
|
-
@widget.
|
10
|
+
@widget.send! do
|
11
11
|
b.(effect_type, shown, @widget)
|
12
12
|
end
|
13
13
|
end
|
@@ -75,7 +75,7 @@ module Tgui
|
|
75
75
|
objects.insert index, object
|
76
76
|
tab_panel = TabPanel.new self, index, panel_pointer
|
77
77
|
tab_panel.page = page
|
78
|
-
|
78
|
+
tab_panel.send! **na, &b
|
79
79
|
end
|
80
80
|
|
81
81
|
def [](object)
|
@@ -93,7 +93,7 @@ module Tgui
|
|
93
93
|
def! :tabs do |**na, &b|
|
94
94
|
tabs = Tabs.new self, _abi_get_tabs
|
95
95
|
tabs.page = page
|
96
|
-
|
96
|
+
tabs.send! **na, &b
|
97
97
|
end
|
98
98
|
|
99
99
|
def remove object
|
data/lib/white_gold/dsl/tabs.rb
CHANGED
@@ -61,7 +61,7 @@ module Tgui
|
|
61
61
|
end
|
62
62
|
objects.insert index, object
|
63
63
|
tab = Tab.new self, index
|
64
|
-
|
64
|
+
tab.send! **na, &b
|
65
65
|
end
|
66
66
|
|
67
67
|
def remove object
|
@@ -101,7 +101,7 @@ module Tgui
|
|
101
101
|
|
102
102
|
def block_caller &b
|
103
103
|
Fiddle::Closure::BlockCaller.new(0, [0]) do
|
104
|
-
@widget.
|
104
|
+
@widget.send! do
|
105
105
|
b.(@widget.selected, @widget)
|
106
106
|
end
|
107
107
|
end
|
data/lib/white_gold/dsl/theme.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require_relative 'widget'
|
2
|
+
require_relative '../convention/tree_node'
|
2
3
|
require_relative 'signal/signal_item_hierarchy'
|
3
4
|
|
4
5
|
module Tgui
|
@@ -32,42 +33,14 @@ module Tgui
|
|
32
33
|
path << @widget.abi_unpack_string(str)
|
33
34
|
end
|
34
35
|
SignalItemHierarchy.fetch_path vector, loader
|
35
|
-
object_path = @widget.self_tree.path_str_to_object path
|
36
|
-
@widget.
|
36
|
+
object_path = @widget.self_tree.path_str_to_object *path
|
37
|
+
@widget.send! do
|
37
38
|
b.(object_path.last, object_path, @widget)
|
38
39
|
end
|
39
40
|
end
|
40
41
|
end
|
41
42
|
end
|
42
43
|
|
43
|
-
class TreeNode
|
44
|
-
def initialize object
|
45
|
-
@object = object
|
46
|
-
@nodes = {}
|
47
|
-
end
|
48
|
-
|
49
|
-
attr_accessor :object
|
50
|
-
attr :nodes
|
51
|
-
|
52
|
-
def [](*path, grow: false)
|
53
|
-
if grow
|
54
|
-
path.reduce(self){|node, str| node.nodes[str] ||= TreeNode.new nil }
|
55
|
-
else
|
56
|
-
path.reduce(self){|node, str| node&.nodes[str] }
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
def cut *path, last
|
61
|
-
self[*path].nodes.delete last
|
62
|
-
end
|
63
|
-
|
64
|
-
def path_str_to_object path
|
65
|
-
objects = []
|
66
|
-
path.reduce(self){|node, str| node[str].tap{|n| objects << n.object } }
|
67
|
-
objects
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
44
|
api_attr :self_tree do
|
72
45
|
TreeNode.new nil
|
73
46
|
end
|
@@ -121,6 +94,14 @@ module Tgui
|
|
121
94
|
Item.new host, [*path, *path_end]
|
122
95
|
end
|
123
96
|
|
97
|
+
def text=(text)
|
98
|
+
host.self_change_item path, text
|
99
|
+
end
|
100
|
+
|
101
|
+
def text
|
102
|
+
host.self_tree[*path].text
|
103
|
+
end
|
104
|
+
|
124
105
|
def object
|
125
106
|
path.last
|
126
107
|
end
|
@@ -192,15 +173,22 @@ module Tgui
|
|
192
173
|
new_path = [*path, object]
|
193
174
|
self_path_block new_path do
|
194
175
|
_abi_add_item _1, _2, abi_pack_boolean(true)
|
195
|
-
self_tree[*
|
176
|
+
self_tree[*new_path, grow: true].text = _3
|
196
177
|
end
|
197
178
|
item = Item.new self, new_path
|
198
|
-
|
179
|
+
item.send! **na, &b
|
180
|
+
end
|
181
|
+
|
182
|
+
def self_change_item path, text, **na, &b
|
183
|
+
self_path_block path do
|
184
|
+
_abi_change_item _1, _2, text
|
185
|
+
self_tree[*path].text = text
|
186
|
+
end
|
199
187
|
end
|
200
188
|
|
201
189
|
def self_path_block path, &b
|
202
190
|
path = path.map(&format)
|
203
|
-
b.(*abi_pack(String.., *path), path)
|
191
|
+
b.(*abi_pack(String.., *path), path.last)
|
204
192
|
end
|
205
193
|
end
|
206
194
|
end
|