white_gold 0.0.3 → 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/enum.rb +1 -1
- data/lib/white_gold/abi/extern_object.rb +2 -2
- data/lib/white_gold/abi/interface/interface.rb +3 -7
- data/lib/white_gold/convention/container_widgets.rb +47 -87
- data/lib/white_gold/convention/page.rb +18 -8
- data/lib/white_gold/convention/theme/boolean_attribute.rb +11 -9
- data/lib/white_gold/convention/theme/color_attribute.rb +11 -9
- data/lib/white_gold/convention/theme/float_attribute.rb +11 -9
- data/lib/white_gold/convention/theme/outline_attribute.rb +11 -9
- data/lib/white_gold/convention/theme/text_styles_attribute.rb +14 -12
- data/lib/white_gold/convention/theme/texture_attribute.rb +14 -12
- data/lib/white_gold/convention/theme/theme_attributed.rb +2 -2
- data/lib/white_gold/convention/theme/theme_component.rb +2 -2
- data/lib/white_gold/convention/theme_attributes.rb +6 -2
- data/lib/white_gold/convention/widget/keyboard_control.rb +30 -0
- data/lib/white_gold/convention/widget_class_aliases.rb +24 -0
- 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/canvas.rb +5 -5
- data/lib/white_gold/dsl/chat_box.rb +1 -1
- data/lib/white_gold/dsl/child_window.rb +2 -2
- data/lib/white_gold/dsl/color.rb +39 -29
- data/lib/white_gold/dsl/combo_box.rb +2 -2
- data/lib/white_gold/dsl/container.rb +1 -1
- data/lib/white_gold/dsl/custom_widget.rb +28 -0
- data/lib/white_gold/dsl/edit_box.rb +1 -2
- data/lib/white_gold/dsl/font.rb +4 -0
- data/lib/white_gold/dsl/grid.rb +34 -10
- data/lib/white_gold/dsl/gui.rb +14 -1
- data/lib/white_gold/dsl/label.rb +3 -2
- data/lib/white_gold/dsl/list_box.rb +2 -2
- data/lib/white_gold/dsl/list_view.rb +12 -12
- data/lib/white_gold/dsl/menu_bar.rb +4 -4
- data/lib/white_gold/dsl/message_box.rb +3 -3
- data/lib/white_gold/dsl/outline.rb +4 -0
- data/lib/white_gold/dsl/panel.rb +8 -0
- data/lib/white_gold/dsl/panel_list_box.rb +12 -3
- data/lib/white_gold/dsl/picture.rb +0 -2
- data/lib/white_gold/dsl/radio_button.rb +16 -3
- data/lib/white_gold/dsl/scrollable_panel.rb +7 -0
- data/lib/white_gold/dsl/sfml/circle_shape.rb +4 -0
- data/lib/white_gold/dsl/sfml/convex_shape.rb +4 -0
- data/lib/white_gold/dsl/sfml/rectangle_shape.rb +4 -0
- data/lib/white_gold/dsl/sfml/shape.rb +3 -2
- data/lib/white_gold/dsl/sfml/text.rb +7 -1
- 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 +4 -4
- 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/texture.rb +6 -1
- data/lib/white_gold/dsl/theme.rb +3 -4
- data/lib/white_gold/dsl/toggle_button.rb +3 -0
- data/lib/white_gold/dsl/tree_view.rb +2 -2
- data/lib/white_gold/dsl/util.rb +3 -1
- data/lib/white_gold/dsl/widget.rb +59 -27
- data/lib/white_gold/dsl/window.rb +12 -2
- data/lib/white_gold/generated/tgui-abi-loader.gf.rb +106 -15
- data/lib/white_gold/library/theme/light.rb +8 -1
- data/lib/white_gold/master.rb +77 -44
- data/lib/white_gold/path/array.path.rb +9 -0
- data/lib/white_gold/path/object.path.rb +0 -6
- data/lib/white_gold/tgui-abi.rb +36 -31
- data/lib/white_gold/version.rb +1 -1
- data/lib/white_gold.rb +8 -6
- metadata +37 -9
- data/lib/white_gold/abi/reducer.rb +0 -12
- data/lib/white_gold/convention/bang_def.rb +0 -5
- data/lib/white_gold/convention/bang_nest.rb +0 -26
- data/lib/white_gold/convention/bang_nested_caller.rb +0 -48
- data/lib/white_gold/convention/proc_method_factory.rb +0 -22
@@ -3,14 +3,18 @@
|
|
3
3
|
|
4
4
|
module Tgui
|
5
5
|
module Abi
|
6
|
-
extern 'void
|
6
|
+
extern 'void ABI_STATIC_Util_deleteVector2f(Vector2f* vector)'
|
7
|
+
extern 'void ABI_STATIC_Util_deleteVector2i(Vector2i* vector)'
|
8
|
+
extern 'void ABI_STATIC_Util_deleteUIntRect(UIntRect* rect)'
|
7
9
|
extern 'void* ABI_Color_new(int r, int g, int b, int a)'
|
10
|
+
extern 'void ABI_STATIC_Color_delete(Color* color)'
|
8
11
|
extern 'int ABI_Color_get_red(Color* self)'
|
9
12
|
extern 'int ABI_Color_get_green(Color* self)'
|
10
13
|
extern 'int ABI_Color_get_blue(Color* self)'
|
11
14
|
extern 'int ABI_Color_get_alpha(Color* self)'
|
12
15
|
extern 'void* ABI_Color_applyOpacity(Color* self, float fade)'
|
13
16
|
extern 'void* ABI_Outline_new(char* left, char* right, char* top, char* bottom)'
|
17
|
+
extern 'void ABI_STATIC_Outline_delete(Outline* outline)'
|
14
18
|
extern 'float ABI_Outline_getLeft(Outline* self)'
|
15
19
|
extern 'float ABI_Outline_getRight(Outline* self)'
|
16
20
|
extern 'float ABI_Outline_getTop(Outline* self)'
|
@@ -36,10 +40,17 @@ module Tgui
|
|
36
40
|
extern 'int ABI_SignalTypedIntBoolPtr_connect(SignalTypedIntBoolPtr* self, void(*f)(int, bool*))'
|
37
41
|
extern 'int ABI_SignalTypedSizeT_connect(SignalTypedSizeT* self, void(*f)(int))'
|
38
42
|
extern 'int ABI_SignalPanelListBoxItem_connect(SignalPanelListBoxItem* self, void(*f)(const char32_t*))'
|
39
|
-
extern 'void* ABI_Window_new()'
|
43
|
+
extern 'void* ABI_Window_new(int width, int height, int style)'
|
44
|
+
extern 'void ABI_STATIC_Window_delete(sf::RenderWindow* self)'
|
40
45
|
extern 'void ABI_Window_close(sf::WindowBase* self)'
|
41
46
|
extern 'int ABI_Window_isOpen(sf::WindowBase* self)'
|
42
47
|
extern 'void ABI_Window_setTitle(sf::WindowBase* self, char* title)'
|
48
|
+
extern 'void ABI_Window_setSize(sf::WindowBase* self, int width, int height)'
|
49
|
+
extern 'void* ABI_Window_getSize(sf::WindowBase* self)'
|
50
|
+
extern 'void ABI_Window_setPosition(sf::WindowBase* self, int x, int y)'
|
51
|
+
extern 'void* ABI_Window_getPosition(sf::WindowBase* self)'
|
52
|
+
extern 'void ABI_Window_requestFocus(sf::WindowBase* self)'
|
53
|
+
extern 'int ABI_Window_hasFocus(sf::WindowBase* self)'
|
43
54
|
extern 'void ABI_BackendGui_setTextSize(BackendGui* self, int textSize)'
|
44
55
|
extern 'int ABI_BackendGui_getTextSize(BackendGui* self)'
|
45
56
|
extern 'void ABI_BackendGui_setAbsoluteView(BackendGui* self, int x, int y, int w, int h)'
|
@@ -62,9 +73,13 @@ module Tgui
|
|
62
73
|
extern 'void ABI_BackendGui_setKeyboardNavigationEnabled(BackendGui* self, int enabled)'
|
63
74
|
extern 'int ABI_BackendGui_isKeyboardNavigationEnabled(BackendGui* self)'
|
64
75
|
extern 'void* ABI_BackendGui_onViewChange(BackendGui* self)'
|
76
|
+
extern 'void* ABI_BackendGui_onWindowFocus(BackendGui* self)'
|
77
|
+
extern 'void* ABI_BackendGui_onWindowUnfocus(BackendGui* self)'
|
65
78
|
extern 'void* ABI_Font_new(char * id)'
|
79
|
+
extern 'void ABI_STATIC_Font_delete(Font* font)'
|
66
80
|
extern 'void* ABI_STATIC_Font_getGlobalFont()'
|
67
81
|
extern 'void* ABI_Gui_new(sf::RenderWindow* window)'
|
82
|
+
extern 'void ABI_STATIC_Gui_delete(Gui* self)'
|
68
83
|
extern 'int ABI_Gui_isActive(Gui* self)'
|
69
84
|
extern 'void ABI_Gui_pollEvents(Gui* self)'
|
70
85
|
extern 'void ABI_Gui_draw(Gui* self)'
|
@@ -76,12 +91,14 @@ module Tgui
|
|
76
91
|
extern 'void ABI_Gui_setClearColor(Gui* self, Color* color)'
|
77
92
|
extern 'void ABI_Gui_setClipboard(Gui* self, char* text)'
|
78
93
|
extern 'void* ABI_Gui_getClipboard(Gui* self)'
|
94
|
+
extern 'void* ABI_Gui_getScreenSize(Gui* self)'
|
79
95
|
extern 'void ABI_STATIC_Theme_setDefault(char* theme)'
|
80
96
|
extern 'void* ABI_STATIC_Theme_getDefault()'
|
81
97
|
extern 'void ABI_STATIC_Theme_finalizer(std::shared_ptr<Theme>* pointer)'
|
82
98
|
extern 'void ABI_Theme_load(std::shared_ptr<Theme>* self, char* primary)'
|
83
99
|
extern 'void* ABI_STATIC_Theme_getUnshared(std::shared_ptr<Theme>* pointer)'
|
84
100
|
extern 'void* ABI_Texture_new(char* id, int partRectX, int partRectY, int partRectW, int partRectH, int middlePartX, int middlePartY, int middlePartW, int middlePartH, int smooth)'
|
101
|
+
extern 'void ABI_STATIC_Texture_delete(Texture* texture)'
|
85
102
|
extern 'void* ABI_Texture_getId(Texture* self)'
|
86
103
|
extern 'void* ABI_Texture_getImageSize(Texture* self)'
|
87
104
|
extern 'void* ABI_Texture_getPartRect(Texture* self)'
|
@@ -143,6 +160,8 @@ module Tgui
|
|
143
160
|
extern 'void ABI_Widget_setAutoLayout(Widget::Ptr* self, int autoLayout)'
|
144
161
|
extern 'int ABI_Widget_getAutoLayout(Widget::Ptr* self)'
|
145
162
|
extern 'void* ABI_Widget_getWidgetName(Widget::Ptr* self)'
|
163
|
+
extern 'void ABI_Widget_setIgnoreMouseEvents(Widget::Ptr* self, int ignore)'
|
164
|
+
extern 'int ABI_Widget_getIgnoreMouseEvents(Widget::Ptr* self)'
|
146
165
|
extern 'void* ABI_Widget_onPositionChange(Widget::Ptr* self)'
|
147
166
|
extern 'void* ABI_Widget_onSizeChange(Widget::Ptr* self)'
|
148
167
|
extern 'void ABI_Widget_setColorRendererProperty(Widget::Ptr* self, char* property, Color* value)'
|
@@ -196,7 +215,7 @@ module Tgui
|
|
196
215
|
extern 'unsigned int ABI_EditBox_getMaximumCharacters(EditBox::Ptr* self)'
|
197
216
|
extern 'void ABI_EditBox_setAlignment(EditBox::Ptr* self, int alignment)'
|
198
217
|
extern 'int ABI_EditBox_getAlignment(EditBox::Ptr* self)'
|
199
|
-
extern 'void
|
218
|
+
extern 'void ABI_EditBox_setTextWidthLimited(EditBox::Ptr* self, int limit)'
|
200
219
|
extern 'int ABI_EditBox_isTextWidthLimited(EditBox::Ptr* self)'
|
201
220
|
extern 'void ABI_EditBox_setReadOnly(EditBox::Ptr* self, int read_only)'
|
202
221
|
extern 'int ABI_EditBox_isReadOnly(EditBox::Ptr* self)'
|
@@ -223,8 +242,6 @@ module Tgui
|
|
223
242
|
extern 'int ABI_Label_getAutoSize(Label::Ptr* self)'
|
224
243
|
extern 'void ABI_Label_setMaximumTextWidth(Label::Ptr* self, float maximumWidth)'
|
225
244
|
extern 'float ABI_Label_getMaximumTextWidth(Label::Ptr* self)'
|
226
|
-
extern 'void ABI_Label_ignoreMouseEvents(Label::Ptr* self, int ignore)'
|
227
|
-
extern 'int ABI_Label_ignoringMouseEvents(Label::Ptr* self)'
|
228
245
|
extern 'void* ABI_RadioButton_new()'
|
229
246
|
extern 'void ABI_RadioButton_setText(RadioButton::Ptr* self, char* text)'
|
230
247
|
extern 'void* ABI_RadioButton_getText(RadioButton::Ptr* self)'
|
@@ -310,7 +327,7 @@ module Tgui
|
|
310
327
|
extern 'void ABI_ChildWindow_setPositionLocked(ChildWindow::Ptr* self, int positionLocked)'
|
311
328
|
extern 'int ABI_ChildWindow_isPositionLocked(ChildWindow::Ptr* self)'
|
312
329
|
extern 'void ABI_ChildWindow_setKeepInParent(ChildWindow::Ptr* self, int enabled)'
|
313
|
-
extern 'int
|
330
|
+
extern 'int ABI_ChildWindow_getKeepInParent(ChildWindow::Ptr* self)'
|
314
331
|
extern 'void* ABI_ChildWindow_onMousePress(ChildWindow::Ptr* self)'
|
315
332
|
extern 'void* ABI_ChildWindow_onClose(ChildWindow::Ptr* self)'
|
316
333
|
extern 'void* ABI_ChildWindow_onMinimize(ChildWindow::Ptr* self)'
|
@@ -550,8 +567,6 @@ module Tgui
|
|
550
567
|
extern 'int ABI_MessageBox_getButtonAlignment(MessageBox::Ptr* self)'
|
551
568
|
extern 'void* ABI_MessageBox_onButtonPress(MessageBox::Ptr* self)'
|
552
569
|
extern 'void* ABI_Picture_new(Texture* texture, int transparent)'
|
553
|
-
extern 'void ABI_Picture_ignoreMouseEvents(Picture::Ptr* self, int ignore)'
|
554
|
-
extern 'int ABI_Picture_isIgnoringMouseEvents(Picture::Ptr* self)'
|
555
570
|
extern 'void* ABI_Picture_onDoubleClick(Picture::Ptr* self)'
|
556
571
|
extern 'void* ABI_MenuBar_new()'
|
557
572
|
extern 'void ABI_MenuBar_addMenu(MenuBar::Ptr* self, char* text)'
|
@@ -825,16 +840,20 @@ module Tgui
|
|
825
840
|
extern 'void* ABI_Shape_getOrigin(sf::Shape* self)'
|
826
841
|
extern 'int ABI_CircleShape_getPointCount(sf::CircleShape* self)'
|
827
842
|
extern 'void* ABI_CircleShape_new()'
|
843
|
+
extern 'void ABI_STATIC_CircleShape_delete(sf::CircleShape* self)'
|
828
844
|
extern 'void ABI_CircleShape_setRadius(sf::CircleShape* self, float radius)'
|
829
845
|
extern 'float ABI_CircleShape_getRadius(sf::CircleShape* self)'
|
830
846
|
extern 'void ABI_CircleShape_setPointCount(sf::CircleShape* self, int pointCount)'
|
831
847
|
extern 'void* ABI_RectangleShape_new()'
|
848
|
+
extern 'void ABI_STATIC_RectangleShape_delete(sf::RectangleShape* self)'
|
832
849
|
extern 'void ABI_RectangleShape_setSize(sf::RectangleShape* self, float width, float height)'
|
833
850
|
extern 'void* ABI_RectangleShape_getSize(sf::RectangleShape* self)'
|
834
851
|
extern 'void* ABI_ConvexShape_new()'
|
852
|
+
extern 'void ABI_STATIC_ConvexShape_delete(sf::ConvexShape* self)'
|
835
853
|
extern 'void ABI_ConvexShape_setPoint(sf::ConvexShape* self, int index, float x, float y)'
|
836
854
|
extern 'void ABI_ConvexShape_setPointCount(sf::ConvexShape* self, int pointCount)'
|
837
855
|
extern 'void* ABI_Text_new()'
|
856
|
+
extern 'void ABI_STATIC_Text_delete(sf::Text* self)'
|
838
857
|
extern 'void ABI_Text_setString(sf::Text* self, char* string)'
|
839
858
|
extern 'void* ABI_Text_getString(sf::Text* self)'
|
840
859
|
extern 'void ABI_Text_setFont(sf::Text* self, Font* font)'
|
@@ -861,14 +880,42 @@ module Tgui
|
|
861
880
|
extern 'void ABI_Text_setOrigin(sf::Text* self, float x, float y)'
|
862
881
|
extern 'void* ABI_Text_getOrigin(sf::Text* self)'
|
863
882
|
extern 'void* ABI_Text_findCharacterPos(sf::Text* self, int index)'
|
883
|
+
extern 'void* ABI_CustomWidget_new()'
|
884
|
+
extern 'void ABI_CustomWidget_implPositionChanged(CustomWidgetForBindings::Ptr* self, void(*f)(float x, float y))'
|
885
|
+
extern 'void ABI_CustomWidget_implSizeChanged(CustomWidgetForBindings::Ptr* self, void(*f)(float width, float height))'
|
886
|
+
extern 'void ABI_CustomWidget_implVisibleChanged(CustomWidgetForBindings::Ptr* self, void(*f)(int visible))'
|
887
|
+
extern 'void ABI_CustomWidget_implEnableChanged(CustomWidgetForBindings::Ptr* self, void(*f)(int enable))'
|
888
|
+
extern 'void ABI_CustomWidget_implFocusChanged(CustomWidgetForBindings::Ptr* self, void(*f)(int focus))'
|
889
|
+
extern 'void ABI_CustomWidget_implCanGainFocus(CustomWidgetForBindings::Ptr* self, int(*f)(void))'
|
890
|
+
extern 'void ABI_CustomWidget_implGetFullSize(CustomWidgetForBindings::Ptr* self, float(*f)(void))'
|
891
|
+
extern 'void ABI_CustomWidget_implGetWidgetOffset(CustomWidgetForBindings::Ptr* self, float(*f)(void))'
|
892
|
+
extern 'void ABI_CustomWidget_implUpdateTimeFunction(CustomWidgetForBindings::Ptr* self, int(*f)(int time))'
|
893
|
+
extern 'void ABI_CustomWidget_implMouseOnWidget(CustomWidgetForBindings::Ptr* self, int(*f)(float x, float y))'
|
894
|
+
extern 'void ABI_CustomWidget_implLeftMousePressed(CustomWidgetForBindings::Ptr* self, int(*f)(float x, float y))'
|
895
|
+
extern 'void ABI_CustomWidget_implLeftMouseReleased(CustomWidgetForBindings::Ptr* self, void(*f)(float x, float y))'
|
896
|
+
extern 'void ABI_CustomWidget_implRightMousePressed(CustomWidgetForBindings::Ptr* self, void(*f)(float x, float y))'
|
897
|
+
extern 'void ABI_CustomWidget_implRightMouseReleased(CustomWidgetForBindings::Ptr* self, void(*f)(float x, float y))'
|
898
|
+
extern 'void ABI_CustomWidget_implMouseMoved(CustomWidgetForBindings::Ptr* self, void(*f)(float x, float y))'
|
899
|
+
extern 'void ABI_CustomWidget_implKeyPressed(CustomWidgetForBindings::Ptr* self, void(*f)(int key, int alt, int control, int shift, int system))'
|
900
|
+
extern 'void ABI_CustomWidget_implTextEntered(CustomWidgetForBindings::Ptr* self, void(*f)(int character))'
|
901
|
+
extern 'void ABI_CustomWidget_implScrolled(CustomWidgetForBindings::Ptr* self, int(*f)(float delta, float x, float y, int touch))'
|
902
|
+
extern 'void ABI_CustomWidget_implMouseNoLongerOnWidget(CustomWidgetForBindings::Ptr* self, void(*f)(void))'
|
903
|
+
extern 'void ABI_CustomWidget_implLeftMouseButtonNoLongerDown(CustomWidgetForBindings::Ptr* self, void(*f)(void))'
|
904
|
+
extern 'void ABI_CustomWidget_implMouseEnteredWidget(CustomWidgetForBindings::Ptr* self, void(*f)(void))'
|
905
|
+
extern 'void ABI_CustomWidget_implMouseLeftWidget(CustomWidgetForBindings::Ptr* self, void(*f)(void))'
|
906
|
+
extern 'void ABI_CustomWidget_implRendererChanged(CustomWidgetForBindings::Ptr* self, int(*f)(const char32_t* property))'
|
907
|
+
extern 'void ABI_CustomWidget_implDrawFunction(CustomWidgetForBindings::Ptr* self, void(*f)(BackendRenderTarget* target, RenderStates* states))'
|
864
908
|
end
|
865
909
|
|
866
910
|
class Util
|
867
|
-
def self.
|
911
|
+
def self._abi_delete_vector2f(*a); Abi.call_arg_map! a; Abi.ABI_STATIC_Util_deleteVector2f(*a); end
|
912
|
+
def self._abi_delete_vector2i(*a); Abi.call_arg_map! a; Abi.ABI_STATIC_Util_deleteVector2i(*a); end
|
913
|
+
def self._abi_delete_u_int_rect(*a); Abi.call_arg_map! a; Abi.ABI_STATIC_Util_deleteUIntRect(*a); end
|
868
914
|
end
|
869
915
|
|
870
916
|
class Color
|
871
917
|
def initialize(*a, pointer: nil); Abi.call_arg_map! a; super(pointer: pointer || Abi.ABI_Color_new(*a)); end
|
918
|
+
def self._abi_delete(*a); Abi.call_arg_map! a; Abi.ABI_STATIC_Color_delete(*a); end
|
872
919
|
def _abi_get_red(*a); Abi.call_arg_map! a; Abi.ABI_Color_get_red(@pointer, *a); end
|
873
920
|
def _abi_get_green(*a); Abi.call_arg_map! a; Abi.ABI_Color_get_green(@pointer, *a); end
|
874
921
|
def _abi_get_blue(*a); Abi.call_arg_map! a; Abi.ABI_Color_get_blue(@pointer, *a); end
|
@@ -878,6 +925,7 @@ module Tgui
|
|
878
925
|
|
879
926
|
class Outline
|
880
927
|
def initialize(*a, pointer: nil); Abi.call_arg_map! a; super(pointer: pointer || Abi.ABI_Outline_new(*a)); end
|
928
|
+
def self._abi_delete(*a); Abi.call_arg_map! a; Abi.ABI_STATIC_Outline_delete(*a); end
|
881
929
|
def _abi_get_left(*a); Abi.call_arg_map! a; Abi.ABI_Outline_getLeft(@pointer, *a); end
|
882
930
|
def _abi_get_right(*a); Abi.call_arg_map! a; Abi.ABI_Outline_getRight(@pointer, *a); end
|
883
931
|
def _abi_get_top(*a); Abi.call_arg_map! a; Abi.ABI_Outline_getTop(@pointer, *a); end
|
@@ -958,9 +1006,16 @@ module Tgui
|
|
958
1006
|
|
959
1007
|
class Window
|
960
1008
|
def initialize(*a, pointer: nil); Abi.call_arg_map! a; super(pointer: pointer || Abi.ABI_Window_new(*a)); end
|
1009
|
+
def self._abi_delete(*a); Abi.call_arg_map! a; Abi.ABI_STATIC_Window_delete(*a); end
|
961
1010
|
def _abi_close(*a); Abi.call_arg_map! a; Abi.ABI_Window_close(@pointer, *a); end
|
962
1011
|
def _abi_is_open(*a); Abi.call_arg_map! a; Abi.ABI_Window_isOpen(@pointer, *a); end
|
963
1012
|
def _abi_set_title(*a); Abi.call_arg_map! a; Abi.ABI_Window_setTitle(@pointer, *a); end
|
1013
|
+
def _abi_set_size(*a); Abi.call_arg_map! a; Abi.ABI_Window_setSize(@pointer, *a); end
|
1014
|
+
def _abi_get_size(*a); Abi.call_arg_map! a; Abi.ABI_Window_getSize(@pointer, *a); end
|
1015
|
+
def _abi_set_position(*a); Abi.call_arg_map! a; Abi.ABI_Window_setPosition(@pointer, *a); end
|
1016
|
+
def _abi_get_position(*a); Abi.call_arg_map! a; Abi.ABI_Window_getPosition(@pointer, *a); end
|
1017
|
+
def _abi_request_focus(*a); Abi.call_arg_map! a; Abi.ABI_Window_requestFocus(@pointer, *a); end
|
1018
|
+
def _abi_has_focus(*a); Abi.call_arg_map! a; Abi.ABI_Window_hasFocus(@pointer, *a); end
|
964
1019
|
end
|
965
1020
|
|
966
1021
|
class BackendGui
|
@@ -986,15 +1041,19 @@ module Tgui
|
|
986
1041
|
def _abi_set_keyboard_navigation_enabled(*a); Abi.call_arg_map! a; Abi.ABI_BackendGui_setKeyboardNavigationEnabled(@pointer, *a); end
|
987
1042
|
def _abi_is_keyboard_navigation_enabled(*a); Abi.call_arg_map! a; Abi.ABI_BackendGui_isKeyboardNavigationEnabled(@pointer, *a); end
|
988
1043
|
def _abi_on_view_change(*a); Abi.call_arg_map! a; Abi.ABI_BackendGui_onViewChange(@pointer, *a); end
|
1044
|
+
def _abi_on_window_focus(*a); Abi.call_arg_map! a; Abi.ABI_BackendGui_onWindowFocus(@pointer, *a); end
|
1045
|
+
def _abi_on_window_unfocus(*a); Abi.call_arg_map! a; Abi.ABI_BackendGui_onWindowUnfocus(@pointer, *a); end
|
989
1046
|
end
|
990
1047
|
|
991
1048
|
class Font
|
992
1049
|
def initialize(*a, pointer: nil); Abi.call_arg_map! a; super(pointer: pointer || Abi.ABI_Font_new(*a)); end
|
1050
|
+
def self._abi_delete(*a); Abi.call_arg_map! a; Abi.ABI_STATIC_Font_delete(*a); end
|
993
1051
|
def self._abi_get_global_font(*a); Abi.call_arg_map! a; Abi.ABI_STATIC_Font_getGlobalFont(*a); end
|
994
1052
|
end
|
995
1053
|
|
996
1054
|
class Gui
|
997
1055
|
def initialize(*a, pointer: nil); Abi.call_arg_map! a; super(pointer: pointer || Abi.ABI_Gui_new(*a)); end
|
1056
|
+
def self._abi_delete(*a); Abi.call_arg_map! a; Abi.ABI_STATIC_Gui_delete(*a); end
|
998
1057
|
def _abi_is_active(*a); Abi.call_arg_map! a; Abi.ABI_Gui_isActive(@pointer, *a); end
|
999
1058
|
def _abi_poll_events(*a); Abi.call_arg_map! a; Abi.ABI_Gui_pollEvents(@pointer, *a); end
|
1000
1059
|
def _abi_draw(*a); Abi.call_arg_map! a; Abi.ABI_Gui_draw(@pointer, *a); end
|
@@ -1006,6 +1065,7 @@ module Tgui
|
|
1006
1065
|
def _abi_set_clear_color(*a); Abi.call_arg_map! a; Abi.ABI_Gui_setClearColor(@pointer, *a); end
|
1007
1066
|
def _abi_set_clipboard(*a); Abi.call_arg_map! a; Abi.ABI_Gui_setClipboard(@pointer, *a); end
|
1008
1067
|
def _abi_get_clipboard(*a); Abi.call_arg_map! a; Abi.ABI_Gui_getClipboard(@pointer, *a); end
|
1068
|
+
def _abi_get_screen_size(*a); Abi.call_arg_map! a; Abi.ABI_Gui_getScreenSize(@pointer, *a); end
|
1009
1069
|
end
|
1010
1070
|
|
1011
1071
|
class Theme
|
@@ -1018,6 +1078,7 @@ module Tgui
|
|
1018
1078
|
|
1019
1079
|
class Texture
|
1020
1080
|
def initialize(*a, pointer: nil); Abi.call_arg_map! a; super(pointer: pointer || Abi.ABI_Texture_new(*a)); end
|
1081
|
+
def self._abi_delete(*a); Abi.call_arg_map! a; Abi.ABI_STATIC_Texture_delete(*a); end
|
1021
1082
|
def _abi_get_id(*a); Abi.call_arg_map! a; Abi.ABI_Texture_getId(@pointer, *a); end
|
1022
1083
|
def _abi_get_image_size(*a); Abi.call_arg_map! a; Abi.ABI_Texture_getImageSize(@pointer, *a); end
|
1023
1084
|
def _abi_get_part_rect(*a); Abi.call_arg_map! a; Abi.ABI_Texture_getPartRect(@pointer, *a); end
|
@@ -1082,6 +1143,8 @@ module Tgui
|
|
1082
1143
|
def _abi_set_auto_layout(*a); Abi.call_arg_map! a; Abi.ABI_Widget_setAutoLayout(@pointer, *a); end
|
1083
1144
|
def _abi_get_auto_layout(*a); Abi.call_arg_map! a; Abi.ABI_Widget_getAutoLayout(@pointer, *a); end
|
1084
1145
|
def _abi_get_widget_name(*a); Abi.call_arg_map! a; Abi.ABI_Widget_getWidgetName(@pointer, *a); end
|
1146
|
+
def _abi_set_ignore_mouse_events(*a); Abi.call_arg_map! a; Abi.ABI_Widget_setIgnoreMouseEvents(@pointer, *a); end
|
1147
|
+
def _abi_get_ignore_mouse_events(*a); Abi.call_arg_map! a; Abi.ABI_Widget_getIgnoreMouseEvents(@pointer, *a); end
|
1085
1148
|
def _abi_on_position_change(*a); Abi.call_arg_map! a; Abi.ABI_Widget_onPositionChange(@pointer, *a); end
|
1086
1149
|
def _abi_on_size_change(*a); Abi.call_arg_map! a; Abi.ABI_Widget_onSizeChange(@pointer, *a); end
|
1087
1150
|
def _abi_set_color_renderer_property(*a); Abi.call_arg_map! a; Abi.ABI_Widget_setColorRendererProperty(@pointer, *a); end
|
@@ -1150,7 +1213,7 @@ module Tgui
|
|
1150
1213
|
def _abi_get_maximum_characters(*a); Abi.call_arg_map! a; Abi.ABI_EditBox_getMaximumCharacters(@pointer, *a); end
|
1151
1214
|
def _abi_set_alignment(*a); Abi.call_arg_map! a; Abi.ABI_EditBox_setAlignment(@pointer, *a); end
|
1152
1215
|
def _abi_get_alignment(*a); Abi.call_arg_map! a; Abi.ABI_EditBox_getAlignment(@pointer, *a); end
|
1153
|
-
def
|
1216
|
+
def _abi_set_text_width_limited(*a); Abi.call_arg_map! a; Abi.ABI_EditBox_setTextWidthLimited(@pointer, *a); end
|
1154
1217
|
def _abi_is_text_width_limited(*a); Abi.call_arg_map! a; Abi.ABI_EditBox_isTextWidthLimited(@pointer, *a); end
|
1155
1218
|
def _abi_set_read_only(*a); Abi.call_arg_map! a; Abi.ABI_EditBox_setReadOnly(@pointer, *a); end
|
1156
1219
|
def _abi_is_read_only(*a); Abi.call_arg_map! a; Abi.ABI_EditBox_isReadOnly(@pointer, *a); end
|
@@ -1180,8 +1243,6 @@ module Tgui
|
|
1180
1243
|
def _abi_get_auto_size(*a); Abi.call_arg_map! a; Abi.ABI_Label_getAutoSize(@pointer, *a); end
|
1181
1244
|
def _abi_set_maximum_text_width(*a); Abi.call_arg_map! a; Abi.ABI_Label_setMaximumTextWidth(@pointer, *a); end
|
1182
1245
|
def _abi_get_maximum_text_width(*a); Abi.call_arg_map! a; Abi.ABI_Label_getMaximumTextWidth(@pointer, *a); end
|
1183
|
-
def _abi_ignore_mouse_events(*a); Abi.call_arg_map! a; Abi.ABI_Label_ignoreMouseEvents(@pointer, *a); end
|
1184
|
-
def _abi_ignoring_mouse_events(*a); Abi.call_arg_map! a; Abi.ABI_Label_ignoringMouseEvents(@pointer, *a); end
|
1185
1246
|
end
|
1186
1247
|
|
1187
1248
|
class RadioButton
|
@@ -1285,7 +1346,7 @@ module Tgui
|
|
1285
1346
|
def _abi_set_position_locked(*a); Abi.call_arg_map! a; Abi.ABI_ChildWindow_setPositionLocked(@pointer, *a); end
|
1286
1347
|
def _abi_is_position_locked(*a); Abi.call_arg_map! a; Abi.ABI_ChildWindow_isPositionLocked(@pointer, *a); end
|
1287
1348
|
def _abi_set_keep_in_parent(*a); Abi.call_arg_map! a; Abi.ABI_ChildWindow_setKeepInParent(@pointer, *a); end
|
1288
|
-
def
|
1349
|
+
def _abi_get_keep_in_parent(*a); Abi.call_arg_map! a; Abi.ABI_ChildWindow_getKeepInParent(@pointer, *a); end
|
1289
1350
|
def _abi_on_mouse_press(*a); Abi.call_arg_map! a; Abi.ABI_ChildWindow_onMousePress(@pointer, *a); end
|
1290
1351
|
def _abi_on_close(*a); Abi.call_arg_map! a; Abi.ABI_ChildWindow_onClose(@pointer, *a); end
|
1291
1352
|
def _abi_on_minimize(*a); Abi.call_arg_map! a; Abi.ABI_ChildWindow_onMinimize(@pointer, *a); end
|
@@ -1576,8 +1637,6 @@ module Tgui
|
|
1576
1637
|
|
1577
1638
|
class Picture
|
1578
1639
|
def initialize(*a, pointer: nil); Abi.call_arg_map! a; super(pointer: pointer || Abi.ABI_Picture_new(*a)); end
|
1579
|
-
def _abi_ignore_mouse_events(*a); Abi.call_arg_map! a; Abi.ABI_Picture_ignoreMouseEvents(@pointer, *a); end
|
1580
|
-
def _abi_is_ignoring_mouse_events(*a); Abi.call_arg_map! a; Abi.ABI_Picture_isIgnoringMouseEvents(@pointer, *a); end
|
1581
1640
|
def _abi_on_double_click(*a); Abi.call_arg_map! a; Abi.ABI_Picture_onDoubleClick(@pointer, *a); end
|
1582
1641
|
end
|
1583
1642
|
|
@@ -1914,6 +1973,7 @@ module Tgui
|
|
1914
1973
|
class CircleShape
|
1915
1974
|
def _abi_get_point_count(*a); Abi.call_arg_map! a; Abi.ABI_CircleShape_getPointCount(@pointer, *a); end
|
1916
1975
|
def initialize(*a, pointer: nil); Abi.call_arg_map! a; super(pointer: pointer || Abi.ABI_CircleShape_new(*a)); end
|
1976
|
+
def self._abi_delete(*a); Abi.call_arg_map! a; Abi.ABI_STATIC_CircleShape_delete(*a); end
|
1917
1977
|
def _abi_set_radius(*a); Abi.call_arg_map! a; Abi.ABI_CircleShape_setRadius(@pointer, *a); end
|
1918
1978
|
def _abi_get_radius(*a); Abi.call_arg_map! a; Abi.ABI_CircleShape_getRadius(@pointer, *a); end
|
1919
1979
|
def _abi_set_point_count(*a); Abi.call_arg_map! a; Abi.ABI_CircleShape_setPointCount(@pointer, *a); end
|
@@ -1921,18 +1981,21 @@ module Tgui
|
|
1921
1981
|
|
1922
1982
|
class RectangleShape
|
1923
1983
|
def initialize(*a, pointer: nil); Abi.call_arg_map! a; super(pointer: pointer || Abi.ABI_RectangleShape_new(*a)); end
|
1984
|
+
def self._abi_delete(*a); Abi.call_arg_map! a; Abi.ABI_STATIC_RectangleShape_delete(*a); end
|
1924
1985
|
def _abi_set_size(*a); Abi.call_arg_map! a; Abi.ABI_RectangleShape_setSize(@pointer, *a); end
|
1925
1986
|
def _abi_get_size(*a); Abi.call_arg_map! a; Abi.ABI_RectangleShape_getSize(@pointer, *a); end
|
1926
1987
|
end
|
1927
1988
|
|
1928
1989
|
class ConvexShape
|
1929
1990
|
def initialize(*a, pointer: nil); Abi.call_arg_map! a; super(pointer: pointer || Abi.ABI_ConvexShape_new(*a)); end
|
1991
|
+
def self._abi_delete(*a); Abi.call_arg_map! a; Abi.ABI_STATIC_ConvexShape_delete(*a); end
|
1930
1992
|
def _abi_set_point(*a); Abi.call_arg_map! a; Abi.ABI_ConvexShape_setPoint(@pointer, *a); end
|
1931
1993
|
def _abi_set_point_count(*a); Abi.call_arg_map! a; Abi.ABI_ConvexShape_setPointCount(@pointer, *a); end
|
1932
1994
|
end
|
1933
1995
|
|
1934
1996
|
class Text
|
1935
1997
|
def initialize(*a, pointer: nil); Abi.call_arg_map! a; super(pointer: pointer || Abi.ABI_Text_new(*a)); end
|
1998
|
+
def self._abi_delete(*a); Abi.call_arg_map! a; Abi.ABI_STATIC_Text_delete(*a); end
|
1936
1999
|
def _abi_set_string(*a); Abi.call_arg_map! a; Abi.ABI_Text_setString(@pointer, *a); end
|
1937
2000
|
def _abi_get_string(*a); Abi.call_arg_map! a; Abi.ABI_Text_getString(@pointer, *a); end
|
1938
2001
|
def _abi_set_font(*a); Abi.call_arg_map! a; Abi.ABI_Text_setFont(@pointer, *a); end
|
@@ -1960,4 +2023,32 @@ module Tgui
|
|
1960
2023
|
def _abi_get_origin(*a); Abi.call_arg_map! a; Abi.ABI_Text_getOrigin(@pointer, *a); end
|
1961
2024
|
def _abi_find_character_pos(*a); Abi.call_arg_map! a; Abi.ABI_Text_findCharacterPos(@pointer, *a); end
|
1962
2025
|
end
|
2026
|
+
|
2027
|
+
class CustomWidget
|
2028
|
+
def initialize(*a, pointer: nil); Abi.call_arg_map! a; super(pointer: pointer || Abi.ABI_CustomWidget_new(*a)); end
|
2029
|
+
def _abi_impl_position_changed(*a); Abi.call_arg_map! a; Abi.ABI_CustomWidget_implPositionChanged(@pointer, *a); end
|
2030
|
+
def _abi_impl_size_changed(*a); Abi.call_arg_map! a; Abi.ABI_CustomWidget_implSizeChanged(@pointer, *a); end
|
2031
|
+
def _abi_impl_visible_changed(*a); Abi.call_arg_map! a; Abi.ABI_CustomWidget_implVisibleChanged(@pointer, *a); end
|
2032
|
+
def _abi_impl_enable_changed(*a); Abi.call_arg_map! a; Abi.ABI_CustomWidget_implEnableChanged(@pointer, *a); end
|
2033
|
+
def _abi_impl_focus_changed(*a); Abi.call_arg_map! a; Abi.ABI_CustomWidget_implFocusChanged(@pointer, *a); end
|
2034
|
+
def _abi_impl_can_gain_focus(*a); Abi.call_arg_map! a; Abi.ABI_CustomWidget_implCanGainFocus(@pointer, *a); end
|
2035
|
+
def _abi_impl_get_full_size(*a); Abi.call_arg_map! a; Abi.ABI_CustomWidget_implGetFullSize(@pointer, *a); end
|
2036
|
+
def _abi_impl_get_widget_offset(*a); Abi.call_arg_map! a; Abi.ABI_CustomWidget_implGetWidgetOffset(@pointer, *a); end
|
2037
|
+
def _abi_impl_update_time_function(*a); Abi.call_arg_map! a; Abi.ABI_CustomWidget_implUpdateTimeFunction(@pointer, *a); end
|
2038
|
+
def _abi_impl_mouse_on_widget(*a); Abi.call_arg_map! a; Abi.ABI_CustomWidget_implMouseOnWidget(@pointer, *a); end
|
2039
|
+
def _abi_impl_left_mouse_pressed(*a); Abi.call_arg_map! a; Abi.ABI_CustomWidget_implLeftMousePressed(@pointer, *a); end
|
2040
|
+
def _abi_impl_left_mouse_released(*a); Abi.call_arg_map! a; Abi.ABI_CustomWidget_implLeftMouseReleased(@pointer, *a); end
|
2041
|
+
def _abi_impl_right_mouse_pressed(*a); Abi.call_arg_map! a; Abi.ABI_CustomWidget_implRightMousePressed(@pointer, *a); end
|
2042
|
+
def _abi_impl_right_mouse_released(*a); Abi.call_arg_map! a; Abi.ABI_CustomWidget_implRightMouseReleased(@pointer, *a); end
|
2043
|
+
def _abi_impl_mouse_moved(*a); Abi.call_arg_map! a; Abi.ABI_CustomWidget_implMouseMoved(@pointer, *a); end
|
2044
|
+
def _abi_impl_key_pressed(*a); Abi.call_arg_map! a; Abi.ABI_CustomWidget_implKeyPressed(@pointer, *a); end
|
2045
|
+
def _abi_impl_text_entered(*a); Abi.call_arg_map! a; Abi.ABI_CustomWidget_implTextEntered(@pointer, *a); end
|
2046
|
+
def _abi_impl_scrolled(*a); Abi.call_arg_map! a; Abi.ABI_CustomWidget_implScrolled(@pointer, *a); end
|
2047
|
+
def _abi_impl_mouse_no_longer_on_widget(*a); Abi.call_arg_map! a; Abi.ABI_CustomWidget_implMouseNoLongerOnWidget(@pointer, *a); end
|
2048
|
+
def _abi_impl_left_mouse_button_no_longer_down(*a); Abi.call_arg_map! a; Abi.ABI_CustomWidget_implLeftMouseButtonNoLongerDown(@pointer, *a); end
|
2049
|
+
def _abi_impl_mouse_entered_widget(*a); Abi.call_arg_map! a; Abi.ABI_CustomWidget_implMouseEnteredWidget(@pointer, *a); end
|
2050
|
+
def _abi_impl_mouse_left_widget(*a); Abi.call_arg_map! a; Abi.ABI_CustomWidget_implMouseLeftWidget(@pointer, *a); end
|
2051
|
+
def _abi_impl_renderer_changed(*a); Abi.call_arg_map! a; Abi.ABI_CustomWidget_implRendererChanged(@pointer, *a); end
|
2052
|
+
def _abi_impl_draw_function(*a); Abi.call_arg_map! a; Abi.ABI_CustomWidget_implDrawFunction(@pointer, *a); end
|
2053
|
+
end
|
1963
2054
|
end
|
@@ -41,7 +41,7 @@ editbox! do
|
|
41
41
|
selected_text_background_color! 157, 185, 240
|
42
42
|
end
|
43
43
|
|
44
|
-
|
44
|
+
textarea! do
|
45
45
|
background_color! 220
|
46
46
|
default_text_color! 100
|
47
47
|
caret_width! 2
|
@@ -59,6 +59,9 @@ combobox! do
|
|
59
59
|
arrow_background_color_hover! 200
|
60
60
|
end
|
61
61
|
|
62
|
+
label! do
|
63
|
+
end
|
64
|
+
|
62
65
|
listbox! do
|
63
66
|
background_color! 240
|
64
67
|
background_color_hover! 220
|
@@ -76,6 +79,10 @@ menu! do
|
|
76
79
|
separator_side_padding! 2
|
77
80
|
end
|
78
81
|
|
82
|
+
panel! do
|
83
|
+
background_color! 235
|
84
|
+
end
|
85
|
+
|
79
86
|
progressbar! do
|
80
87
|
borders! 1
|
81
88
|
end
|
data/lib/white_gold/master.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'extree'
|
2
|
+
require 'procify'
|
1
3
|
require_relative 'convention/boolean'
|
2
4
|
require_relative 'path/kernel.path'
|
3
5
|
require_relative 'path/numeric.path'
|
@@ -9,16 +11,18 @@ require_relative 'convention/page'
|
|
9
11
|
class WhiteGold
|
10
12
|
include Tgui
|
11
13
|
|
12
|
-
def [](method_name)
|
13
|
-
method(method_name)
|
14
|
-
end
|
15
|
-
|
16
14
|
def fps=(fps)
|
17
15
|
@frame_delay = 1.0 / fps
|
18
16
|
end
|
19
17
|
|
20
|
-
def init fps: nil, theme: nil
|
21
|
-
|
18
|
+
def init fps: nil, theme: nil, window_size: nil, window_style: nil
|
19
|
+
eo = ExternObject.new pointer: nil, autofree: false # object for packing
|
20
|
+
if window_size == :fullscreen
|
21
|
+
window_style = :fullscreen
|
22
|
+
window_size = nil
|
23
|
+
end
|
24
|
+
window_size ||= [800, 600]
|
25
|
+
@window = Window.new *eo.abi_pack(Vector2i, *window_size), *eo.abi_pack(ExternObject::WindowStyle, *(window_style || :default))
|
22
26
|
@gui = Gui.new window
|
23
27
|
@preserved_pages = {}
|
24
28
|
Theme.default = theme if theme
|
@@ -28,8 +32,8 @@ class WhiteGold
|
|
28
32
|
@initialized = true
|
29
33
|
end
|
30
34
|
|
31
|
-
def run page = nil, fps: nil, theme: nil
|
32
|
-
self.init fps: fps, theme: theme if !@initialized
|
35
|
+
def run page = nil, fps: nil, theme: nil, window_size: nil, window_style: nil
|
36
|
+
self.init fps: fps, theme: theme, window_size: window_size, window_style: window_style if !@initialized
|
33
37
|
load_page page if page
|
34
38
|
|
35
39
|
next_frame_time = Time.now
|
@@ -39,6 +43,8 @@ class WhiteGold
|
|
39
43
|
if @current_page_id != @next_page_id
|
40
44
|
if @current_page_id
|
41
45
|
page = @preserved_pages[@current_page_id]
|
46
|
+
Extree::Seed.pop
|
47
|
+
Extree::Seed.close_scope page
|
42
48
|
@gui.self_remove page
|
43
49
|
page.disconnect
|
44
50
|
@preserved_pages.delete(@current_page_id)
|
@@ -62,22 +68,23 @@ class WhiteGold
|
|
62
68
|
when Class
|
63
69
|
page = @preserved_pages[page_id] = page_id.new self
|
64
70
|
init_page page
|
65
|
-
page.
|
66
|
-
page.build
|
67
|
-
end
|
71
|
+
page.build
|
68
72
|
when Proc
|
69
73
|
page = @preserved_pages[page_id] = Page.new self
|
70
74
|
init_page page
|
71
|
-
page_id
|
75
|
+
page.instance_eval &page_id
|
72
76
|
end
|
73
77
|
end
|
74
78
|
|
75
79
|
def init_page page
|
76
80
|
@gui.self_add page, "main_container"
|
81
|
+
@gui.page = page
|
77
82
|
@current_page = page
|
78
83
|
ExternObject.callback_storage = page.widget_callbacks
|
79
84
|
ExternObject.global_callback_storage = page.global_callbacks
|
80
85
|
ExternObject.data_storage = page.custom_data
|
86
|
+
Extree::Seed.open_scope page
|
87
|
+
Extree::Seed.push page
|
81
88
|
end
|
82
89
|
|
83
90
|
attr_accessor :next_page_id
|
@@ -92,60 +99,86 @@ class WhiteGold
|
|
92
99
|
end
|
93
100
|
|
94
101
|
class Job
|
95
|
-
NO_RESULT = Object.new
|
96
102
|
|
97
|
-
def initialize
|
98
|
-
@
|
103
|
+
def initialize repeat:, run: true, &b
|
104
|
+
@queue = Thread::Queue.new
|
105
|
+
@mutex = Thread::Mutex.new
|
99
106
|
@repeat = repeat
|
100
107
|
@job = b
|
101
|
-
@result = NO_RESULT
|
102
108
|
self.run if run
|
103
109
|
end
|
104
110
|
|
105
111
|
def run
|
106
|
-
|
107
|
-
|
108
|
-
|
112
|
+
if !@thread || !@thread.alive?
|
113
|
+
@thread = Thread.new do
|
114
|
+
loop do
|
115
|
+
last_spin = false
|
116
|
+
@mutex.synchronize do
|
117
|
+
last_spin = !@repeat
|
118
|
+
end
|
119
|
+
@job.call self
|
120
|
+
break if last_spin
|
121
|
+
end
|
122
|
+
end
|
109
123
|
end
|
110
124
|
end
|
111
125
|
|
112
|
-
def
|
113
|
-
@
|
114
|
-
b.(
|
126
|
+
def tip &b
|
127
|
+
@tip = b
|
128
|
+
b.(self) if @thread && !@thread.alive?
|
129
|
+
self
|
115
130
|
end
|
116
131
|
|
117
132
|
def audit
|
118
|
-
if
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
133
|
+
@tip&.call @queue.pop, self if !@queue.empty?
|
134
|
+
@thread ? @thread.alive? : !!@job
|
135
|
+
end
|
136
|
+
|
137
|
+
attr_accessor :queue
|
138
|
+
attr :repeat
|
139
|
+
|
140
|
+
def <<(value)
|
141
|
+
@queue << value
|
142
|
+
self
|
143
|
+
end
|
144
|
+
|
145
|
+
def repeat=(repeat)
|
146
|
+
@mutex.synchronize do
|
147
|
+
@repeat = repeat
|
132
148
|
end
|
133
149
|
end
|
134
150
|
|
135
|
-
def
|
136
|
-
@
|
137
|
-
@
|
151
|
+
def cancel
|
152
|
+
@thread&.kill
|
153
|
+
@thread = @job = nil
|
138
154
|
end
|
139
155
|
end
|
140
156
|
|
141
|
-
def job
|
142
|
-
job = Job.new
|
157
|
+
def job repeat: false, run: true, &b
|
158
|
+
job = Job.new repeat:, run:, &b
|
143
159
|
@jobs << job
|
144
160
|
job
|
145
161
|
end
|
146
162
|
|
147
|
-
def
|
148
|
-
|
149
|
-
|
163
|
+
def after delay = nil, run: true, &b
|
164
|
+
if delay
|
165
|
+
job run: do |j|
|
166
|
+
sleep(delay / 1000.0)
|
167
|
+
j.queue << nil
|
168
|
+
end.tip &b
|
169
|
+
else
|
170
|
+
job(run: false).tip(&b).tap{ _1.queue << nil }
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
def timer target_pulse_time, run: true, &b
|
175
|
+
nms = nil
|
176
|
+
target_pulse_time /= 1000.0 # ms => s
|
177
|
+
job repeat: true, run: do |j|
|
178
|
+
ms = Time.now
|
179
|
+
nms = (nms || ms) + target_pulse_time
|
180
|
+
j.queue << ms if j.queue.empty?
|
181
|
+
sleep(nms - ms) if nms > ms
|
182
|
+
end.tip &b
|
150
183
|
end
|
151
184
|
end
|