white_gold 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/ext/dll/tgui.dll +0 -0
  3. data/ext/so/libtgui.so +0 -0
  4. data/lib/white_gold/abi/enum.rb +1 -1
  5. data/lib/white_gold/abi/interface/interface.rb +3 -7
  6. data/lib/white_gold/convention/bang_def.rb +14 -0
  7. data/lib/white_gold/convention/bang_nest.rb +1 -1
  8. data/lib/white_gold/convention/bang_nested_caller.rb +55 -22
  9. data/lib/white_gold/convention/container_widgets.rb +46 -86
  10. data/lib/white_gold/convention/page.rb +10 -4
  11. data/lib/white_gold/convention/theme/boolean_attribute.rb +11 -9
  12. data/lib/white_gold/convention/theme/color_attribute.rb +11 -9
  13. data/lib/white_gold/convention/theme/float_attribute.rb +11 -9
  14. data/lib/white_gold/convention/theme/outline_attribute.rb +11 -9
  15. data/lib/white_gold/convention/theme/text_styles_attribute.rb +14 -12
  16. data/lib/white_gold/convention/theme/texture_attribute.rb +14 -12
  17. data/lib/white_gold/convention/theme/theme_attributed.rb +1 -1
  18. data/lib/white_gold/convention/theme/theme_component.rb +1 -1
  19. data/lib/white_gold/convention/theme_attributes.rb +6 -2
  20. data/lib/white_gold/convention/widget/keyboard_control.rb +30 -0
  21. data/lib/white_gold/convention/widget_class_aliases.rb +24 -0
  22. data/lib/white_gold/dsl/canvas.rb +5 -5
  23. data/lib/white_gold/dsl/chat_box.rb +1 -1
  24. data/lib/white_gold/dsl/child_window.rb +1 -1
  25. data/lib/white_gold/dsl/color.rb +4 -2
  26. data/lib/white_gold/dsl/combo_box.rb +2 -2
  27. data/lib/white_gold/dsl/container.rb +1 -1
  28. data/lib/white_gold/dsl/custom_widget.rb +28 -0
  29. data/lib/white_gold/dsl/grid.rb +34 -10
  30. data/lib/white_gold/dsl/gui.rb +10 -1
  31. data/lib/white_gold/dsl/label.rb +3 -0
  32. data/lib/white_gold/dsl/list_box.rb +2 -2
  33. data/lib/white_gold/dsl/list_view.rb +6 -6
  34. data/lib/white_gold/dsl/menu_bar.rb +4 -4
  35. data/lib/white_gold/dsl/message_box.rb +3 -3
  36. data/lib/white_gold/dsl/panel.rb +8 -0
  37. data/lib/white_gold/dsl/panel_list_box.rb +12 -3
  38. data/lib/white_gold/dsl/radio_button.rb +15 -2
  39. data/lib/white_gold/dsl/scrollable_panel.rb +7 -0
  40. data/lib/white_gold/dsl/sfml/circle_shape.rb +4 -0
  41. data/lib/white_gold/dsl/sfml/convex_shape.rb +4 -0
  42. data/lib/white_gold/dsl/sfml/rectangle_shape.rb +4 -0
  43. data/lib/white_gold/dsl/sfml/text.rb +4 -0
  44. data/lib/white_gold/dsl/signal/global_signal.rb +1 -1
  45. data/lib/white_gold/dsl/signal/signal.rb +1 -1
  46. data/lib/white_gold/dsl/signal/signal_animation_type.rb +1 -1
  47. data/lib/white_gold/dsl/signal/signal_bool.rb +1 -1
  48. data/lib/white_gold/dsl/signal/signal_color.rb +1 -1
  49. data/lib/white_gold/dsl/signal/signal_float.rb +1 -1
  50. data/lib/white_gold/dsl/signal/signal_int.rb +1 -1
  51. data/lib/white_gold/dsl/signal/signal_pointer.rb +1 -1
  52. data/lib/white_gold/dsl/signal/signal_range.rb +1 -1
  53. data/lib/white_gold/dsl/signal/signal_show_effect.rb +1 -1
  54. data/lib/white_gold/dsl/signal/signal_string.rb +1 -1
  55. data/lib/white_gold/dsl/signal/signal_u_int.rb +1 -1
  56. data/lib/white_gold/dsl/signal/signal_vector2f.rb +1 -1
  57. data/lib/white_gold/dsl/tab_container.rb +2 -2
  58. data/lib/white_gold/dsl/tabs.rb +2 -2
  59. data/lib/white_gold/dsl/theme.rb +2 -2
  60. data/lib/white_gold/dsl/toggle_button.rb +3 -0
  61. data/lib/white_gold/dsl/tree_view.rb +2 -2
  62. data/lib/white_gold/dsl/widget.rb +53 -23
  63. data/lib/white_gold/dsl/window.rb +7 -0
  64. data/lib/white_gold/generated/tgui-abi-loader.gf.rb +76 -1
  65. data/lib/white_gold/library/theme/light.rb +8 -1
  66. data/lib/white_gold/master.rb +30 -10
  67. data/lib/white_gold/path/array.path.rb +16 -0
  68. data/lib/white_gold/tgui-abi.rb +32 -22
  69. data/lib/white_gold/version.rb +1 -1
  70. data/lib/white_gold.rb +3 -1
  71. metadata +6 -3
  72. data/lib/white_gold/abi/reducer.rb +0 -12
