reflexion 0.1.21 → 0.1.25
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.doc/ext/reflex/capture_event.cpp +6 -5
- data/.doc/ext/reflex/contact_event.cpp +18 -16
- data/.doc/ext/reflex/draw_event.cpp +10 -8
- data/.doc/ext/reflex/event.cpp +10 -10
- data/.doc/ext/reflex/focus_event.cpp +18 -17
- data/.doc/ext/reflex/frame_event.cpp +17 -17
- data/.doc/ext/reflex/key_event.cpp +227 -28
- data/.doc/ext/reflex/native.cpp +2 -0
- data/.doc/ext/reflex/pointer.cpp +158 -0
- data/.doc/ext/reflex/pointer_event.cpp +32 -91
- data/.doc/ext/reflex/scroll_event.cpp +14 -17
- data/.doc/ext/reflex/selector.cpp +8 -0
- data/.doc/ext/reflex/timer.cpp +9 -1
- data/.doc/ext/reflex/timer_event.cpp +4 -13
- data/.doc/ext/reflex/update_event.cpp +6 -5
- data/.doc/ext/reflex/view.cpp +57 -0
- data/.doc/ext/reflex/wheel_event.cpp +39 -22
- data/.doc/ext/reflex/window.cpp +24 -0
- data/VERSION +1 -1
- data/ext/reflex/capture_event.cpp +6 -5
- data/ext/reflex/contact_event.cpp +18 -16
- data/ext/reflex/draw_event.cpp +9 -7
- data/ext/reflex/event.cpp +11 -11
- data/ext/reflex/focus_event.cpp +18 -17
- data/ext/reflex/frame_event.cpp +16 -16
- data/ext/reflex/key_event.cpp +228 -28
- data/ext/reflex/native.cpp +2 -0
- data/ext/reflex/pointer.cpp +170 -0
- data/ext/reflex/pointer_event.cpp +31 -96
- data/ext/reflex/scroll_event.cpp +15 -18
- data/ext/reflex/selector.cpp +9 -0
- data/ext/reflex/timer.cpp +15 -6
- data/ext/reflex/timer_event.cpp +9 -19
- data/ext/reflex/update_event.cpp +6 -5
- data/ext/reflex/view.cpp +67 -3
- data/ext/reflex/wheel_event.cpp +40 -21
- data/ext/reflex/window.cpp +30 -3
- data/include/reflex/defs.h +140 -106
- data/include/reflex/event.h +232 -124
- data/include/reflex/pointer.h +107 -0
- data/include/reflex/ruby/pointer.h +41 -0
- data/include/reflex/ruby/view.h +9 -0
- data/include/reflex/ruby/window.h +9 -0
- data/include/reflex/selector.h +1 -1
- data/include/reflex/shape.h +2 -2
- data/include/reflex/view.h +6 -4
- data/include/reflex/window.h +10 -8
- data/lib/reflex/application.rb +3 -3
- data/lib/reflex/autoinit.rb +1 -1
- data/lib/reflex/button.rb +7 -7
- data/lib/reflex/capture_event.rb +7 -7
- data/lib/reflex/contact_event.rb +10 -10
- data/lib/reflex/draw_event.rb +2 -2
- data/lib/reflex/ellipse_shape.rb +2 -2
- data/lib/reflex/focus_event.rb +11 -11
- data/lib/reflex/frame_event.rb +5 -5
- data/lib/reflex/helper.rb +20 -20
- data/lib/reflex/image_view.rb +2 -2
- data/lib/reflex/key_event.rb +12 -12
- data/lib/reflex/model.rb +22 -22
- data/lib/reflex/model_owner.rb +7 -7
- data/lib/reflex/model_view.rb +1 -1
- data/lib/reflex/module.rb +5 -5
- data/lib/reflex/pointer.rb +107 -0
- data/lib/reflex/pointer_event.rb +16 -54
- data/lib/reflex/polygon_shape.rb +2 -2
- data/lib/reflex/reflex.rb +3 -3
- data/lib/reflex/scroll_event.rb +1 -1
- data/lib/reflex/selector.rb +4 -4
- data/lib/reflex/shape.rb +13 -13
- data/lib/reflex/style.rb +11 -11
- data/lib/reflex/style_length.rb +1 -1
- data/lib/reflex/text_view.rb +2 -2
- data/lib/reflex/timer.rb +2 -2
- data/lib/reflex/timer_event.rb +3 -2
- data/lib/reflex/update_event.rb +1 -1
- data/lib/reflex/view.rb +32 -32
- data/lib/reflex/wheel_event.rb +2 -10
- data/lib/reflex/window.rb +6 -6
- data/lib/reflex.rb +1 -0
- data/lib/reflexion.rb +17 -17
- data/reflex.gemspec +5 -5
- data/samples/reflexion/noise.rb +1 -1
- data/samples/tree.rb +1 -1
- data/src/event.cpp +792 -86
- data/src/event.h +47 -0
- data/src/image_view.cpp +2 -2
- data/src/ios/event.h +15 -3
- data/src/ios/event.mm +126 -11
- data/src/ios/view_controller.mm +50 -22
- data/src/ios/window.mm +1 -1
- data/src/osx/event.h +15 -4
- data/src/osx/event.mm +214 -24
- data/src/osx/native_window.mm +84 -17
- data/src/pointer.cpp +203 -0
- data/src/pointer.h +26 -0
- data/src/selector.cpp +1 -1
- data/src/shape.cpp +11 -13
- data/src/shape.h +1 -1
- data/src/view.cpp +205 -118
- data/src/view.h +5 -10
- data/src/window.cpp +334 -104
- data/src/window.h +22 -3
- data/src/world.cpp +6 -4
- data/test/helper.rb +3 -3
- data/test/test_application.rb +1 -1
- data/test/test_capture_event.rb +22 -6
- data/test/test_contact_event.rb +40 -0
- data/test/test_draw_event.rb +35 -0
- data/test/test_event.rb +33 -5
- data/test/test_focus_event.rb +34 -0
- data/test/test_frame_event.rb +38 -0
- data/test/test_has_frame.rb +11 -11
- data/test/test_key_event.rb +33 -0
- data/test/test_pointer.rb +149 -0
- data/test/test_pointer_event.rb +70 -104
- data/test/test_reflex.rb +1 -1
- data/test/test_scroll_event.rb +39 -0
- data/test/test_selector.rb +15 -8
- data/test/test_shape.rb +8 -8
- data/test/test_style.rb +13 -13
- data/test/test_style_length.rb +5 -5
- data/test/test_timer_event.rb +38 -0
- data/test/test_update_event.rb +29 -0
- data/test/test_view.rb +57 -30
- data/test/test_wheel_event.rb +40 -0
- data/test/test_window.rb +29 -27
- metadata +64 -35
@@ -23,12 +23,9 @@ VALUE initialize(VALUE self, VALUE x, VALUE y, VALUE z, VALUE dx, VALUE dy, VALU
|
|
23
23
|
{
|
24
24
|
CHECK;
|
25
25
|
|
26
|
-
THIS
|
27
|
-
|
28
|
-
|
29
|
-
THIS->dx = to<coord>(dx);
|
30
|
-
THIS->dy = to<coord>(dy);
|
31
|
-
THIS->dz = to<coord>(dz);
|
26
|
+
*THIS = Reflex::ScrollEvent(
|
27
|
+
to<coord>( x), to<coord>( y), to<coord>( z),
|
28
|
+
to<coord>(dx), to<coord>(dy), to<coord>(dz));
|
32
29
|
|
33
30
|
return rb_call_super(0, NULL);
|
34
31
|
}
|
@@ -37,7 +34,7 @@ static
|
|
37
34
|
VALUE initialize_copy(VALUE self, VALUE obj)
|
38
35
|
{
|
39
36
|
CHECK;
|
40
|
-
*THIS = to<Reflex::ScrollEvent&>(obj);
|
37
|
+
*THIS = to<Reflex::ScrollEvent&>(obj).dup();
|
41
38
|
return self;
|
42
39
|
}
|
43
40
|
|
@@ -45,56 +42,56 @@ static
|
|
45
42
|
VALUE x(VALUE self)
|
46
43
|
{
|
47
44
|
CHECK;
|
48
|
-
return value(THIS->x);
|
45
|
+
return value(THIS->scroll().x);
|
49
46
|
}
|
50
47
|
|
51
48
|
static
|
52
49
|
VALUE y(VALUE self)
|
53
50
|
{
|
54
51
|
CHECK;
|
55
|
-
return value(THIS->y);
|
52
|
+
return value(THIS->scroll().y);
|
56
53
|
}
|
57
54
|
|
58
55
|
static
|
59
56
|
VALUE z(VALUE self)
|
60
57
|
{
|
61
58
|
CHECK;
|
62
|
-
return value(THIS->z);
|
59
|
+
return value(THIS->scroll().z);
|
63
60
|
}
|
64
61
|
|
65
62
|
static
|
66
63
|
VALUE dx(VALUE self)
|
67
64
|
{
|
68
65
|
CHECK;
|
69
|
-
return value(THIS->
|
66
|
+
return value(THIS->dscroll().x);
|
70
67
|
}
|
71
68
|
|
72
69
|
static
|
73
70
|
VALUE dy(VALUE self)
|
74
71
|
{
|
75
72
|
CHECK;
|
76
|
-
return value(THIS->
|
73
|
+
return value(THIS->dscroll().y);
|
77
74
|
}
|
78
75
|
|
79
76
|
static
|
80
77
|
VALUE dz(VALUE self)
|
81
78
|
{
|
82
79
|
CHECK;
|
83
|
-
return value(THIS->
|
80
|
+
return value(THIS->dscroll().z);
|
84
81
|
}
|
85
82
|
|
86
83
|
static
|
87
84
|
VALUE scroll(VALUE self)
|
88
85
|
{
|
89
86
|
CHECK;
|
90
|
-
return value(
|
87
|
+
return value(THIS->scroll());
|
91
88
|
}
|
92
89
|
|
93
90
|
static
|
94
|
-
VALUE
|
91
|
+
VALUE dscroll(VALUE self)
|
95
92
|
{
|
96
93
|
CHECK;
|
97
|
-
return value(
|
94
|
+
return value(THIS->dscroll());
|
98
95
|
}
|
99
96
|
|
100
97
|
|
@@ -116,7 +113,7 @@ Init_scroll_event ()
|
|
116
113
|
rb_define_method(cScrollEvent, "dy", RUBY_METHOD_FUNC(dy), 0);
|
117
114
|
rb_define_method(cScrollEvent, "dz", RUBY_METHOD_FUNC(dz), 0);
|
118
115
|
rb_define_method(cScrollEvent, "scroll", RUBY_METHOD_FUNC(scroll), 0);
|
119
|
-
rb_define_method(cScrollEvent, "
|
116
|
+
rb_define_method(cScrollEvent, "dscroll", RUBY_METHOD_FUNC(dscroll), 0);
|
120
117
|
}
|
121
118
|
|
122
119
|
|
@@ -81,6 +81,13 @@ VALUE each_tag(VALUE self)
|
|
81
81
|
return ret;
|
82
82
|
}
|
83
83
|
|
84
|
+
static
|
85
|
+
VALUE is_empty(VALUE self)
|
86
|
+
{
|
87
|
+
CHECK;
|
88
|
+
return value(C_THIS->empty());
|
89
|
+
}
|
90
|
+
|
84
91
|
static
|
85
92
|
VALUE contains(VALUE self, VALUE selector)
|
86
93
|
{
|
@@ -113,6 +120,7 @@ Init_selector ()
|
|
113
120
|
rb_define_method(cSelector, "clear_tags", RUBY_METHOD_FUNC(clear_tags), 0);
|
114
121
|
cSelector.define_method("tag?", has_tag);
|
115
122
|
rb_define_method(cSelector, "each_tag", RUBY_METHOD_FUNC(each_tag), 0);
|
123
|
+
cSelector.define_method("empty?", is_empty);
|
116
124
|
rb_define_method(cSelector, "contains", RUBY_METHOD_FUNC(contains), 1);
|
117
125
|
cSelector.define_method("==", equal);
|
118
126
|
}
|
data/.doc/ext/reflex/timer.cpp
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
#include "reflex/ruby/timer.h"
|
2
2
|
|
3
3
|
|
4
|
+
#include "reflex/exception.h"
|
4
5
|
#include "reflex/ruby/view.h"
|
5
6
|
#include "reflex/ruby/selector.h"
|
6
7
|
#include "defs.h"
|
@@ -16,6 +17,12 @@ RUCY_DEFINE_WRAPPER_VALUE_FROM_TO(Reflex::Timer)
|
|
16
17
|
#define CALL(fun) RUCY_CALL_SUPER(THIS, fun)
|
17
18
|
|
18
19
|
|
20
|
+
static
|
21
|
+
VALUE alloc(VALUE klass)
|
22
|
+
{
|
23
|
+
Reflex::reflex_error(__FILE__, __LINE__, "can not instantiate Timer class.");
|
24
|
+
}
|
25
|
+
|
19
26
|
static
|
20
27
|
VALUE stop(VALUE self)
|
21
28
|
{
|
@@ -75,13 +82,14 @@ Init_timer ()
|
|
75
82
|
Module mReflex = rb_define_module("Reflex");
|
76
83
|
|
77
84
|
cTimer = rb_define_class_under(mReflex, "Timer", rb_cObject);
|
85
|
+
rb_define_alloc_func(cTimer, alloc);
|
78
86
|
rb_define_method(cTimer, "stop", RUBY_METHOD_FUNC(stop), 0);
|
79
87
|
rb_define_method(cTimer, "owner", RUBY_METHOD_FUNC(get_owner), 0);
|
80
88
|
rb_define_method(cTimer, "id", RUBY_METHOD_FUNC(get_id), 0);
|
81
89
|
rb_define_method(cTimer, "interval", RUBY_METHOD_FUNC(get_interval), 0);
|
82
90
|
rb_define_method(cTimer, "count=", RUBY_METHOD_FUNC(set_count), 1);
|
83
91
|
rb_define_method(cTimer, "count", RUBY_METHOD_FUNC(get_count), 0);
|
84
|
-
cTimer.define_method("
|
92
|
+
cTimer.define_method("finished?", is_finished);
|
85
93
|
|
86
94
|
define_selector_methods<Reflex::Timer>(cTimer);
|
87
95
|
}
|
@@ -24,7 +24,7 @@ VALUE initialize(VALUE self, VALUE timer)
|
|
24
24
|
{
|
25
25
|
CHECK;
|
26
26
|
|
27
|
-
THIS
|
27
|
+
*THIS = Reflex::TimerEvent(to<Reflex::Timer*>(timer));
|
28
28
|
|
29
29
|
return rb_call_super(0, NULL);
|
30
30
|
}
|
@@ -33,7 +33,7 @@ static
|
|
33
33
|
VALUE initialize_copy(VALUE self, VALUE obj)
|
34
34
|
{
|
35
35
|
CHECK;
|
36
|
-
*THIS = to<Reflex::TimerEvent&>(obj);
|
36
|
+
*THIS = to<Reflex::TimerEvent&>(obj).dup();
|
37
37
|
return self;
|
38
38
|
}
|
39
39
|
|
@@ -41,7 +41,7 @@ static
|
|
41
41
|
VALUE timer(VALUE self)
|
42
42
|
{
|
43
43
|
CHECK;
|
44
|
-
return value(THIS->timer);
|
44
|
+
return value(THIS->timer());
|
45
45
|
}
|
46
46
|
|
47
47
|
static
|
@@ -65,14 +65,6 @@ VALUE interval(VALUE self)
|
|
65
65
|
return value(THIS->interval());
|
66
66
|
}
|
67
67
|
|
68
|
-
static
|
69
|
-
VALUE set_count(VALUE self, VALUE count)
|
70
|
-
{
|
71
|
-
CHECK;
|
72
|
-
THIS->set_count(to<int>(count));
|
73
|
-
return count;
|
74
|
-
}
|
75
|
-
|
76
68
|
static
|
77
69
|
VALUE count(VALUE self)
|
78
70
|
{
|
@@ -103,9 +95,8 @@ Init_timer_event ()
|
|
103
95
|
rb_define_method(cTimerEvent, "owner", RUBY_METHOD_FUNC(owner), 0);
|
104
96
|
rb_define_method(cTimerEvent, "id", RUBY_METHOD_FUNC(id), 0);
|
105
97
|
rb_define_method(cTimerEvent, "interval", RUBY_METHOD_FUNC(interval), 0);
|
106
|
-
rb_define_method(cTimerEvent, "count=", RUBY_METHOD_FUNC(set_count), 1);
|
107
98
|
rb_define_method(cTimerEvent, "count", RUBY_METHOD_FUNC(count), 0);
|
108
|
-
cTimerEvent.define_method("
|
99
|
+
cTimerEvent.define_method("finished?", is_finished);
|
109
100
|
}
|
110
101
|
|
111
102
|
|
@@ -22,8 +22,9 @@ VALUE initialize(VALUE self, VALUE now, VALUE dt)
|
|
22
22
|
{
|
23
23
|
CHECK;
|
24
24
|
|
25
|
-
THIS
|
26
|
-
|
25
|
+
*THIS = Reflex::UpdateEvent(
|
26
|
+
to<double>(now),
|
27
|
+
to<float>(dt));
|
27
28
|
|
28
29
|
return rb_call_super(0, NULL);
|
29
30
|
}
|
@@ -32,7 +33,7 @@ static
|
|
32
33
|
VALUE initialize_copy(VALUE self, VALUE obj)
|
33
34
|
{
|
34
35
|
CHECK;
|
35
|
-
*THIS = to<Reflex::UpdateEvent&>(obj);
|
36
|
+
*THIS = to<Reflex::UpdateEvent&>(obj).dup();
|
36
37
|
return self;
|
37
38
|
}
|
38
39
|
|
@@ -40,14 +41,14 @@ static
|
|
40
41
|
VALUE now(VALUE self)
|
41
42
|
{
|
42
43
|
CHECK;
|
43
|
-
return value(THIS->now);
|
44
|
+
return value(THIS->now());
|
44
45
|
}
|
45
46
|
|
46
47
|
static
|
47
48
|
VALUE dt(VALUE self)
|
48
49
|
{
|
49
50
|
CHECK;
|
50
|
-
return value(THIS->dt);
|
51
|
+
return value(THIS->dt());
|
51
52
|
}
|
52
53
|
|
53
54
|
|
data/.doc/ext/reflex/view.cpp
CHANGED
@@ -120,6 +120,48 @@ VALUE update_layout(VALUE self)
|
|
120
120
|
return self;
|
121
121
|
}
|
122
122
|
|
123
|
+
static
|
124
|
+
VALUE from_parent(VALUE self, VALUE point)
|
125
|
+
{
|
126
|
+
CHECK;
|
127
|
+
return value(THIS->from_parent(to<Rays::Point>(point)));
|
128
|
+
}
|
129
|
+
|
130
|
+
static
|
131
|
+
VALUE to_parent(VALUE self, VALUE point)
|
132
|
+
{
|
133
|
+
CHECK;
|
134
|
+
return value(THIS->to_parent(to<Rays::Point>(point)));
|
135
|
+
}
|
136
|
+
|
137
|
+
static
|
138
|
+
VALUE from_window(VALUE self, VALUE point)
|
139
|
+
{
|
140
|
+
CHECK;
|
141
|
+
return value(THIS->from_window(to<Rays::Point>(point)));
|
142
|
+
}
|
143
|
+
|
144
|
+
static
|
145
|
+
VALUE to_window(VALUE self, VALUE point)
|
146
|
+
{
|
147
|
+
CHECK;
|
148
|
+
return value(THIS->to_window(to<Rays::Point>(point)));
|
149
|
+
}
|
150
|
+
|
151
|
+
static
|
152
|
+
VALUE from_screen(VALUE self, VALUE point)
|
153
|
+
{
|
154
|
+
CHECK;
|
155
|
+
return value(THIS->from_screen(to<Rays::Point>(point)));
|
156
|
+
}
|
157
|
+
|
158
|
+
static
|
159
|
+
VALUE to_screen(VALUE self, VALUE point)
|
160
|
+
{
|
161
|
+
CHECK;
|
162
|
+
return value(THIS->to_screen(to<Rays::Point>(point)));
|
163
|
+
}
|
164
|
+
|
123
165
|
static
|
124
166
|
VALUE add_child(VALUE self, VALUE child)
|
125
167
|
{
|
@@ -929,6 +971,13 @@ VALUE on_pointer_move(VALUE self, VALUE event)
|
|
929
971
|
CALL(on_pointer_move(to<Reflex::PointerEvent*>(event)));
|
930
972
|
}
|
931
973
|
|
974
|
+
static
|
975
|
+
VALUE on_pointer_cancel(VALUE self, VALUE event)
|
976
|
+
{
|
977
|
+
CHECK;
|
978
|
+
CALL(on_pointer_cancel(to<Reflex::PointerEvent*>(event)));
|
979
|
+
}
|
980
|
+
|
932
981
|
static
|
933
982
|
VALUE on_wheel(VALUE self, VALUE event)
|
934
983
|
{
|
@@ -991,6 +1040,13 @@ Init_view ()
|
|
991
1040
|
rb_define_private_method(cView, "start_timer", RUBY_METHOD_FUNC(start_timer), -1);
|
992
1041
|
rb_define_method(cView, "update_layout", RUBY_METHOD_FUNC(update_layout), 0);
|
993
1042
|
|
1043
|
+
rb_define_method(cView, "from_parent", RUBY_METHOD_FUNC(from_parent), 1);
|
1044
|
+
rb_define_method(cView, "to_parent", RUBY_METHOD_FUNC(to_parent), 1);
|
1045
|
+
rb_define_method(cView, "from_window", RUBY_METHOD_FUNC(from_window), 1);
|
1046
|
+
rb_define_method(cView, "to_window", RUBY_METHOD_FUNC(to_window), 1);
|
1047
|
+
rb_define_method(cView, "from_screen", RUBY_METHOD_FUNC(from_screen), 1);
|
1048
|
+
rb_define_method(cView, "to_screen", RUBY_METHOD_FUNC(to_screen), 1);
|
1049
|
+
|
994
1050
|
rb_define_method(cView, "add_child", RUBY_METHOD_FUNC(add_child), 1);
|
995
1051
|
rb_define_method(cView, "remove_child", RUBY_METHOD_FUNC(remove_child), 1);
|
996
1052
|
rb_define_method(cView, "clear_children", RUBY_METHOD_FUNC(clear_children), 0);
|
@@ -1093,6 +1149,7 @@ Init_view ()
|
|
1093
1149
|
rb_define_method(cView, "on_pointer_down", RUBY_METHOD_FUNC(on_pointer_down), 1);
|
1094
1150
|
rb_define_method(cView, "on_pointer_up", RUBY_METHOD_FUNC(on_pointer_up), 1);
|
1095
1151
|
rb_define_method(cView, "on_pointer_move", RUBY_METHOD_FUNC(on_pointer_move), 1);
|
1152
|
+
rb_define_method(cView, "on_pointer_cancel", RUBY_METHOD_FUNC(on_pointer_cancel), 1);
|
1096
1153
|
rb_define_method(cView, "on_wheel", RUBY_METHOD_FUNC(on_wheel), 1);
|
1097
1154
|
rb_define_method(cView, "on_capture", RUBY_METHOD_FUNC(on_capture), 1);
|
1098
1155
|
rb_define_method(cView, "on_timer", RUBY_METHOD_FUNC(on_timer), 1);
|
@@ -19,13 +19,14 @@ VALUE alloc(VALUE klass)
|
|
19
19
|
}
|
20
20
|
|
21
21
|
static
|
22
|
-
VALUE initialize(VALUE self, VALUE dx, VALUE dy, VALUE dz)
|
22
|
+
VALUE initialize(VALUE self, VALUE x, VALUE y, VALUE z, VALUE dx, VALUE dy, VALUE dz, VALUE modifiers)
|
23
23
|
{
|
24
24
|
CHECK;
|
25
25
|
|
26
|
-
THIS
|
27
|
-
|
28
|
-
|
26
|
+
*THIS = Reflex::WheelEvent(
|
27
|
+
to<coord>( x), to<coord>( y), to<coord>( z),
|
28
|
+
to<coord>(dx), to<coord>(dy), to<coord>(dz),
|
29
|
+
to<uint>(modifiers));
|
29
30
|
|
30
31
|
return rb_call_super(0, NULL);
|
31
32
|
}
|
@@ -34,57 +35,71 @@ static
|
|
34
35
|
VALUE initialize_copy(VALUE self, VALUE obj)
|
35
36
|
{
|
36
37
|
CHECK;
|
37
|
-
*THIS = to<Reflex::WheelEvent&>(obj);
|
38
|
+
*THIS = to<Reflex::WheelEvent&>(obj).dup();
|
38
39
|
return self;
|
39
40
|
}
|
40
41
|
|
41
42
|
static
|
42
|
-
VALUE
|
43
|
+
VALUE x(VALUE self)
|
43
44
|
{
|
44
45
|
CHECK;
|
45
|
-
return value(THIS->
|
46
|
+
return value(THIS->position().x);
|
46
47
|
}
|
47
48
|
|
48
49
|
static
|
49
|
-
VALUE
|
50
|
+
VALUE y(VALUE self)
|
50
51
|
{
|
51
52
|
CHECK;
|
52
|
-
return value(THIS->
|
53
|
+
return value(THIS->position().y);
|
53
54
|
}
|
54
55
|
|
55
56
|
static
|
56
|
-
VALUE
|
57
|
+
VALUE z(VALUE self)
|
57
58
|
{
|
58
59
|
CHECK;
|
59
|
-
return value(THIS->
|
60
|
+
return value(THIS->position().z);
|
60
61
|
}
|
61
62
|
|
62
63
|
static
|
63
|
-
VALUE
|
64
|
+
VALUE dx(VALUE self)
|
64
65
|
{
|
65
66
|
CHECK;
|
66
|
-
return value(THIS->x);
|
67
|
+
return value(THIS->dposition().x);
|
67
68
|
}
|
68
69
|
|
69
70
|
static
|
70
|
-
VALUE
|
71
|
+
VALUE dy(VALUE self)
|
71
72
|
{
|
72
73
|
CHECK;
|
73
|
-
return value(THIS->y);
|
74
|
+
return value(THIS->dposition().y);
|
74
75
|
}
|
75
76
|
|
76
77
|
static
|
77
|
-
VALUE
|
78
|
+
VALUE dz(VALUE self)
|
79
|
+
{
|
80
|
+
CHECK;
|
81
|
+
return value(THIS->dposition().z);
|
82
|
+
}
|
83
|
+
|
84
|
+
static
|
85
|
+
VALUE position(VALUE self)
|
86
|
+
{
|
87
|
+
CHECK;
|
88
|
+
return value(THIS->position());
|
89
|
+
}
|
90
|
+
|
91
|
+
static
|
92
|
+
VALUE dposition(VALUE self)
|
78
93
|
{
|
79
94
|
CHECK;
|
80
|
-
return value(THIS->
|
95
|
+
return value(THIS->dposition());
|
81
96
|
}
|
82
97
|
|
83
98
|
static
|
84
99
|
VALUE modifiers(VALUE self)
|
85
100
|
{
|
86
101
|
CHECK;
|
87
|
-
return value(THIS->modifiers);
|
102
|
+
return value(THIS->modifiers());
|
88
103
|
}
|
89
104
|
|
90
105
|
|
@@ -97,14 +112,16 @@ Init_wheel_event ()
|
|
97
112
|
|
98
113
|
cWheelEvent = mReflex.define_class("WheelEvent", Reflex::event_class());
|
99
114
|
rb_define_alloc_func(cWheelEvent, alloc);
|
100
|
-
rb_define_private_method(cWheelEvent, "initialize", RUBY_METHOD_FUNC(initialize),
|
115
|
+
rb_define_private_method(cWheelEvent, "initialize", RUBY_METHOD_FUNC(initialize), 7);
|
101
116
|
rb_define_private_method(cWheelEvent, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1);
|
102
|
-
rb_define_method(cWheelEvent, "dx", RUBY_METHOD_FUNC(dx), 0);
|
103
|
-
rb_define_method(cWheelEvent, "dy", RUBY_METHOD_FUNC(dy), 0);
|
104
|
-
rb_define_method(cWheelEvent, "dz", RUBY_METHOD_FUNC(dz), 0);
|
105
117
|
rb_define_method(cWheelEvent, "x", RUBY_METHOD_FUNC(x), 0);
|
106
118
|
rb_define_method(cWheelEvent, "y", RUBY_METHOD_FUNC(y), 0);
|
107
119
|
rb_define_method(cWheelEvent, "z", RUBY_METHOD_FUNC(z), 0);
|
120
|
+
rb_define_method(cWheelEvent, "dx", RUBY_METHOD_FUNC(dx), 0);
|
121
|
+
rb_define_method(cWheelEvent, "dy", RUBY_METHOD_FUNC(dy), 0);
|
122
|
+
rb_define_method(cWheelEvent, "dz", RUBY_METHOD_FUNC(dz), 0);
|
123
|
+
rb_define_method(cWheelEvent, "position", RUBY_METHOD_FUNC(position), 0);
|
124
|
+
rb_define_method(cWheelEvent, "dposition", RUBY_METHOD_FUNC(dposition), 0);
|
108
125
|
rb_define_method(cWheelEvent, "modifiers", RUBY_METHOD_FUNC(modifiers), 0);
|
109
126
|
}
|
110
127
|
|
data/.doc/ext/reflex/window.cpp
CHANGED
@@ -54,6 +54,20 @@ VALUE redraw(VALUE self)
|
|
54
54
|
return self;
|
55
55
|
}
|
56
56
|
|
57
|
+
static
|
58
|
+
VALUE from_screen(VALUE self, VALUE point)
|
59
|
+
{
|
60
|
+
CHECK;
|
61
|
+
return value(THIS->from_screen(to<Rays::Point>(point)));
|
62
|
+
}
|
63
|
+
|
64
|
+
static
|
65
|
+
VALUE to_screen(VALUE self, VALUE point)
|
66
|
+
{
|
67
|
+
CHECK;
|
68
|
+
return value(THIS->to_screen(to<Rays::Point>(point)));
|
69
|
+
}
|
70
|
+
|
57
71
|
static
|
58
72
|
VALUE set_title(VALUE self, VALUE title)
|
59
73
|
{
|
@@ -229,6 +243,13 @@ VALUE on_pointer_move(VALUE self, VALUE event)
|
|
229
243
|
CALL(on_pointer_move(to<Reflex::PointerEvent*>(event)));
|
230
244
|
}
|
231
245
|
|
246
|
+
static
|
247
|
+
VALUE on_pointer_cancel(VALUE self, VALUE event)
|
248
|
+
{
|
249
|
+
CHECK;
|
250
|
+
CALL(on_pointer_cancel(to<Reflex::PointerEvent*>(event)));
|
251
|
+
}
|
252
|
+
|
232
253
|
static
|
233
254
|
VALUE on_wheel(VALUE self, VALUE event)
|
234
255
|
{
|
@@ -250,6 +271,8 @@ Init_window ()
|
|
250
271
|
rb_define_method(cWindow, "hide", RUBY_METHOD_FUNC(hide), 0);
|
251
272
|
rb_define_method(cWindow, "close", RUBY_METHOD_FUNC(close), 0);
|
252
273
|
rb_define_method(cWindow, "redraw", RUBY_METHOD_FUNC(redraw), 0);
|
274
|
+
rb_define_method(cWindow, "from_screen", RUBY_METHOD_FUNC(from_screen), 1);
|
275
|
+
rb_define_method(cWindow, "to_screen", RUBY_METHOD_FUNC(to_screen), 1);
|
253
276
|
rb_define_method(cWindow, "title=", RUBY_METHOD_FUNC(set_title), 1);
|
254
277
|
rb_define_method(cWindow, "title", RUBY_METHOD_FUNC(get_title), 0);
|
255
278
|
rb_define_method(cWindow, "frame=", RUBY_METHOD_FUNC(set_frame), -1);
|
@@ -274,6 +297,7 @@ Init_window ()
|
|
274
297
|
rb_define_method(cWindow, "on_pointer_down", RUBY_METHOD_FUNC(on_pointer_down), 1);
|
275
298
|
rb_define_method(cWindow, "on_pointer_up", RUBY_METHOD_FUNC(on_pointer_up), 1);
|
276
299
|
rb_define_method(cWindow, "on_pointer_move", RUBY_METHOD_FUNC(on_pointer_move), 1);
|
300
|
+
rb_define_method(cWindow, "on_pointer_cancel", RUBY_METHOD_FUNC(on_pointer_cancel), 1);
|
277
301
|
rb_define_method(cWindow, "on_wheel", RUBY_METHOD_FUNC(on_wheel), 1);
|
278
302
|
}
|
279
303
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.25
|
@@ -24,8 +24,9 @@ RUCY_DEF2(initialize, begin, end)
|
|
24
24
|
{
|
25
25
|
CHECK;
|
26
26
|
|
27
|
-
THIS
|
28
|
-
|
27
|
+
*THIS = Reflex::CaptureEvent(
|
28
|
+
to<uint>(begin),
|
29
|
+
to<uint>(end));
|
29
30
|
|
30
31
|
return rb_call_super(0, NULL);
|
31
32
|
}
|
@@ -35,7 +36,7 @@ static
|
|
35
36
|
RUCY_DEF1(initialize_copy, obj)
|
36
37
|
{
|
37
38
|
CHECK;
|
38
|
-
*THIS = to<Reflex::CaptureEvent&>(obj);
|
39
|
+
*THIS = to<Reflex::CaptureEvent&>(obj).dup();
|
39
40
|
return self;
|
40
41
|
}
|
41
42
|
RUCY_END
|
@@ -44,7 +45,7 @@ static
|
|
44
45
|
RUCY_DEF0(begin)
|
45
46
|
{
|
46
47
|
CHECK;
|
47
|
-
return value(THIS->begin);
|
48
|
+
return value(THIS->begin());
|
48
49
|
}
|
49
50
|
RUCY_END
|
50
51
|
|
@@ -52,7 +53,7 @@ static
|
|
52
53
|
RUCY_DEF0(end)
|
53
54
|
{
|
54
55
|
CHECK;
|
55
|
-
return value(THIS->end);
|
56
|
+
return value(THIS->end());
|
56
57
|
}
|
57
58
|
RUCY_END
|
58
59
|
|
@@ -3,6 +3,7 @@
|
|
3
3
|
|
4
4
|
#include "reflex/ruby/shape.h"
|
5
5
|
#include "reflex/ruby/view.h"
|
6
|
+
#include "reflex/ruby/shape.h"
|
6
7
|
#include "defs.h"
|
7
8
|
|
8
9
|
|
@@ -21,12 +22,13 @@ RUCY_DEF_ALLOC(alloc, klass)
|
|
21
22
|
RUCY_END
|
22
23
|
|
23
24
|
static
|
24
|
-
RUCY_DEF2(initialize,
|
25
|
+
RUCY_DEF2(initialize, action, shape)
|
25
26
|
{
|
26
27
|
CHECK;
|
27
28
|
|
28
|
-
THIS
|
29
|
-
|
29
|
+
*THIS = Reflex::ContactEvent(
|
30
|
+
(Reflex::ContactEvent::Action) to<uint>(action),
|
31
|
+
to<Reflex::Shape*>(shape));
|
30
32
|
|
31
33
|
return rb_call_super(0, NULL);
|
32
34
|
}
|
@@ -36,32 +38,32 @@ static
|
|
36
38
|
RUCY_DEF1(initialize_copy, obj)
|
37
39
|
{
|
38
40
|
CHECK;
|
39
|
-
*THIS = to<Reflex::ContactEvent&>(obj);
|
41
|
+
*THIS = to<Reflex::ContactEvent&>(obj).dup();
|
40
42
|
return self;
|
41
43
|
}
|
42
44
|
RUCY_END
|
43
45
|
|
44
46
|
static
|
45
|
-
RUCY_DEF0(
|
47
|
+
RUCY_DEF0(get_action)
|
46
48
|
{
|
47
49
|
CHECK;
|
48
|
-
return value(THIS->
|
50
|
+
return value(THIS->action());
|
49
51
|
}
|
50
52
|
RUCY_END
|
51
53
|
|
52
54
|
static
|
53
|
-
RUCY_DEF0(
|
55
|
+
RUCY_DEF0(get_shape)
|
54
56
|
{
|
55
57
|
CHECK;
|
56
|
-
return value(THIS->shape);
|
58
|
+
return value(THIS->shape());
|
57
59
|
}
|
58
60
|
RUCY_END
|
59
61
|
|
60
62
|
static
|
61
|
-
RUCY_DEF0(
|
63
|
+
RUCY_DEF0(get_view)
|
62
64
|
{
|
63
65
|
CHECK;
|
64
|
-
return value(THIS->view);
|
66
|
+
return value(THIS->view());
|
65
67
|
}
|
66
68
|
RUCY_END
|
67
69
|
|
@@ -77,12 +79,12 @@ Init_contact_event ()
|
|
77
79
|
cContactEvent.define_alloc_func(alloc);
|
78
80
|
cContactEvent.define_private_method("initialize", initialize);
|
79
81
|
cContactEvent.define_private_method("initialize_copy", initialize_copy);
|
80
|
-
cContactEvent.define_method("
|
81
|
-
cContactEvent.define_method("shape",
|
82
|
-
cContactEvent.define_method("view",
|
83
|
-
cContactEvent.define_const("
|
84
|
-
cContactEvent.define_const("
|
85
|
-
cContactEvent.define_const("
|
82
|
+
cContactEvent.define_method("action", get_action);
|
83
|
+
cContactEvent.define_method("shape", get_shape);
|
84
|
+
cContactEvent.define_method("view", get_view);
|
85
|
+
cContactEvent.define_const("ACTION_NONE", Reflex::ContactEvent::ACTION_NONE);
|
86
|
+
cContactEvent.define_const("BEGIN", Reflex::ContactEvent::BEGIN);
|
87
|
+
cContactEvent.define_const("END", Reflex::ContactEvent::END);
|
86
88
|
}
|
87
89
|
|
88
90
|
|
data/ext/reflex/draw_event.cpp
CHANGED
@@ -21,11 +21,13 @@ RUCY_DEF_ALLOC(alloc, klass)
|
|
21
21
|
RUCY_END
|
22
22
|
|
23
23
|
static
|
24
|
-
|
24
|
+
RUCY_DEF2(initialize, dt, fps)
|
25
25
|
{
|
26
26
|
CHECK;
|
27
27
|
|
28
|
-
THIS
|
28
|
+
*THIS = Reflex::DrawEvent(
|
29
|
+
to<float>(dt),
|
30
|
+
to<float>(fps));
|
29
31
|
|
30
32
|
return rb_call_super(0, NULL);
|
31
33
|
}
|
@@ -35,7 +37,7 @@ static
|
|
35
37
|
RUCY_DEF1(initialize_copy, obj)
|
36
38
|
{
|
37
39
|
CHECK;
|
38
|
-
*THIS = to<Reflex::DrawEvent&>(obj);
|
40
|
+
*THIS = to<Reflex::DrawEvent&>(obj).dup();
|
39
41
|
return self;
|
40
42
|
}
|
41
43
|
RUCY_END
|
@@ -44,7 +46,7 @@ static
|
|
44
46
|
RUCY_DEF0(painter)
|
45
47
|
{
|
46
48
|
CHECK;
|
47
|
-
return value(THIS->painter);
|
49
|
+
return value(THIS->painter());
|
48
50
|
}
|
49
51
|
RUCY_END
|
50
52
|
|
@@ -52,7 +54,7 @@ static
|
|
52
54
|
RUCY_DEF0(bounds)
|
53
55
|
{
|
54
56
|
CHECK;
|
55
|
-
return value(THIS->bounds);
|
57
|
+
return value(THIS->bounds());
|
56
58
|
}
|
57
59
|
RUCY_END
|
58
60
|
|
@@ -60,7 +62,7 @@ static
|
|
60
62
|
RUCY_DEF0(dt)
|
61
63
|
{
|
62
64
|
CHECK;
|
63
|
-
return value(THIS->dt);
|
65
|
+
return value(THIS->dt());
|
64
66
|
}
|
65
67
|
RUCY_END
|
66
68
|
|
@@ -68,7 +70,7 @@ static
|
|
68
70
|
RUCY_DEF0(fps)
|
69
71
|
{
|
70
72
|
CHECK;
|
71
|
-
return value(THIS->fps);
|
73
|
+
return value(THIS->fps());
|
72
74
|
}
|
73
75
|
RUCY_END
|
74
76
|
|