reflexion 0.1.6 → 0.1.7
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 +7 -0
- data/.doc/ext/reflex/application.cpp +54 -39
- data/.doc/ext/reflex/capture_event.cpp +87 -0
- data/.doc/ext/reflex/draw_event.cpp +103 -0
- data/.doc/ext/reflex/event.cpp +73 -0
- data/.doc/ext/reflex/focus_event.cpp +98 -0
- data/.doc/ext/reflex/frame_event.cpp +133 -0
- data/.doc/ext/reflex/image_view.cpp +74 -0
- data/.doc/ext/reflex/key_event.cpp +124 -0
- data/.doc/ext/reflex/native.cpp +45 -6
- data/.doc/ext/reflex/pointer_event.cpp +181 -0
- data/.doc/ext/reflex/reflex.cpp +17 -41
- data/.doc/ext/reflex/scroll_event.cpp +141 -0
- data/.doc/ext/reflex/selector.cpp +135 -0
- data/.doc/ext/reflex/style.cpp +253 -0
- data/.doc/ext/reflex/style_length.cpp +133 -0
- data/.doc/ext/reflex/style_length2.cpp +149 -0
- data/.doc/ext/reflex/style_length4.cpp +192 -0
- data/.doc/ext/reflex/update_event.cpp +77 -0
- data/.doc/ext/reflex/view.cpp +408 -88
- data/.doc/ext/reflex/wheel_event.cpp +146 -0
- data/.doc/ext/reflex/window.cpp +95 -92
- data/Rakefile +6 -5
- data/VERSION +1 -1
- data/ext/reflex/application.cpp +67 -49
- data/ext/reflex/capture_event.cpp +92 -0
- data/ext/reflex/draw_event.cpp +110 -0
- data/ext/reflex/event.cpp +77 -0
- data/ext/reflex/extconf.rb +18 -68
- data/ext/reflex/focus_event.cpp +104 -0
- data/ext/reflex/frame_event.cpp +143 -0
- data/ext/reflex/image_view.cpp +77 -0
- data/ext/reflex/key_event.cpp +133 -0
- data/ext/reflex/native.cpp +45 -6
- data/ext/reflex/pointer_event.cpp +195 -0
- data/ext/reflex/reflex.cpp +21 -47
- data/ext/reflex/scroll_event.cpp +152 -0
- data/ext/reflex/selector.cpp +144 -0
- data/ext/reflex/style.cpp +277 -0
- data/ext/reflex/style_length.cpp +140 -0
- data/ext/reflex/style_length2.cpp +157 -0
- data/ext/reflex/style_length4.cpp +204 -0
- data/ext/reflex/update_event.cpp +81 -0
- data/ext/reflex/view.cpp +469 -114
- data/ext/reflex/wheel_event.cpp +158 -0
- data/ext/reflex/window.cpp +130 -123
- data/include/reflex/application.h +12 -7
- data/include/reflex/defs.h +13 -89
- data/include/reflex/event.h +260 -0
- data/include/reflex/exception.h +17 -11
- data/include/reflex/image_view.h +45 -0
- data/include/reflex/reflex.h +2 -6
- data/include/reflex/ruby/application.h +40 -13
- data/include/reflex/ruby/event.h +72 -0
- data/include/reflex/ruby/image_view.h +25 -0
- data/include/reflex/ruby/selector.h +27 -0
- data/include/reflex/ruby/style.h +27 -0
- data/include/reflex/ruby/style_length.h +37 -0
- data/include/reflex/ruby/view.h +193 -38
- data/include/reflex/ruby/window.h +123 -39
- data/include/reflex/ruby.h +3 -2
- data/include/reflex/selector.h +64 -0
- data/include/reflex/style.h +144 -0
- data/include/reflex/style_length.h +147 -0
- data/include/reflex/view.h +182 -19
- data/include/reflex/window.h +35 -19
- data/include/reflex.h +7 -0
- data/lib/reflex/application.rb +14 -5
- data/lib/reflex/arc_shape.rb +20 -0
- data/lib/reflex/button.rb +75 -0
- data/lib/reflex/capture_event.rb +37 -0
- data/lib/reflex/color.rb +13 -0
- data/lib/reflex/color_space.rb +13 -0
- data/lib/reflex/draw_event.rb +19 -0
- data/lib/reflex/ellipse_shape.rb +20 -0
- data/lib/reflex/ext.rb +1 -1
- data/lib/reflex/flags.rb +18 -0
- data/lib/reflex/focus_event.rb +38 -0
- data/lib/reflex/font.rb +13 -0
- data/lib/reflex/frame_event.rb +42 -0
- data/lib/reflex/helper.rb +87 -30
- data/lib/reflex/image_view.rb +25 -0
- data/lib/reflex/key_event.rb +38 -0
- data/lib/reflex/line_shape.rb +20 -0
- data/lib/reflex/list_view.rb +15 -0
- data/lib/reflex/model.rb +149 -0
- data/lib/reflex/model_owner.rb +57 -0
- data/lib/reflex/model_view.rb +22 -0
- data/lib/reflex/module.rb +11 -7
- data/lib/reflex/pointer_event.rb +85 -0
- data/lib/reflex/rect_shape.rb +20 -0
- data/lib/reflex/reflex.rb +13 -2
- data/lib/reflex/scroll_event.rb +19 -0
- data/lib/reflex/selector.rb +31 -0
- data/lib/reflex/shader.rb +13 -0
- data/lib/reflex/shape.rb +34 -0
- data/lib/reflex/style.rb +55 -0
- data/lib/reflex/style_length.rb +30 -0
- data/lib/reflex/style_length2.rb +34 -0
- data/lib/reflex/style_length4.rb +38 -0
- data/lib/reflex/text_view.rb +55 -0
- data/lib/reflex/update_event.rb +19 -0
- data/lib/reflex/view.rb +38 -4
- data/lib/reflex/wheel_event.rb +19 -0
- data/lib/reflex/window.rb +7 -5
- data/lib/reflex.rb +38 -1
- data/lib/reflexion/include.rb +5 -0
- data/lib/reflexion.rb +100 -0
- data/reflex.gemspec +3 -4
- data/samples/app.rb +13 -0
- data/samples/bats.rb +91 -0
- data/samples/checker.rb +36 -0
- data/{examples/ruby/shapes.rb → samples/fans.rb} +12 -16
- data/samples/fps.rb +46 -0
- data/samples/grid.rb +60 -0
- data/{examples/ruby → samples}/hello.rb +14 -16
- data/samples/image.rb +44 -0
- data/samples/ios/hello/hello/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
- data/samples/ios/hello/hello/Images.xcassets/LaunchImage.launchimage/Contents.json +51 -0
- data/samples/ios/hello/hello/en.lproj/InfoPlist.strings +2 -0
- data/samples/ios/hello/hello/hello-Info.plist +47 -0
- data/samples/ios/hello/hello/hello-Prefix.pch +10 -0
- data/samples/ios/hello/hello/main.cpp +79 -0
- data/samples/ios/hello/hello.xcodeproj/project.pbxproj +725 -0
- data/{examples/ruby → samples}/key.rb +11 -14
- data/samples/layout.rb +89 -0
- data/samples/model.rb +86 -0
- data/samples/osx/hello/hello/Images.xcassets/AppIcon.appiconset/Contents.json +58 -0
- data/samples/osx/hello/hello/en.lproj/Credits.rtf +29 -0
- data/samples/osx/hello/hello/en.lproj/InfoPlist.strings +2 -0
- data/samples/osx/hello/hello/hello-Info.plist +32 -0
- data/samples/osx/hello/hello/hello-Prefix.pch +3 -0
- data/samples/osx/hello/hello/main.cpp +79 -0
- data/samples/osx/hello/hello.xcodeproj/project.pbxproj +725 -0
- data/samples/reflexion/hello.rb +24 -0
- data/samples/reflexion/paint.rb +40 -0
- data/samples/reflexion/pulse.rb +34 -0
- data/samples/repl.rb +69 -0
- data/samples/shader.rb +41 -0
- data/samples/shapes.rb +30 -0
- data/{examples/ruby → samples}/text.rb +7 -8
- data/samples/tree.rb +71 -0
- data/samples/views.rb +41 -0
- data/samples/visuals.rb +22 -0
- data/src/event.cpp +225 -0
- data/src/exception.cpp +24 -15
- data/src/image_view.cpp +70 -0
- data/src/ios/app_delegate.h +17 -0
- data/src/ios/app_delegate.mm +120 -0
- data/src/ios/application.mm +116 -0
- data/src/{cocoa/applicationdata.h → ios/application_data.h} +6 -6
- data/src/ios/event.h +26 -0
- data/src/ios/event.mm +31 -0
- data/src/ios/native_window.h +37 -0
- data/src/ios/native_window.mm +220 -0
- data/src/ios/opengl_view.h +13 -0
- data/src/ios/opengl_view.mm +131 -0
- data/src/{cocoa → ios}/reflex.mm +8 -12
- data/src/ios/window.mm +303 -0
- data/src/ios/window_data.h +75 -0
- data/src/osx/app_delegate.h +17 -0
- data/src/{cocoa/cocoaapplication.mm → osx/app_delegate.mm} +90 -48
- data/src/osx/application.mm +132 -0
- data/src/osx/application_data.h +45 -0
- data/src/osx/event.h +42 -0
- data/src/osx/event.mm +112 -0
- data/src/osx/native_window.h +26 -0
- data/src/osx/native_window.mm +322 -0
- data/src/{cocoa/openglview.h → osx/opengl_view.h} +0 -4
- data/src/{cocoa/openglview.mm → osx/opengl_view.mm} +66 -23
- data/src/osx/reflex.mm +50 -0
- data/src/osx/window.mm +308 -0
- data/src/osx/window_data.h +75 -0
- data/src/selector.cpp +121 -0
- data/src/style.cpp +576 -0
- data/src/style_length.cpp +341 -0
- data/src/view.cpp +1228 -129
- data/src/win32/application.cpp +1 -1
- data/src/window.cpp +54 -26
- data/test/helper.rb +8 -4
- data/test/test_capture_event.rb +41 -0
- data/test/test_event.rb +20 -0
- data/test/test_has_frame.rb +45 -0
- data/test/test_model.rb +9 -0
- data/test/test_model_owner.rb +9 -0
- data/test/test_selector.rb +75 -0
- data/test/test_style.rb +70 -0
- data/test/test_style_length.rb +38 -0
- data/test/test_style_length2.rb +50 -0
- data/test/test_style_length4.rb +56 -0
- data/test/test_view.rb +97 -23
- data/test/test_window.rb +54 -46
- metadata +205 -84
- data/.doc/ext/reflex/defs.cpp +0 -8
- data/.doc/ext/reflex/key.cpp +0 -122
- data/.doc/ext/reflex/points.cpp +0 -151
- data/.gitignore +0 -14
- data/ChangeLog +0 -8
- data/examples/hello/.gitignore +0 -2
- data/examples/hello/Rakefile +0 -41
- data/examples/hello/main.cpp +0 -18
- data/examples/ruby/app.rb +0 -13
- data/examples/ruby/checker.rb +0 -41
- data/examples/ruby/fps.rb +0 -49
- data/examples/ruby/grid.rb +0 -65
- data/examples/ruby/views.rb +0 -88
- data/examples/ruby/visuals.rb +0 -27
- data/ext/reflex/defs.cpp +0 -8
- data/ext/reflex/key.cpp +0 -129
- data/ext/reflex/points.cpp +0 -161
- data/include/reflex/ruby/key.h +0 -39
- data/include/reflex/ruby/points.h +0 -39
- data/lib/reflex/visuals/string.rb +0 -53
- data/src/cocoa/application.mm +0 -101
- data/src/cocoa/cocoaapplication.h +0 -21
- data/src/cocoa/cocoawindow.h +0 -46
- data/src/cocoa/cocoawindow.mm +0 -230
- data/src/cocoa/defs.h +0 -34
- data/src/cocoa/defs.mm +0 -87
- data/src/cocoa/window.mm +0 -148
- data/src/cocoa/windowdata.h +0 -56
- data/src/defs.cpp +0 -47
- data/src/helper.h +0 -12
- data/src/reflex.cpp +0 -43
- /data/{README → README.md} +0 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
#include "reflex/ruby/event.h"
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
#include <rucy.h>
|
|
5
|
+
#include "rays/ruby/point.h"
|
|
6
|
+
#include "defs.h"
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
using namespace Rucy;
|
|
10
|
+
|
|
11
|
+
using Reflex::coord;
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
static Class cWheelEvent;
|
|
15
|
+
|
|
16
|
+
RUCY_DEFINE_VALUE_FROM_TO(Reflex::WheelEvent, cWheelEvent)
|
|
17
|
+
|
|
18
|
+
#define THIS to<Reflex::WheelEvent*>(self)
|
|
19
|
+
|
|
20
|
+
#define CHECK RUCY_CHECK_OBJ(Reflex::WheelEvent, cWheelEvent, self)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
static
|
|
24
|
+
VALUE alloc(VALUE klass)
|
|
25
|
+
{
|
|
26
|
+
return new_type<Reflex::WheelEvent>(klass);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
static
|
|
30
|
+
VALUE initialize(VALUE self)
|
|
31
|
+
{
|
|
32
|
+
CHECK;
|
|
33
|
+
check_arg_count(__FILE__, __LINE__, "WheelEvent#initialize", argc, 0, 1, 2, 3);
|
|
34
|
+
|
|
35
|
+
THIS->dx = (argc >= 1) ? to<coord>(argv[0]) : 0;
|
|
36
|
+
THIS->dy = (argc >= 2) ? to<coord>(argv[1]) : 0;
|
|
37
|
+
THIS->dz = (argc >= 3) ? to<coord>(argv[2]) : 0;
|
|
38
|
+
|
|
39
|
+
return rb_call_super(0, NULL);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
static
|
|
43
|
+
VALUE initialize_copy(VALUE self, VALUE obj)
|
|
44
|
+
{
|
|
45
|
+
CHECK;
|
|
46
|
+
*THIS = to<Reflex::WheelEvent&>(obj);
|
|
47
|
+
return self;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
static
|
|
51
|
+
VALUE dx(VALUE self)
|
|
52
|
+
{
|
|
53
|
+
CHECK;
|
|
54
|
+
return value(THIS->dx);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
static
|
|
58
|
+
VALUE dy(VALUE self)
|
|
59
|
+
{
|
|
60
|
+
CHECK;
|
|
61
|
+
return value(THIS->dy);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
static
|
|
65
|
+
VALUE dz(VALUE self)
|
|
66
|
+
{
|
|
67
|
+
CHECK;
|
|
68
|
+
return value(THIS->dz);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
static
|
|
72
|
+
VALUE x(VALUE self)
|
|
73
|
+
{
|
|
74
|
+
CHECK;
|
|
75
|
+
return value(THIS->x);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
static
|
|
79
|
+
VALUE y(VALUE self)
|
|
80
|
+
{
|
|
81
|
+
CHECK;
|
|
82
|
+
return value(THIS->y);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
static
|
|
86
|
+
VALUE z(VALUE self)
|
|
87
|
+
{
|
|
88
|
+
CHECK;
|
|
89
|
+
return value(THIS->z);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
static
|
|
93
|
+
VALUE modifiers(VALUE self)
|
|
94
|
+
{
|
|
95
|
+
CHECK;
|
|
96
|
+
return value(THIS->modifiers);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
static
|
|
100
|
+
VALUE delta(VALUE self)
|
|
101
|
+
{
|
|
102
|
+
CHECK;
|
|
103
|
+
return value(Rays::Point(THIS->dx, THIS->dy, THIS->dz));
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
static
|
|
107
|
+
VALUE position(VALUE self)
|
|
108
|
+
{
|
|
109
|
+
CHECK;
|
|
110
|
+
return value(Rays::Point(THIS->x, THIS->y, THIS->z));
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
void
|
|
115
|
+
Init_wheel_event ()
|
|
116
|
+
{
|
|
117
|
+
Module mReflex = rb_define_module("Reflex");
|
|
118
|
+
|
|
119
|
+
cWheelEvent = mReflex.define_class("WheelEvent", Reflex::event_class());
|
|
120
|
+
rb_define_alloc_func(cWheelEvent, alloc);
|
|
121
|
+
rb_define_private_method(cWheelEvent, "initialize", RUBY_METHOD_FUNC(initialize), -1);
|
|
122
|
+
rb_define_private_method(cWheelEvent, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1);
|
|
123
|
+
rb_define_method(cWheelEvent, "dx", RUBY_METHOD_FUNC(dx), 0);
|
|
124
|
+
rb_define_method(cWheelEvent, "dy", RUBY_METHOD_FUNC(dy), 0);
|
|
125
|
+
rb_define_method(cWheelEvent, "dz", RUBY_METHOD_FUNC(dz), 0);
|
|
126
|
+
rb_define_method(cWheelEvent, "x", RUBY_METHOD_FUNC(x), 0);
|
|
127
|
+
rb_define_method(cWheelEvent, "y", RUBY_METHOD_FUNC(y), 0);
|
|
128
|
+
rb_define_method(cWheelEvent, "z", RUBY_METHOD_FUNC(z), 0);
|
|
129
|
+
rb_define_method(cWheelEvent, "modifiers", RUBY_METHOD_FUNC(modifiers), 0);
|
|
130
|
+
rb_define_method(cWheelEvent, "delta", RUBY_METHOD_FUNC(delta), 0);
|
|
131
|
+
rb_define_method(cWheelEvent, "position", RUBY_METHOD_FUNC(position), 0);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
namespace Reflex
|
|
136
|
+
{
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
Class
|
|
140
|
+
wheel_event_class ()
|
|
141
|
+
{
|
|
142
|
+
return cWheelEvent;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
}// Reflex
|
data/.doc/ext/reflex/window.cpp
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
#include <rucy.h>
|
|
5
|
+
#include <rays/ruby/bounds.h>
|
|
5
6
|
#include <rays/ruby/painter.h>
|
|
6
|
-
#include
|
|
7
|
-
#include "defs.h"
|
|
7
|
+
#include "reflex/ruby/view.h"
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
using namespace Rucy;
|
|
@@ -14,43 +14,26 @@ using Reflex::coord;
|
|
|
14
14
|
|
|
15
15
|
static Class cWindow;
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
namespace Reflex
|
|
19
|
-
{
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
Class
|
|
23
|
-
window_class ()
|
|
24
|
-
{
|
|
25
|
-
return cWindow;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}// Reflex
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
typedef Reflex::RubyWindow<Reflex::Window> RubyWindow;
|
|
33
|
-
|
|
17
|
+
RUCY_DEFINE_WRAPPER_VALUE_FROM_TO(Reflex::Window, cWindow)
|
|
34
18
|
|
|
35
19
|
#define THIS to<Reflex::Window*>(self)
|
|
36
20
|
|
|
37
|
-
#define CHECK RUCY_CHECK_OBJECT(
|
|
21
|
+
#define CHECK RUCY_CHECK_OBJECT(Reflex::Window, cWindow, self)
|
|
38
22
|
|
|
39
|
-
#define CALL(fun) RUCY_WRAPPER_CALL(
|
|
23
|
+
#define CALL(fun) RUCY_WRAPPER_CALL(Reflex::Window, THIS, fun)
|
|
40
24
|
|
|
41
25
|
|
|
42
26
|
static
|
|
43
27
|
VALUE alloc(VALUE klass)
|
|
44
28
|
{
|
|
45
|
-
return value(new RubyWindow
|
|
29
|
+
return value(new Reflex::RubyWindow<Reflex::Window>, klass);
|
|
46
30
|
}
|
|
47
31
|
|
|
48
32
|
static
|
|
49
33
|
VALUE close(VALUE self)
|
|
50
34
|
{
|
|
51
35
|
CHECK;
|
|
52
|
-
|
|
53
|
-
system_error("failed to close window.");
|
|
36
|
+
CALL(close());
|
|
54
37
|
return self;
|
|
55
38
|
}
|
|
56
39
|
|
|
@@ -58,8 +41,7 @@ static
|
|
|
58
41
|
VALUE show(VALUE self)
|
|
59
42
|
{
|
|
60
43
|
CHECK;
|
|
61
|
-
|
|
62
|
-
system_error("failed to show window.");
|
|
44
|
+
CALL(show());
|
|
63
45
|
return self;
|
|
64
46
|
}
|
|
65
47
|
|
|
@@ -67,8 +49,7 @@ static
|
|
|
67
49
|
VALUE hide(VALUE self)
|
|
68
50
|
{
|
|
69
51
|
CHECK;
|
|
70
|
-
|
|
71
|
-
system_error("failed to hide window.");
|
|
52
|
+
CALL(hide());
|
|
72
53
|
return self;
|
|
73
54
|
}
|
|
74
55
|
|
|
@@ -76,8 +57,7 @@ static
|
|
|
76
57
|
VALUE redraw(VALUE self)
|
|
77
58
|
{
|
|
78
59
|
CHECK;
|
|
79
|
-
|
|
80
|
-
system_error("failed to redraw window.");
|
|
60
|
+
THIS->redraw();
|
|
81
61
|
return self;
|
|
82
62
|
}
|
|
83
63
|
|
|
@@ -85,8 +65,7 @@ static
|
|
|
85
65
|
VALUE set_title(VALUE self, VALUE title)
|
|
86
66
|
{
|
|
87
67
|
CHECK;
|
|
88
|
-
|
|
89
|
-
system_error("failed to set title of window.");
|
|
68
|
+
THIS->set_title(title.c_str());
|
|
90
69
|
return title;
|
|
91
70
|
}
|
|
92
71
|
|
|
@@ -94,28 +73,21 @@ static
|
|
|
94
73
|
VALUE get_title(VALUE self)
|
|
95
74
|
{
|
|
96
75
|
CHECK;
|
|
97
|
-
|
|
98
|
-
if (!s) system_error("failed to get title of window.");
|
|
99
|
-
return value(s);
|
|
76
|
+
return value(THIS->title());
|
|
100
77
|
}
|
|
101
78
|
|
|
102
79
|
static
|
|
103
|
-
VALUE
|
|
80
|
+
VALUE set_frame(VALUE self, VALUE arg)
|
|
104
81
|
{
|
|
105
82
|
CHECK;
|
|
106
|
-
|
|
107
|
-
to<coord>(x), to<coord>(y), to<coord>(width), to<coord>(height)))
|
|
108
|
-
{
|
|
109
|
-
system_error("failed to set bounds of window.");
|
|
110
|
-
}
|
|
111
|
-
return value(THIS->bounds());
|
|
83
|
+
THIS->set_frame(to<Rays::Bounds>(arg));
|
|
112
84
|
}
|
|
113
85
|
|
|
114
86
|
static
|
|
115
|
-
VALUE
|
|
87
|
+
VALUE get_frame(VALUE self)
|
|
116
88
|
{
|
|
117
89
|
CHECK;
|
|
118
|
-
return value(THIS->
|
|
90
|
+
return value(THIS->frame());
|
|
119
91
|
}
|
|
120
92
|
|
|
121
93
|
static
|
|
@@ -132,6 +104,13 @@ VALUE root(VALUE self)
|
|
|
132
104
|
return value(THIS->root());
|
|
133
105
|
}
|
|
134
106
|
|
|
107
|
+
static
|
|
108
|
+
VALUE focus(VALUE self)
|
|
109
|
+
{
|
|
110
|
+
CHECK;
|
|
111
|
+
return value(THIS->focus());
|
|
112
|
+
}
|
|
113
|
+
|
|
135
114
|
static
|
|
136
115
|
VALUE painter(VALUE self)
|
|
137
116
|
{
|
|
@@ -140,87 +119,92 @@ VALUE painter(VALUE self)
|
|
|
140
119
|
}
|
|
141
120
|
|
|
142
121
|
static
|
|
143
|
-
VALUE
|
|
122
|
+
VALUE on_update(VALUE self, VALUE event)
|
|
144
123
|
{
|
|
145
124
|
CHECK;
|
|
146
|
-
CALL(
|
|
147
|
-
return self;
|
|
125
|
+
CALL(on_update(to<Reflex::UpdateEvent*>(event)));
|
|
148
126
|
}
|
|
149
127
|
|
|
150
128
|
static
|
|
151
|
-
VALUE
|
|
129
|
+
VALUE on_draw(VALUE self, VALUE event)
|
|
152
130
|
{
|
|
153
131
|
CHECK;
|
|
154
|
-
CALL(
|
|
155
|
-
return self;
|
|
132
|
+
CALL(on_draw(to<Reflex::DrawEvent*>(event)));
|
|
156
133
|
}
|
|
157
134
|
|
|
158
135
|
static
|
|
159
|
-
VALUE
|
|
136
|
+
VALUE on_move(VALUE self, VALUE event)
|
|
160
137
|
{
|
|
161
138
|
CHECK;
|
|
162
|
-
CALL(
|
|
163
|
-
return self;
|
|
139
|
+
CALL(on_move(to<Reflex::FrameEvent*>(event)));
|
|
164
140
|
}
|
|
165
141
|
|
|
166
142
|
static
|
|
167
|
-
VALUE
|
|
143
|
+
VALUE on_resize(VALUE self, VALUE event)
|
|
168
144
|
{
|
|
169
145
|
CHECK;
|
|
170
|
-
CALL(
|
|
171
|
-
return self;
|
|
146
|
+
CALL(on_resize(to<Reflex::FrameEvent*>(event)));
|
|
172
147
|
}
|
|
173
148
|
|
|
174
149
|
static
|
|
175
|
-
VALUE
|
|
150
|
+
VALUE on_key(VALUE self, VALUE event)
|
|
176
151
|
{
|
|
177
152
|
CHECK;
|
|
178
|
-
|
|
179
|
-
if (!k) argument_error();
|
|
180
|
-
CALL(key_down(*k));
|
|
181
|
-
return self;
|
|
153
|
+
CALL(on_key(to<Reflex::KeyEvent*>(event)));
|
|
182
154
|
}
|
|
183
155
|
|
|
184
156
|
static
|
|
185
|
-
VALUE
|
|
157
|
+
VALUE on_key_down(VALUE self, VALUE event)
|
|
186
158
|
{
|
|
187
159
|
CHECK;
|
|
188
|
-
|
|
189
|
-
if (!k) argument_error();
|
|
190
|
-
CALL(key_up(*k));
|
|
191
|
-
return self;
|
|
160
|
+
CALL(on_key_down(to<Reflex::KeyEvent*>(event)));
|
|
192
161
|
}
|
|
193
162
|
|
|
194
163
|
static
|
|
195
|
-
VALUE
|
|
164
|
+
VALUE on_key_up(VALUE self, VALUE event)
|
|
196
165
|
{
|
|
197
166
|
CHECK;
|
|
198
|
-
|
|
199
|
-
if (!p) argument_error();
|
|
200
|
-
CALL(points_down(*p));
|
|
201
|
-
return self;
|
|
167
|
+
CALL(on_key_up(to<Reflex::KeyEvent*>(event)));
|
|
202
168
|
}
|
|
203
169
|
|
|
204
170
|
static
|
|
205
|
-
VALUE
|
|
171
|
+
VALUE on_pointer(VALUE self, VALUE event)
|
|
206
172
|
{
|
|
207
173
|
CHECK;
|
|
208
|
-
|
|
209
|
-
if (!p) argument_error();
|
|
210
|
-
CALL(points_up(*p));
|
|
211
|
-
return self;
|
|
174
|
+
CALL(on_pointer(to<Reflex::PointerEvent*>(event)));
|
|
212
175
|
}
|
|
213
176
|
|
|
214
177
|
static
|
|
215
|
-
VALUE
|
|
178
|
+
VALUE on_pointer_down(VALUE self, VALUE event)
|
|
216
179
|
{
|
|
217
180
|
CHECK;
|
|
218
|
-
|
|
219
|
-
if (!p) argument_error();
|
|
220
|
-
CALL(points_moved(*p));
|
|
221
|
-
return self;
|
|
181
|
+
CALL(on_pointer_down(to<Reflex::PointerEvent*>(event)));
|
|
222
182
|
}
|
|
223
183
|
|
|
184
|
+
static
|
|
185
|
+
VALUE on_pointer_up(VALUE self, VALUE event)
|
|
186
|
+
{
|
|
187
|
+
CHECK;
|
|
188
|
+
CALL(on_pointer_up(to<Reflex::PointerEvent*>(event)));
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
static
|
|
192
|
+
VALUE on_pointer_move(VALUE self, VALUE event)
|
|
193
|
+
{
|
|
194
|
+
CHECK;
|
|
195
|
+
CALL(on_pointer_move(to<Reflex::PointerEvent*>(event)));
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
static
|
|
199
|
+
VALUE on_wheel(VALUE self, VALUE event)
|
|
200
|
+
{
|
|
201
|
+
CHECK;
|
|
202
|
+
CALL(on_wheel(to<Reflex::WheelEvent*>(event)));
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
static
|
|
206
|
+
RUCY_DEF_clear_override_flags(cof, Reflex::Window, cWindow);
|
|
207
|
+
|
|
224
208
|
|
|
225
209
|
void
|
|
226
210
|
Init_window ()
|
|
@@ -235,18 +219,37 @@ Init_window ()
|
|
|
235
219
|
rb_define_method(cWindow, "redraw", RUBY_METHOD_FUNC(redraw), 0);
|
|
236
220
|
rb_define_method(cWindow, "title=", RUBY_METHOD_FUNC(set_title), 1);
|
|
237
221
|
rb_define_method(cWindow, "title", RUBY_METHOD_FUNC(get_title), 0);
|
|
238
|
-
rb_define_private_method(cWindow, "
|
|
239
|
-
rb_define_private_method(cWindow, "
|
|
222
|
+
rb_define_private_method(cWindow, "set_frame", RUBY_METHOD_FUNC(set_frame), 1);
|
|
223
|
+
rb_define_private_method(cWindow, "get_frame", RUBY_METHOD_FUNC(get_frame), 0);
|
|
240
224
|
rb_define_method(cWindow, "hidden", RUBY_METHOD_FUNC(hidden), 0);
|
|
241
225
|
rb_define_method(cWindow, "root", RUBY_METHOD_FUNC(root), 0);
|
|
226
|
+
rb_define_method(cWindow, "focus", RUBY_METHOD_FUNC(focus), 0);
|
|
242
227
|
rb_define_method(cWindow, "painter", RUBY_METHOD_FUNC(painter), 0);
|
|
243
|
-
rb_define_method(cWindow, "
|
|
244
|
-
rb_define_method(cWindow, "
|
|
245
|
-
rb_define_method(cWindow, "
|
|
246
|
-
rb_define_method(cWindow, "
|
|
247
|
-
rb_define_method(cWindow, "
|
|
248
|
-
rb_define_method(cWindow, "
|
|
249
|
-
rb_define_method(cWindow, "
|
|
250
|
-
rb_define_method(cWindow, "
|
|
251
|
-
rb_define_method(cWindow, "
|
|
228
|
+
rb_define_method(cWindow, "on_update", RUBY_METHOD_FUNC(on_update), 1);
|
|
229
|
+
rb_define_method(cWindow, "on_draw", RUBY_METHOD_FUNC(on_draw), 1);
|
|
230
|
+
rb_define_method(cWindow, "on_move", RUBY_METHOD_FUNC(on_move), 1);
|
|
231
|
+
rb_define_method(cWindow, "on_resize", RUBY_METHOD_FUNC(on_resize), 1);
|
|
232
|
+
rb_define_method(cWindow, "on_key", RUBY_METHOD_FUNC(on_key), 1);
|
|
233
|
+
rb_define_method(cWindow, "on_key_down", RUBY_METHOD_FUNC(on_key_down), 1);
|
|
234
|
+
rb_define_method(cWindow, "on_key_up", RUBY_METHOD_FUNC(on_key_up), 1);
|
|
235
|
+
rb_define_method(cWindow, "on_pointer", RUBY_METHOD_FUNC(on_pointer), 1);
|
|
236
|
+
rb_define_method(cWindow, "on_pointer_down", RUBY_METHOD_FUNC(on_pointer_down), 1);
|
|
237
|
+
rb_define_method(cWindow, "on_pointer_up", RUBY_METHOD_FUNC(on_pointer_up), 1);
|
|
238
|
+
rb_define_method(cWindow, "on_pointer_move", RUBY_METHOD_FUNC(on_pointer_move), 1);
|
|
239
|
+
rb_define_method(cWindow, "on_wheel", RUBY_METHOD_FUNC(on_wheel), 1);
|
|
240
|
+
|
|
252
241
|
}
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
namespace Reflex
|
|
245
|
+
{
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
Class
|
|
249
|
+
window_class ()
|
|
250
|
+
{
|
|
251
|
+
return cWindow;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
}// Reflex
|
data/Rakefile
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
# -*- mode: ruby; coding: utf-8 -*-
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
%w[../xot ../rucy ../rays .]
|
|
5
|
+
.map {|s| File.expand_path "../#{s}/lib", __FILE__}
|
|
6
|
+
.each {|s| $:.unshift s if !$:.include?(s) && File.directory?(s)}
|
|
6
7
|
|
|
7
8
|
require 'xot/rake'
|
|
8
9
|
require 'xot/module'
|
|
@@ -13,9 +14,9 @@ require 'reflex/module'
|
|
|
13
14
|
include Xot::Rake
|
|
14
15
|
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
MODULES = [Xot, Rucy, Rays, Reflex].map {|m| m.const_get :Module}
|
|
18
|
+
MODULE = MODULES.last
|
|
17
19
|
GEMNAME = 'reflexion'
|
|
18
|
-
INCDIRS = [Reflex, Rays, Rucy, Xot].map {|m| m.include_dirs}.flatten
|
|
19
20
|
TESTS_ALONE = ['test/test_reflex.rb']
|
|
20
21
|
|
|
21
22
|
|
|
@@ -24,4 +25,4 @@ task :default => :build
|
|
|
24
25
|
task :build => :ext
|
|
25
26
|
|
|
26
27
|
|
|
27
|
-
|
|
28
|
+
MODULES.each {|m| m.load_tasks :lib, :ext, :test, :doc, :gem}
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.1.
|
|
1
|
+
0.1.7
|
data/ext/reflex/application.cpp
CHANGED
|
@@ -10,94 +10,95 @@ using namespace Rucy;
|
|
|
10
10
|
|
|
11
11
|
static Class cApplication;
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
namespace Reflex
|
|
15
|
-
{
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
Class
|
|
19
|
-
application_class ()
|
|
20
|
-
{
|
|
21
|
-
return cApplication;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}// Reflex
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
typedef Reflex::RubyApplication<Reflex::Application> RubyApplication;
|
|
29
|
-
|
|
13
|
+
RUCY_DEFINE_WRAPPER_VALUE_FROM_TO(Reflex::Application, cApplication)
|
|
30
14
|
|
|
31
15
|
#define THIS to<Reflex::Application*>(self)
|
|
32
16
|
|
|
33
|
-
#define CHECK RUCY_CHECK_OBJECT(
|
|
17
|
+
#define CHECK RUCY_CHECK_OBJECT(Reflex::Application, cApplication, self)
|
|
34
18
|
|
|
35
|
-
#define CALL(fun) RUCY_WRAPPER_CALL(
|
|
19
|
+
#define CALL(fun) RUCY_WRAPPER_CALL(Reflex::Application, THIS, fun)
|
|
36
20
|
|
|
37
21
|
|
|
38
22
|
static
|
|
39
|
-
|
|
23
|
+
RUCY_DEF_ALLOC(alloc, klass)
|
|
40
24
|
{
|
|
41
|
-
return value(new RubyApplication
|
|
25
|
+
return value(new Reflex::RubyApplication<Reflex::Application>, klass);
|
|
42
26
|
}
|
|
43
|
-
|
|
27
|
+
RUCY_END
|
|
44
28
|
|
|
45
29
|
static
|
|
46
|
-
|
|
30
|
+
RUCY_DEF0(start)
|
|
47
31
|
{
|
|
48
32
|
CHECK;
|
|
49
|
-
|
|
50
|
-
system_error("failed to run application.");
|
|
33
|
+
CALL(start());
|
|
51
34
|
return self;
|
|
52
35
|
}
|
|
53
|
-
|
|
36
|
+
RUCY_END
|
|
54
37
|
|
|
55
38
|
static
|
|
56
|
-
|
|
39
|
+
RUCY_DEF0(quit)
|
|
57
40
|
{
|
|
58
41
|
CHECK;
|
|
59
|
-
|
|
60
|
-
system_error("failed to quit application.");
|
|
42
|
+
CALL(quit());
|
|
61
43
|
return self;
|
|
62
44
|
}
|
|
63
|
-
|
|
45
|
+
RUCY_END
|
|
64
46
|
|
|
65
47
|
static
|
|
66
|
-
|
|
48
|
+
RUCY_DEF1(set_name, name)
|
|
67
49
|
{
|
|
68
50
|
CHECK;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
return self;
|
|
51
|
+
THIS->set_name(name.c_str());
|
|
52
|
+
return name;
|
|
72
53
|
}
|
|
73
|
-
|
|
54
|
+
RUCY_END
|
|
74
55
|
|
|
75
56
|
static
|
|
76
|
-
|
|
57
|
+
RUCY_DEF0(get_name)
|
|
77
58
|
{
|
|
78
59
|
CHECK;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
60
|
+
return value(THIS->name());
|
|
61
|
+
}
|
|
62
|
+
RUCY_END
|
|
63
|
+
|
|
64
|
+
static
|
|
65
|
+
RUCY_DEF1(on_start, event)
|
|
66
|
+
{
|
|
67
|
+
CHECK;
|
|
68
|
+
CALL(on_start(to<Reflex::Event*>(event)));
|
|
82
69
|
}
|
|
83
|
-
|
|
70
|
+
RUCY_END
|
|
84
71
|
|
|
85
72
|
static
|
|
86
|
-
|
|
73
|
+
RUCY_DEF1(on_quit, event)
|
|
87
74
|
{
|
|
88
75
|
CHECK;
|
|
89
|
-
|
|
90
|
-
if (!s) system_error("failed to get name of application.");
|
|
91
|
-
return value(s);
|
|
76
|
+
CALL(on_quit(to<Reflex::Event*>(event)));
|
|
92
77
|
}
|
|
93
|
-
|
|
78
|
+
RUCY_END
|
|
94
79
|
|
|
95
80
|
static
|
|
96
|
-
|
|
81
|
+
RUCY_DEF1(on_preference, event)
|
|
82
|
+
{
|
|
83
|
+
CHECK;
|
|
84
|
+
CALL(on_preference(to<Reflex::Event*>(event)));
|
|
85
|
+
}
|
|
86
|
+
RUCY_END
|
|
87
|
+
|
|
88
|
+
static
|
|
89
|
+
RUCY_DEF1(on_about, event)
|
|
90
|
+
{
|
|
91
|
+
CHECK;
|
|
92
|
+
CALL(on_about(to<Reflex::Event*>(event)));
|
|
93
|
+
}
|
|
94
|
+
RUCY_END
|
|
95
|
+
|
|
96
|
+
static
|
|
97
|
+
RUCY_DEF0(instance)
|
|
97
98
|
{
|
|
98
99
|
return value(Reflex::app());
|
|
99
100
|
}
|
|
100
|
-
|
|
101
|
+
RUCY_END
|
|
101
102
|
|
|
102
103
|
|
|
103
104
|
void
|
|
@@ -107,10 +108,27 @@ Init_application ()
|
|
|
107
108
|
|
|
108
109
|
cApplication = mReflex.define_class("Application");
|
|
109
110
|
cApplication.define_alloc_func(alloc);
|
|
110
|
-
cApplication.define_method("
|
|
111
|
+
cApplication.define_method("start", start);
|
|
111
112
|
cApplication.define_method("quit", quit);
|
|
112
|
-
cApplication.define_method("about", about);
|
|
113
113
|
cApplication.define_method("name=", set_name);
|
|
114
114
|
cApplication.define_method("name", get_name);
|
|
115
|
+
cApplication.define_method("on_start", on_start);
|
|
116
|
+
cApplication.define_method("on_quit", on_quit);
|
|
117
|
+
cApplication.define_method("on_preference", on_preference);
|
|
118
|
+
cApplication.define_method("on_about", on_about);
|
|
115
119
|
cApplication.define_singleton_method("instance", instance);
|
|
116
120
|
}
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
namespace Reflex
|
|
124
|
+
{
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
Class
|
|
128
|
+
application_class ()
|
|
129
|
+
{
|
|
130
|
+
return cApplication;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
}// Reflex
|