@@ -56,6 +56,8 @@ class ExternObject
56
56
  :size_bottom_left, :size_top_right, :size_horizontal, :size_vertical,
57
57
  :crosshair, :help, :not_allowed
58
58
 
59
+ abi_bit_enum "WindowStyle", :none, :titlebar, :resize, :close, :fullscreen, :topmost, default: 7
60
+
59
61
  end
60
62
 
61
63
  def each_file_ancestor base, dir, &b
@@ -69,12 +71,16 @@ def each_file_ancestor base, dir, &b
69
71
  end
70
72
  end
71
73
 
72
- each_file_ancestor File.dirname(__FILE__), "dsl" do |dsl_file|
73
- require_relative dsl_file
74
+ each_file_ancestor File.dirname(__FILE__), "dsl" do |file|
75
+ require_relative file
76
+ end
77
+ each_file_ancestor File.dirname(__FILE__), "convention/widget" do |file|
78
+ require_relative file
74
79
  end
75
80
 
76
81
  # ABI loader should be required after dsl directory files because of class hierarchy
77
82
  require_relative 'generated/tgui-abi-loader.gf'
83
+ require_relative 'convention/widget_class_aliases'
78
84
  require_relative 'convention/container_widgets'
79
85
  require_relative 'convention/theme_attributes'
80
86
 
@@ -155,7 +161,7 @@ class ExternObject
155
161
  when Numeric then Unit.nominate o
156
162
  when :center then "(parent.innersize - size) / 2"
157
163
  when :begin then "0"
158
- when :end then "parent.innersize - size / 2"
164
+ when :end then "parent.innersize - size"
159
165
  else raise "Invalid value `#{o}` given"
160
166
  end
161
167
  end
@@ -172,24 +178,29 @@ class ExternObject
172
178
  [abi_pack_float(x), abi_pack_float(y)]
173
179
  end
174
180
 
175
- abi_packer Tgui::Abi::Vector2u do |o|
176
- case o
177
- when Array
178
- raise "Invalid array size excepted: #{2}, given: #{o.size}" if o.size != 2
179
- return o.map{ abi_pack_integer _1 }
180
- else
181
- raise "Unable to make Vector2u from #{o}"
181
+ abi_packer Tgui::Abi::Vector2u do |*arg|
182
+ case arg.size
183
+ when 1
184
+ a = arg.first
185
+ x = y = a
186
+ when 2
187
+ x, y = *arg
188
+ else raise "Unsupported argument #{arg}"
182
189
  end
190
+ [abi_pack_integer(x), abi_pack_integer(y)]
183
191
  end
184
192
 
185
- abi_packer Tgui::Abi::UIntRect do |o|
186
- case o
187
- when Array
188
- raise "Invalid array size excepted: #{4}, given: #{o.size}" if o.size != 4
189
- return o.map{ abi_pack_integer _1 }
190
- else
191
- raise "Unable to make UIntRect from #{o}"
193
+ abi_packer Tgui::Abi::UIntRect do |*arg|
194
+ case arg.size
195
+ when 1
196
+ a = [arg.first] * 4
197
+ when 2
198
+ a = [arg[0], arg[0], arg[1], arg[1]]
199
+ when 4
200
+ a = arg
201
+ else raise "Unsupported argument #{arg}"
192
202
  end
203
+ a.map{ abi_pack_integer _1 }
193
204
  end
194
205
 
195
206
  abi_packer Tgui::Color
@@ -201,11 +212,10 @@ class ExternObject
201
212
  a = []
202
213
  (0..).each do |i|
203
214
  i *= 4
204
- ch = (o[i]) | (o[i + 1] << 8) | (o[i + 2] << 16) | (o[i + 3] << 24)
215
+ ch = (o[i] & 0xFF) | ((o[i + 1] & 0xFF) << 8) | ((o[i + 2] & 0xFF) << 16) | ((o[i + 3] & 0xFF) << 24)
205
216
  break if ch == 0
