white_gold 0.0.4 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- 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 +2 -2
- data/lib/white_gold/convention/container_widgets.rb +2 -2
- data/lib/white_gold/convention/page.rb +8 -4
- data/lib/white_gold/convention/theme/theme_attributed.rb +1 -1
- data/lib/white_gold/convention/theme/theme_component.rb +1 -1
- data/lib/white_gold/convention/widget_like.rb +1 -4
- data/lib/white_gold/dsl/backend_gui.rb +5 -4
- data/lib/white_gold/dsl/child_window.rb +1 -1
- data/lib/white_gold/dsl/color.rb +35 -27
- data/lib/white_gold/dsl/edit_box.rb +1 -2
- data/lib/white_gold/dsl/font.rb +4 -0
- data/lib/white_gold/dsl/gui.rb +5 -1
- data/lib/white_gold/dsl/label.rb +0 -2
- data/lib/white_gold/dsl/list_view.rb +6 -6
- data/lib/white_gold/dsl/outline.rb +4 -0
- data/lib/white_gold/dsl/picture.rb +0 -2
- data/lib/white_gold/dsl/radio_button.rb +1 -1
- data/lib/white_gold/dsl/sfml/shape.rb +3 -2
- data/lib/white_gold/dsl/sfml/text.rb +3 -1
- data/lib/white_gold/dsl/signal/signal_bool.rb +3 -3
- data/lib/white_gold/dsl/texture.rb +6 -1
- data/lib/white_gold/dsl/theme.rb +1 -2
- data/lib/white_gold/dsl/util.rb +3 -1
- data/lib/white_gold/dsl/widget.rb +10 -8
- data/lib/white_gold/dsl/window.rb +7 -4
- data/lib/white_gold/generated/tgui-abi-loader.gf.rb +30 -14
- data/lib/white_gold/master.rb +60 -47
- data/lib/white_gold/path/array.path.rb +0 -7
- data/lib/white_gold/path/object.path.rb +0 -6
- data/lib/white_gold/tgui-abi.rb +8 -13
- data/lib/white_gold/version.rb +1 -1
- data/lib/white_gold.rb +6 -6
- metadata +33 -8
- data/lib/white_gold/convention/bang_def.rb +0 -19
- data/lib/white_gold/convention/bang_nest.rb +0 -26
- data/lib/white_gold/convention/bang_nested_caller.rb +0 -81
- data/lib/white_gold/convention/proc_method_factory.rb +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6e9f03a09822b6e1c71191072bc13cc29023a6a3f961153216d30f02e70a017
|
4
|
+
data.tar.gz: bc946f160aa4db22056fb561b25fe3654739b2fd65ff4863471993f5d1ec4c7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e599b9ea2a700c7c106c0109caba34de0d9dbc23777d064f00193af989e56c6fb03a7bfa0200101351d19b49e8c0cca556f19c994b34bdb0b2b26e852e149ce6
|
7
|
+
data.tar.gz: 3cccc9cec49e91a52e8f53cbdada968ad5319e64dd612f56814457f238b0343ca3a562da3b4e636f25821579b5514e62fa09e86aeaf06e992a0d521049a1c7d4
|
data/ext/dll/tgui.dll
CHANGED
Binary file
|
data/ext/so/libtgui.so
CHANGED
Binary file
|
@@ -1,11 +1,10 @@
|
|
1
|
-
require_relative '../convention/bang_def'
|
2
1
|
require_relative 'packer'
|
3
2
|
require_relative 'unpacker'
|
4
3
|
|
5
4
|
class ExternObject
|
6
5
|
extend Packer
|
7
6
|
extend Unpacker
|
8
|
-
|
7
|
+
include Extree
|
9
8
|
|
10
9
|
def initialize pointer:, autofree: true
|
11
10
|
@pointer = pointer
|
@@ -14,6 +13,7 @@ class ExternObject
|
|
14
13
|
cl = self.class
|
15
14
|
while !cl.respond_to?(:finalizer)
|
16
15
|
cl = cl.superclass
|
16
|
+
raise "Undefined finalizer for #{self.class}" if cl == ExternObject
|
17
17
|
end
|
18
18
|
ObjectSpace.define_finalizer(self, cl.proc.finalizer(pointer))
|
19
19
|
end
|
@@ -53,7 +53,7 @@ module Tgui
|
|
53
53
|
end
|
54
54
|
|
55
55
|
module WidgetOwner
|
56
|
-
|
56
|
+
include Extree
|
57
57
|
|
58
58
|
def self_child_methods
|
59
59
|
## TO OPTIMIZE
|
@@ -98,7 +98,7 @@ module Tgui
|
|
98
98
|
|
99
99
|
def! :btn do |text = nil, **na, &on_press|
|
100
100
|
text = @@auto_btn_name = @@auto_btn_name.next if !text
|
101
|
-
|
101
|
+
send! :button, text:, on_press:, **na
|
102
102
|
end
|
103
103
|
|
104
104
|
def! :keyboard_control do |*a, focus: true, **na, &b|
|
@@ -24,14 +24,14 @@ class Page < Tgui::Panel
|
|
24
24
|
|
25
25
|
def respond_to? name
|
26
26
|
super ||
|
27
|
-
(name.end_with?("!") &&
|
27
|
+
(name.end_with?("!") && extree_respond_to?(name[...-1])) ||
|
28
28
|
@tgui.gui.respond_to?(name) ||
|
29
29
|
@tgui.window.respond_to?(name)
|
30
30
|
end
|
31
31
|
|
32
32
|
def method_missing name, *a, **na, &b
|
33
33
|
if name.end_with? "!"
|
34
|
-
|
34
|
+
extree_method_missing name[...-1], *a, **na, &b
|
35
35
|
elsif @tgui.gui.respond_to? name
|
36
36
|
@tgui.gui.send name, *a, **na, &b
|
37
37
|
elsif @tgui.window.respond_to? name
|
@@ -52,14 +52,18 @@ class Page < Tgui::Panel
|
|
52
52
|
@tgui.next_page_id = page
|
53
53
|
end
|
54
54
|
|
55
|
-
def job **na, &b
|
56
|
-
@tgui.job **na, &b
|
55
|
+
def job *a, **na, &b
|
56
|
+
@tgui.job *a, **na, &b
|
57
57
|
end
|
58
58
|
|
59
59
|
def timer *a, **na, &b
|
60
60
|
@tgui.timer *a, **na, &b
|
61
61
|
end
|
62
62
|
|
63
|
+
def after *a, **na, &b
|
64
|
+
@tgui.after *a, **na, &b
|
65
|
+
end
|
66
|
+
|
63
67
|
def gui
|
64
68
|
@tgui.gui
|
65
69
|
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
require_relative '../abi/extern_object'
|
2
|
-
require_relative '
|
2
|
+
require_relative 'signal/signal_bool'
|
3
3
|
require_relative 'signal/global_signal'
|
4
4
|
require_relative 'font'
|
5
5
|
|
6
6
|
module Tgui
|
7
7
|
class BackendGui < ExternObject
|
8
|
-
include
|
8
|
+
include Extree
|
9
9
|
|
10
10
|
class ViewSignal < GlobalSignal
|
11
11
|
def block_caller &b
|
@@ -21,8 +21,7 @@ module Tgui
|
|
21
21
|
abi_def :viewport=, :set_absolute_, [Integer] * 4 => nil
|
22
22
|
abi_def :viewport, :get_, nil => [Float] * 4
|
23
23
|
abi_def :relative_viewport=, [Float] * 4 => nil
|
24
|
-
|
25
|
-
abi_def :tab_focus_pass=, :tab_key_usage_enabled, Boolean => nil
|
24
|
+
abi_attr :tab_focus_enabled?, Boolean, :tab_key_usage_enabled
|
26
25
|
abi_attr :font, Font
|
27
26
|
abi_def :unfocus, :unfocus_all_widgets
|
28
27
|
abi_attr :opacity, Float
|
@@ -33,6 +32,8 @@ module Tgui
|
|
33
32
|
abi_def :crd_to_px, :map_coords_to_pixel, [Float, Float] => [Float, Float]
|
34
33
|
abi_attr :keyboard_navigation?, Boolean, :keyboard_navigation_enabled
|
35
34
|
abi_signal :on_view_change, ViewSignal
|
35
|
+
abi_signal :on_focus, Signal, :on_window_focus
|
36
|
+
abi_signal :on_unfocus, Signal, :on_window_unfocus
|
36
37
|
|
37
38
|
end
|
38
39
|
end
|
data/lib/white_gold/dsl/color.rb
CHANGED
@@ -14,36 +14,44 @@ module Tgui
|
|
14
14
|
transparent: [255, 255, 255, 0]
|
15
15
|
}
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
when
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
17
|
+
class << self
|
18
|
+
def finalizer pointer
|
19
|
+
_abi_delete pointer
|
20
|
+
end
|
21
|
+
|
22
|
+
def from *arg
|
23
|
+
case arg.size
|
24
|
+
when 1
|
25
|
+
arg = arg.first
|
26
|
+
case arg
|
27
|
+
when Color
|
28
|
+
return arg
|
29
|
+
when String
|
30
|
+
r, g, b, a = *tones_from_string(arg)
|
31
|
+
when :random
|
32
|
+
r, g, b = 5.times.map{ rand 255 }
|
33
|
+
a = 255
|
34
|
+
when Symbol
|
35
|
+
r, g, b, a = *PREDEFINED_COLORS[arg]
|
36
|
+
when Numeric
|
37
|
+
r = g = b = arg
|
38
|
+
a = 255
|
39
|
+
else raise "Unsupported argument #{arg} #{arg.class}"
|
40
|
+
end
|
41
|
+
when 2
|
42
|
+
r = g = b = arg[0]
|
43
|
+
a = arg[1]
|
44
|
+
when 3
|
45
|
+
r, g, b = *arg
|
33
46
|
a = 255
|
34
|
-
|
47
|
+
when 4
|
48
|
+
r, g, b, a = *arg
|
49
|
+
else raise "Unsupported argument #{arg}"
|
35
50
|
end
|
36
|
-
|
37
|
-
r = g = b = arg[0]
|
38
|
-
a = arg[1]
|
39
|
-
when 3
|
40
|
-
r, g, b = *arg
|
41
|
-
a = 255
|
42
|
-
when 4
|
43
|
-
r, g, b, a = *arg
|
44
|
-
else raise "Unsupported argument #{arg}"
|
51
|
+
Color.new r, g, b, a
|
45
52
|
end
|
46
|
-
|
53
|
+
|
54
|
+
alias_method :[], :from
|
47
55
|
end
|
48
56
|
|
49
57
|
abi_def :red, :get_, nil => Integer
|
@@ -51,8 +51,7 @@ module Tgui
|
|
51
51
|
abi_def :selected_text, :get_, nil => String
|
52
52
|
abi_attr :password_character, String
|
53
53
|
abi_attr :characters_limit, Integer, :maximum_characters
|
54
|
-
|
55
|
-
abi_def :limited_text_width?, :is_text_width_limited, nil => Boolean
|
54
|
+
abi_attr :text_width_limited?, Boolean, :get_
|
56
55
|
abi_attr :read_only?
|
57
56
|
abi_attr :caret_position, Integer
|
58
57
|
abi_attr :suffix, String
|
data/lib/white_gold/dsl/font.rb
CHANGED
data/lib/white_gold/dsl/gui.rb
CHANGED
@@ -4,6 +4,10 @@ require_relative 'signal/signal'
|
|
4
4
|
module Tgui
|
5
5
|
class Gui < BackendGui
|
6
6
|
|
7
|
+
def self.finalizer(pointer)
|
8
|
+
_abi_delete pointer
|
9
|
+
end
|
10
|
+
|
7
11
|
abi_def :self_add, :add, [Object, String] => nil
|
8
12
|
abi_def :self_remove, :remove, [Object] => nil
|
9
13
|
abi_def :self_active?, :is_active, nil => Boolean
|
@@ -11,7 +15,7 @@ module Tgui
|
|
11
15
|
abi_def :self_draw, :draw
|
12
16
|
abi_def :background_color=, :set_clear_color, Color => nil
|
13
17
|
abi_attr :clipboard, String
|
14
|
-
abi_def :screen_size, :get_, nil =>
|
18
|
+
abi_def :screen_size, :get_, nil => Vector2i
|
15
19
|
|
16
20
|
attr_accessor :page
|
17
21
|
|
data/lib/white_gold/dsl/label.rb
CHANGED
@@ -22,8 +22,6 @@ module Tgui
|
|
22
22
|
abi_attr :scrollbar_value, Integer
|
23
23
|
abi_attr :auto_size?, Boolean, :get_
|
24
24
|
abi_attr :max_width, Integer, :maximum_text_width
|
25
|
-
abi_def :ignore_mouse_events, Boolean => nil
|
26
|
-
abi_def :ignore_mouse_events?, :ignoring_mouse_events, nil => Boolean
|
27
25
|
abi_enum "HorizontalAlignment", :left, :center, :right
|
28
26
|
abi_attr :horizontal_alignment, HorizontalAlignment
|
29
27
|
def alignment=(a)
|
@@ -179,11 +179,11 @@ module Tgui
|
|
179
179
|
def grid_lines=(grid_lines)
|
180
180
|
case grid_lines
|
181
181
|
when Numeric
|
182
|
-
|
182
|
+
send! :grid_lines, width: grid_lines
|
183
183
|
when false
|
184
|
-
|
184
|
+
send! :grid_lines, horizontal: false, vertical: false
|
185
185
|
when Hash
|
186
|
-
|
186
|
+
send! :grid_lines, **grid_lines
|
187
187
|
end
|
188
188
|
end
|
189
189
|
|
@@ -205,11 +205,11 @@ module Tgui
|
|
205
205
|
def header=(header)
|
206
206
|
case header
|
207
207
|
when true, false
|
208
|
-
|
208
|
+
send! :header, visible: header
|
209
209
|
when Hash
|
210
|
-
|
210
|
+
send! :header, **header
|
211
211
|
when Proc
|
212
|
-
|
212
|
+
send! :header, &header
|
213
213
|
end
|
214
214
|
end
|
215
215
|
|
@@ -4,8 +4,6 @@ require_relative 'signal/signal_vector2f'
|
|
4
4
|
module Tgui
|
5
5
|
class Picture < ClickableWidget
|
6
6
|
|
7
|
-
abi_def :ignore_mouse, :ignore_mouse_events, Boolean => nil
|
8
|
-
abi_def :ignore_mouse?, :is_ignoring_mouse_events, nil => Boolean
|
9
7
|
abi_signal :on_double_click, SignalVector2f
|
10
8
|
|
11
9
|
end
|
@@ -1,9 +1,10 @@
|
|
1
1
|
require_relative '../../abi/extern_object'
|
2
|
-
require_relative '
|
2
|
+
require_relative '../color'
|
3
|
+
require_relative '../texture'
|
3
4
|
|
4
5
|
module Tgui
|
5
6
|
class Shape < ExternObject
|
6
|
-
include
|
7
|
+
include Extree
|
7
8
|
|
8
9
|
abi_attr :texture, Texture
|
9
10
|
abi_attr :radius, Float
|
@@ -1,13 +1,13 @@
|
|
1
1
|
require_relative 'signal'
|
2
2
|
|
3
3
|
module Tgui
|
4
|
-
class
|
4
|
+
class SignalBool < Signal
|
5
5
|
|
6
6
|
def block_caller &b
|
7
7
|
Fiddle::Closure::BlockCaller.new(0, [Fiddle::TYPE_INT]) do |int|
|
8
|
-
|
8
|
+
bool = @widget.abi_unpack Boolean, int
|
9
9
|
@widget.host! do
|
10
|
-
b.(
|
10
|
+
b.(bool, @widget)
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
@@ -3,6 +3,11 @@ require_relative 'color'
|
|
3
3
|
|
4
4
|
module Tgui
|
5
5
|
class Texture < ExternObject
|
6
|
+
|
7
|
+
def self.finalizer pointer
|
8
|
+
_abi_delete pointer
|
9
|
+
end
|
10
|
+
|
6
11
|
def self.from *arg
|
7
12
|
case arg.size
|
8
13
|
when 1
|
@@ -33,7 +38,7 @@ module Tgui
|
|
33
38
|
end
|
34
39
|
|
35
40
|
abi_def :id, :get_, nil => String
|
36
|
-
abi_def :image_size, :get_, nil =>
|
41
|
+
abi_def :image_size, :get_, nil => Vector2i
|
37
42
|
abi_def :part_rect, :get_, nil => UIntRect
|
38
43
|
abi_def :smooth?, nil => Boolean
|
39
44
|
abi_attr :color, Color
|
data/lib/white_gold/dsl/theme.rb
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
require 'tempfile'
|
2
2
|
require_relative '../abi/extern_object'
|
3
|
-
require_relative '../convention/bang_nest'
|
4
3
|
require_relative '../convention/theme/theme_attributed'
|
5
4
|
|
6
5
|
module Tgui
|
7
6
|
class Theme < ExternObject
|
8
|
-
include
|
7
|
+
include Extree
|
9
8
|
extend ThemeAttributed
|
10
9
|
|
11
10
|
class << self
|
data/lib/white_gold/dsl/util.rb
CHANGED
@@ -3,7 +3,9 @@ require_relative '../abi/extern_object'
|
|
3
3
|
module Tgui
|
4
4
|
class Util < ExternObject
|
5
5
|
|
6
|
-
abi_static :
|
6
|
+
abi_static :delete_vector2f
|
7
|
+
abi_static :delete_vector2i
|
8
|
+
abi_static :delete_u_int_rect
|
7
9
|
|
8
10
|
def self.expand_path path, exist: true
|
9
11
|
if !path.match?(/^\w:\//) # TODO UNIX
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require_relative '../abi/extern_object'
|
2
|
-
require_relative '../convention/bang_nest'
|
3
2
|
require_relative '../convention/unit'
|
4
3
|
require_relative '../convention/widget_like'
|
5
4
|
require_relative '../convention/api_child'
|
@@ -15,8 +14,7 @@ require_relative 'tool_tip'
|
|
15
14
|
|
16
15
|
module Tgui
|
17
16
|
class Widget < ExternObject
|
18
|
-
include
|
19
|
-
extend BangDef
|
17
|
+
include Extree
|
20
18
|
|
21
19
|
class Theme < ThemeComponent
|
22
20
|
|
@@ -59,9 +57,9 @@ module Tgui
|
|
59
57
|
def theme=(theme)
|
60
58
|
case theme
|
61
59
|
when Hash
|
62
|
-
|
60
|
+
send! :theme, **theme
|
63
61
|
when Proc
|
64
|
-
|
62
|
+
send! :theme, &theme
|
65
63
|
else
|
66
64
|
page.custom_renderers[self] = theme
|
67
65
|
self_set_renderer theme
|
@@ -74,6 +72,9 @@ module Tgui
|
|
74
72
|
def! :focus do |focus = VOID|
|
75
73
|
self.focused = focus
|
76
74
|
end
|
75
|
+
def! :unfocus do
|
76
|
+
self.focused = false
|
77
|
+
end
|
77
78
|
abi_attr :focusable?
|
78
79
|
abi_signal :on_position_change, Tgui::SignalVector2f
|
79
80
|
abi_signal :on_size_change, Tgui::SignalVector2f
|
@@ -123,12 +124,13 @@ module Tgui
|
|
123
124
|
abi_attr :mouse_cursor, CursorType
|
124
125
|
abi_def :draggable?, :is_widget_, nil => Boolean
|
125
126
|
abi_def :mouse_down?, nil => Boolean
|
127
|
+
abi_attr :ignore_mouse_events?, Boolean, :get_
|
126
128
|
|
127
129
|
abi_enum "ShowEffectType", :fade, :scale, :slide_to_right, :slide_to_left, :slide_to_bottom,
|
128
130
|
:slide_to_top, slide_from_left: :slide_to_right, slide_from_right: :slide_to_left,
|
129
131
|
slide_from_top: :slide_to_bottom, slide_from_bottom: :slide_to_top
|
130
132
|
|
131
|
-
def visible=(a)
|
133
|
+
def visible=(a = true)
|
132
134
|
if a.is_a? Array
|
133
135
|
if a[0]
|
134
136
|
show *a[1..]
|
@@ -273,7 +275,7 @@ module Tgui
|
|
273
275
|
end
|
274
276
|
|
275
277
|
def! :messagebox do |*a, **na, &b|
|
276
|
-
page.
|
278
|
+
page.send! :messagebox, *a, **na, &b
|
277
279
|
end
|
278
280
|
|
279
281
|
def! :msg do |text, **buttons|
|
@@ -285,7 +287,7 @@ module Tgui
|
|
285
287
|
end
|
286
288
|
[k, procedure]
|
287
289
|
end
|
288
|
-
page.
|
290
|
+
page.send! :messagebox, text:, position: :center, label_alignment: :center, buttons: buttons
|
289
291
|
end
|
290
292
|
|
291
293
|
def! :page do |*a, **na, &b|
|
@@ -1,9 +1,12 @@
|
|
1
1
|
require_relative '../abi/extern_object'
|
2
|
-
require_relative '../convention/bang_nest'
|
3
2
|
|
4
3
|
module Tgui
|
5
4
|
class Window < ExternObject
|
6
|
-
include
|
5
|
+
include Extree
|
6
|
+
|
7
|
+
def self.finalizer(pointer)
|
8
|
+
_abi_delete pointer
|
9
|
+
end
|
7
10
|
|
8
11
|
abi_def :close
|
9
12
|
def! :close do
|
@@ -11,8 +14,8 @@ module Tgui
|
|
11
14
|
end
|
12
15
|
abi_def :open?
|
13
16
|
abi_def :title=, String => nil
|
14
|
-
abi_attr :size,
|
15
|
-
abi_attr :position,
|
17
|
+
abi_attr :size, Vector2i
|
18
|
+
abi_attr :position, Vector2i
|
16
19
|
abi_def :has_focus?, nil => Boolean
|
17
20
|
abi_def :request_focus
|
18
21
|
def! :request_focus do
|