reflexion 0.1.21 → 0.1.25

Sign up to get free protection for your applications and to get access to all the features.
Files changed (129) hide show
  1. checksums.yaml +4 -4
  2. data/.doc/ext/reflex/capture_event.cpp +6 -5
  3. data/.doc/ext/reflex/contact_event.cpp +18 -16
  4. data/.doc/ext/reflex/draw_event.cpp +10 -8
  5. data/.doc/ext/reflex/event.cpp +10 -10
  6. data/.doc/ext/reflex/focus_event.cpp +18 -17
  7. data/.doc/ext/reflex/frame_event.cpp +17 -17
  8. data/.doc/ext/reflex/key_event.cpp +227 -28
  9. data/.doc/ext/reflex/native.cpp +2 -0
  10. data/.doc/ext/reflex/pointer.cpp +158 -0
  11. data/.doc/ext/reflex/pointer_event.cpp +32 -91
  12. data/.doc/ext/reflex/scroll_event.cpp +14 -17
  13. data/.doc/ext/reflex/selector.cpp +8 -0
  14. data/.doc/ext/reflex/timer.cpp +9 -1
  15. data/.doc/ext/reflex/timer_event.cpp +4 -13
  16. data/.doc/ext/reflex/update_event.cpp +6 -5
  17. data/.doc/ext/reflex/view.cpp +57 -0
  18. data/.doc/ext/reflex/wheel_event.cpp +39 -22
  19. data/.doc/ext/reflex/window.cpp +24 -0
  20. data/VERSION +1 -1
  21. data/ext/reflex/capture_event.cpp +6 -5
  22. data/ext/reflex/contact_event.cpp +18 -16
  23. data/ext/reflex/draw_event.cpp +9 -7
  24. data/ext/reflex/event.cpp +11 -11
  25. data/ext/reflex/focus_event.cpp +18 -17
  26. data/ext/reflex/frame_event.cpp +16 -16
  27. data/ext/reflex/key_event.cpp +228 -28
  28. data/ext/reflex/native.cpp +2 -0
  29. data/ext/reflex/pointer.cpp +170 -0
  30. data/ext/reflex/pointer_event.cpp +31 -96
  31. data/ext/reflex/scroll_event.cpp +15 -18
  32. data/ext/reflex/selector.cpp +9 -0
  33. data/ext/reflex/timer.cpp +15 -6
  34. data/ext/reflex/timer_event.cpp +9 -19
  35. data/ext/reflex/update_event.cpp +6 -5
  36. data/ext/reflex/view.cpp +67 -3
  37. data/ext/reflex/wheel_event.cpp +40 -21
  38. data/ext/reflex/window.cpp +30 -3
  39. data/include/reflex/defs.h +140 -106
  40. data/include/reflex/event.h +232 -124
  41. data/include/reflex/pointer.h +107 -0
  42. data/include/reflex/ruby/pointer.h +41 -0
  43. data/include/reflex/ruby/view.h +9 -0
  44. data/include/reflex/ruby/window.h +9 -0
  45. data/include/reflex/selector.h +1 -1
  46. data/include/reflex/shape.h +2 -2
  47. data/include/reflex/view.h +6 -4
  48. data/include/reflex/window.h +10 -8
  49. data/lib/reflex/application.rb +3 -3
  50. data/lib/reflex/autoinit.rb +1 -1
  51. data/lib/reflex/button.rb +7 -7
  52. data/lib/reflex/capture_event.rb +7 -7
  53. data/lib/reflex/contact_event.rb +10 -10
  54. data/lib/reflex/draw_event.rb +2 -2
  55. data/lib/reflex/ellipse_shape.rb +2 -2
  56. data/lib/reflex/focus_event.rb +11 -11
  57. data/lib/reflex/frame_event.rb +5 -5
  58. data/lib/reflex/helper.rb +20 -20
  59. data/lib/reflex/image_view.rb +2 -2
  60. data/lib/reflex/key_event.rb +12 -12
  61. data/lib/reflex/model.rb +22 -22
  62. data/lib/reflex/model_owner.rb +7 -7
  63. data/lib/reflex/model_view.rb +1 -1
  64. data/lib/reflex/module.rb +5 -5
  65. data/lib/reflex/pointer.rb +107 -0
  66. data/lib/reflex/pointer_event.rb +16 -54
  67. data/lib/reflex/polygon_shape.rb +2 -2
  68. data/lib/reflex/reflex.rb +3 -3
  69. data/lib/reflex/scroll_event.rb +1 -1
  70. data/lib/reflex/selector.rb +4 -4
  71. data/lib/reflex/shape.rb +13 -13
  72. data/lib/reflex/style.rb +11 -11
  73. data/lib/reflex/style_length.rb +1 -1
  74. data/lib/reflex/text_view.rb +2 -2
  75. data/lib/reflex/timer.rb +2 -2
  76. data/lib/reflex/timer_event.rb +3 -2
  77. data/lib/reflex/update_event.rb +1 -1
  78. data/lib/reflex/view.rb +32 -32
  79. data/lib/reflex/wheel_event.rb +2 -10
  80. data/lib/reflex/window.rb +6 -6
  81. data/lib/reflex.rb +1 -0
  82. data/lib/reflexion.rb +17 -17
  83. data/reflex.gemspec +5 -5
  84. data/samples/reflexion/noise.rb +1 -1
  85. data/samples/tree.rb +1 -1
  86. data/src/event.cpp +792 -86
  87. data/src/event.h +47 -0
  88. data/src/image_view.cpp +2 -2
  89. data/src/ios/event.h +15 -3
  90. data/src/ios/event.mm +126 -11
  91. data/src/ios/view_controller.mm +50 -22
  92. data/src/ios/window.mm +1 -1
  93. data/src/osx/event.h +15 -4
  94. data/src/osx/event.mm +214 -24
  95. data/src/osx/native_window.mm +84 -17
  96. data/src/pointer.cpp +203 -0
  97. data/src/pointer.h +26 -0
  98. data/src/selector.cpp +1 -1
  99. data/src/shape.cpp +11 -13
  100. data/src/shape.h +1 -1
  101. data/src/view.cpp +205 -118
  102. data/src/view.h +5 -10
  103. data/src/window.cpp +334 -104
  104. data/src/window.h +22 -3
  105. data/src/world.cpp +6 -4
  106. data/test/helper.rb +3 -3
  107. data/test/test_application.rb +1 -1
  108. data/test/test_capture_event.rb +22 -6
  109. data/test/test_contact_event.rb +40 -0
  110. data/test/test_draw_event.rb +35 -0
  111. data/test/test_event.rb +33 -5
  112. data/test/test_focus_event.rb +34 -0
  113. data/test/test_frame_event.rb +38 -0
  114. data/test/test_has_frame.rb +11 -11
  115. data/test/test_key_event.rb +33 -0
  116. data/test/test_pointer.rb +149 -0
  117. data/test/test_pointer_event.rb +70 -104
  118. data/test/test_reflex.rb +1 -1
  119. data/test/test_scroll_event.rb +39 -0
  120. data/test/test_selector.rb +15 -8
  121. data/test/test_shape.rb +8 -8
  122. data/test/test_style.rb +13 -13
  123. data/test/test_style_length.rb +5 -5
  124. data/test/test_timer_event.rb +38 -0
  125. data/test/test_update_event.rb +29 -0
  126. data/test/test_view.rb +57 -30
  127. data/test/test_wheel_event.rb +40 -0
  128. data/test/test_window.rb +29 -27
  129. 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->x = to<coord>(x);