206
217
  a << ch
207
218
  end
208
- raise "deleted string!" if a[0] == 572653601
209
219
  a.pack("N*").encode("UTF-8", "UTF-32BE")
210
220
  end
211
221
 
@@ -224,7 +234,7 @@ class ExternObject
224
234
  vector2f_unpacker = proc do |o|
225
235
  v = Tgui::Vector2f.new o
226
236
  r = [v.x, v.y]
227
- Util.free(o)
237
+ Tgui::Util.free(o)
228
238
  r
229
239
  end
230
240
 
@@ -237,14 +247,14 @@ class ExternObject
237
247
  abi_unpacker Tgui::Vector2u do |o|
238
248
  v = Tgui::Vector2u.new o
239
249
  r = [v.x, v.y]
240
- Util.free(o)
250
+ Tgui::Util.free(o)
241
251
  r
242
252
  end
243
253
 
244
254
  abi_unpacker Tgui::UIntRect do |o|
245
255
  v = Tgui::UIntRect.new o
246
256
  r = [v.left, v.top, v.width, v.height]
247
- Util.free(o)
257
+ Tgui::Util.free(o)
248
258
  r
249
259
  end
250
260
 
@@ -1,3 +1,3 @@
1
1
  class WhiteGold
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/lib/white_gold.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require_relative 'white_gold/master'
2
+ require_relative 'white_gold/path/array.path'
2
3
  include Tgui
3
4
 
4
5
  @white_gold_instance = WhiteGold.new
@@ -37,7 +38,7 @@ def! :run do |page = nil|
37
38
  @white_gold_instance = nil
38
39
  end
39
40
 
40
- @white_gold_instance.init
41
+ @white_gold_instance.init window_size: $window_size, window_style: $window_style
41
42
  @white_gold_instance.load_page Page
42
43
  if $0 != 'irb'
43
44
  at_exit do
@@ -45,4 +46,5 @@ if $0 != 'irb'
45
46
  end
46
47
  end
47
48
 
49
+ BangNestedCaller.open_scope self
48
50
  BangNestedCaller.push self
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: white_gold
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Łukasz Pomietło
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-14 00:00:00.000000000 Z
11
+ date: 2024-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fiddle
@@ -55,7 +55,6 @@ files:
55
55
  - lib/white_gold/abi/interface/interface_composed_out.rb
56
56
  - lib/white_gold/abi/interface/interface_single_out.rb
57
57
  - lib/white_gold/abi/packer.rb
58
- - lib/white_gold/abi/reducer.rb
59
58
  - lib/white_gold/abi/unpacker.rb
60
59
  - lib/white_gold/convention/api_child.rb
61
60
  - lib/white_gold/convention/bang_def.rb
@@ -78,6 +77,8 @@ files:
78
77
  - lib/white_gold/convention/theme_attributes.rb
79
78
  - lib/white_gold/convention/tree_node.rb
80
79
  - lib/white_gold/convention/unit.rb
80
+ - lib/white_gold/convention/widget/keyboard_control.rb
81
+ - lib/white_gold/convention/widget_class_aliases.rb
81
82
  - lib/white_gold/convention/widget_like.rb
82
83
  - lib/white_gold/dsl/backend_gui.rb
83
84
  - lib/white_gold/dsl/bitmap_button.rb
@@ -94,6 +95,7 @@ files:
94
95
  - lib/white_gold/dsl/color_picker.rb
95
96
  - lib/white_gold/dsl/combo_box.rb
96
97
  - lib/white_gold/dsl/container.rb
98
+ - lib/white_gold/dsl/custom_widget.rb
97
99
  - lib/white_gold/dsl/edit_box.rb
98
100
  - lib/white_gold/dsl/file_dialog.rb
99
101
  - lib/white_gold/dsl/font.rb
@@ -162,6 +164,7 @@ files:
162
164
  - lib/white_gold/generated/tgui-abi-loader.gf.rb
163
165
  - lib/white_gold/library/theme/light.rb
164
166
  - lib/white_gold/master.rb
167
+ - lib/white_gold/path/array.path.rb
165
168
  - lib/white_gold/path/kernel.path.rb
166
169
  - lib/white_gold/path/numeric.path.rb
167
170
  - lib/white_gold/path/object.path.rb
@@ -1,12 +0,0 @@
1
- class Reducer
2
- def initialize reduction, &block
3
- @reduction = reduction
4
- @block = block
5
- end
6
-
7
- def call *a
8
- block.call *a
9
- end
10
-
11
- attr :reduction
12
- end