27
- THIS->y = to<coord>(y);
28
- THIS->z = to<coord>(z);
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->dx);
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->dy);
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->dz);
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(Rays::Point(THIS->x, THIS->y, THIS->z));
87
+ return value(THIS->scroll());
91
88
  }
92
89
 
93
90
  static
94
- VALUE delta(VALUE self)
91
+ VALUE dscroll(VALUE self)
95
92
  {
96
93
  CHECK;
97
- return value(Rays::Point(THIS->dx, THIS->dy, THIS->dz));
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, "delta", RUBY_METHOD_FUNC(delta), 0);
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
  }
@@ -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("finish?", is_finished);
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->timer = to<Reflex::Timer*>(timer);
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("finish?", is_finished);
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->now = to<double>(now);
26
- THIS->dt = to<float>(dt);
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
 
@@ -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->dx = to<coord>(dx);
27
- THIS->dy = to<coord>(dy);
28
- THIS->dz = to<coord>(dz);
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 dx(VALUE self)
43
+ VALUE x(VALUE self)
43
44
  {
44
45
  CHECK;
45
- return value(THIS->dx);
46
+ return value(THIS->position().x);
46
47
  }
47
48
 
48
49
  static
49
- VALUE dy(VALUE self)
50
+ VALUE y(VALUE self)
50
51
  {
51
52
  CHECK;
52
- return value(THIS->dy);
53
+ return value(THIS->position().y);
53
54
  }
54
55
 
55
56
  static
56
- VALUE dz(VALUE self)
57
+ VALUE z(VALUE self)
57
58
  {
58
59
  CHECK;
59
- return value(THIS->dz);
60
+ return value(THIS->position().z);
60
61
  }
61
62
 
62
63
  static
63
- VALUE x(VALUE self)
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 y(VALUE self)
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 z(VALUE self)
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->z);
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), 3);
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
 
@@ -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.21
1
+ 0.1.25
@@ -24,8 +24,9 @@ RUCY_DEF2(initialize, begin, end)
24
24
  {
25
25
  CHECK;
26
26
 
27
- THIS->begin = to<uint>(begin);
28
- THIS->end = to<uint>(end);
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, type, shape)
25
+ RUCY_DEF2(initialize, action, shape)
25
26
  {
26
27
  CHECK;
27
28
 
28
- THIS->type = (Reflex::ContactEvent::Type) to<int>(type);
29
- THIS->shape = to<Reflex::Shape*>(shape);
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(type)
47
+ RUCY_DEF0(get_action)
46
48
  {
47
49
  CHECK;
48
- return value(THIS->type);
50
+ return value(THIS->action());
49
51
  }
50
52
  RUCY_END
51
53
 
52
54
  static
53
- RUCY_DEF0(shape)
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(view)
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("type", type);
81
- cContactEvent.define_method("shape", shape);
82
- cContactEvent.define_method("view", view);
83
- cContactEvent.define_const("TYPE_NONE", Reflex::ContactEvent::NONE);
84
- cContactEvent.define_const("TYPE_BEGIN", Reflex::ContactEvent::BEGIN);
85
- cContactEvent.define_const("TYPE_END", Reflex::ContactEvent::END);
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
 
@@ -21,11 +21,13 @@ RUCY_DEF_ALLOC(alloc, klass)
21
21
  RUCY_END
22
22
 
23
23
  static
24
- RUCY_DEF1(initialize, dt)
24
+ RUCY_DEF2(initialize, dt, fps)
25
25
  {
26
26
  CHECK;
27
27
 
28
- THIS->dt = to<float>(dt);
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