reflexion 0.1.14 → 0.1.20

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/.doc/ext/reflex/capture_event.cpp +4 -5
  3. data/.doc/ext/reflex/contact_event.cpp +4 -7
  4. data/.doc/ext/reflex/draw_event.cpp +3 -4
  5. data/.doc/ext/reflex/frame_event.cpp +7 -8
  6. data/.doc/ext/reflex/key_event.cpp +7 -8
  7. data/.doc/ext/reflex/motion_event.cpp +3 -5
  8. data/.doc/ext/reflex/pointer_event.cpp +23 -15
  9. data/.doc/ext/reflex/reflex.cpp +3 -1
  10. data/.doc/ext/reflex/scroll_event.cpp +8 -9
  11. data/.doc/ext/reflex/update_event.cpp +4 -5
  12. data/.doc/ext/reflex/wheel_event.cpp +5 -6
  13. data/VERSION +1 -1
  14. data/ext/reflex/capture_event.cpp +3 -4
  15. data/ext/reflex/contact_event.cpp +3 -6
  16. data/ext/reflex/draw_event.cpp +2 -3
  17. data/ext/reflex/frame_event.cpp +6 -7
  18. data/ext/reflex/key_event.cpp +6 -7
  19. data/ext/reflex/motion_event.cpp +2 -4
  20. data/ext/reflex/pointer_event.cpp +22 -14
  21. data/ext/reflex/reflex.cpp +3 -1
  22. data/ext/reflex/scroll_event.cpp +8 -9
  23. data/ext/reflex/update_event.cpp +3 -4
  24. data/ext/reflex/wheel_event.cpp +4 -5
  25. data/include/reflex/defs.h +0 -2
  26. data/include/reflex/event.h +15 -15
  27. data/include/reflex/exception.h +9 -3
  28. data/include/reflex/ruby/event.h +11 -11
  29. data/include/reflex/ruby/reflex.h +1 -0
  30. data/include/reflex/style.h +30 -4
  31. data/lib/reflex.rb +2 -1
  32. data/lib/reflex/camera.rb +13 -0
  33. data/lib/reflex/pointer_event.rb +4 -0
  34. data/reflex.gemspec +4 -4
  35. data/samples/camera.rb +45 -0
  36. data/samples/shapes.rb +16 -0
  37. data/src/event.cpp +7 -7
  38. data/src/ios/view_controller.h +4 -0
  39. data/src/ios/view_controller.mm +22 -34
  40. data/src/osx/native_window.mm +10 -26
  41. data/src/shape.cpp +4 -4
  42. data/src/style.cpp +4 -4
  43. data/src/timer.cpp +3 -6
  44. data/src/view.cpp +2 -2
  45. data/src/window.cpp +27 -0
  46. data/src/window.h +2 -0
  47. data/test/test_pointer_event.rb +79 -34
  48. metadata +15 -13
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 720f804cad8f1348d221caee8b90c063419da65d955885a69301eeb01874bebe
4
- data.tar.gz: e37f6f9b3741722a328a6e63f637045ad79a7cb1bcf9c60ad75f17d29df7db70
3
+ metadata.gz: 218d0608702c70706afb48a61849b27fd36fc8a2efc6518da6ed54f66d7e0662
4
+ data.tar.gz: ff0332f957a15deea1923575c042c970c9cc86b6da8279131faa91fafe6389af
5
5
  SHA512:
6
- metadata.gz: af1ba3a6bdb955c33942ec891aa23243bfb9231fb31e45f6fe71f60ab86700e1eeba7f64328a5687277d6ba06e57eea725adc235e21c7b1fc7c9d1d6fb409549
7
- data.tar.gz: d159177ac4e9835d6b7443d957250f6c67c696d589608cb4047fa7fadac9a72ec5d87a65c80b806653f7ba2795f16f0c69413a73e1a33f85ed2ab8496d6bbce8
6
+ metadata.gz: bbacfbdaf3ba3554bfa31a193f0b438b020f2327695f17ee5653953e29693138faa8d89840020b7c735e6474c776cd5c7df9924b59346048f58eafdae19212c8
7
+ data.tar.gz: 5e38e12dd168b2ae77f5b427541ed68ed2b50599fba5264987d5819a96e1949b1f45fd4da8e07ce3a275f0c8eb07ca260978e36f693d65e2eb8c48525ef79b91
@@ -19,13 +19,12 @@ VALUE alloc(VALUE klass)
19
19
  }
20
20
 
21
21
  static
22
- VALUE initialize(VALUE self)
22
+ VALUE initialize(VALUE self, VALUE begin, VALUE end)
23
23
  {
24
24
  CHECK;
25
- check_arg_count(__FILE__, __LINE__, "CaptureEvent#initialize", argc, 0, 1, 2);
26
25
 
27
- THIS->begin = (argc >= 1) ? to<uint>(argv[0]) : 0;
28
- THIS->end = (argc >= 2) ? to<uint>(argv[1]) : 0;
26
+ THIS->begin = to<uint>(begin);
27
+ THIS->end = to<uint>(end);
29
28
 
30
29
  return rb_call_super(0, NULL);
31
30
  }
@@ -62,7 +61,7 @@ Init_capture_event ()
62
61
 
63
62
  cCaptureEvent = mReflex.define_class("CaptureEvent", Reflex::event_class());
64
63
  rb_define_alloc_func(cCaptureEvent, alloc);
65
- rb_define_private_method(cCaptureEvent, "initialize", RUBY_METHOD_FUNC(initialize), -1);
64
+ rb_define_private_method(cCaptureEvent, "initialize", RUBY_METHOD_FUNC(initialize), 2);
66
65
  rb_define_private_method(cCaptureEvent, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1);
67
66
  rb_define_private_method(cCaptureEvent, "get_begin", RUBY_METHOD_FUNC(begin), 0);
68
67
  rb_define_private_method(cCaptureEvent, "get_end", RUBY_METHOD_FUNC(end), 0);
@@ -20,15 +20,12 @@ VALUE alloc(VALUE klass)
20
20
  }
21
21
 
22
22
  static
23
- VALUE initialize(VALUE self)
23
+ VALUE initialize(VALUE self, VALUE type, VALUE shape)
24
24
  {
25
25
  CHECK;
26
- check_arg_count(__FILE__, __LINE__, "ContactEvent#initialize", argc, 0, 2);
27
26
 
28
- THIS->type = (argc >= 1)
29
- ? (Reflex::ContactEvent::Type) to<int>(argv[0])
30
- : Reflex::ContactEvent::NONE;
31
- THIS->shape = (argc >= 2) ? to<Reflex::Shape*>(argv[1]) : NULL;
27
+ THIS->type = (Reflex::ContactEvent::Type) to<int>(type);
28
+ THIS->shape = to<Reflex::Shape*>(shape);
32
29
 
33
30
  return rb_call_super(0, NULL);
34
31
  }
@@ -72,7 +69,7 @@ Init_contact_event ()
72
69
 
73
70
  cContactEvent = mReflex.define_class("ContactEvent", Reflex::event_class());
74
71
  rb_define_alloc_func(cContactEvent, alloc);
75
- rb_define_private_method(cContactEvent, "initialize", RUBY_METHOD_FUNC(initialize), -1);
72
+ rb_define_private_method(cContactEvent, "initialize", RUBY_METHOD_FUNC(initialize), 2);
76
73
  rb_define_private_method(cContactEvent, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1);
77
74
  rb_define_method(cContactEvent, "type", RUBY_METHOD_FUNC(type), 0);
78
75
  rb_define_method(cContactEvent, "shape", RUBY_METHOD_FUNC(shape), 0);
@@ -20,12 +20,11 @@ VALUE alloc(VALUE klass)
20
20
  }
21
21
 
22
22
  static
23
- VALUE initialize(VALUE self)
23
+ VALUE initialize(VALUE self, VALUE dt)
24
24
  {
25
25
  CHECK;
26
- check_arg_count(__FILE__, __LINE__, "DrawEvent#initialize", argc, 0, 1);
27
26
 
28
- THIS->dt = (argc >= 1) ? to<float>(argv[0]) : 0;
27
+ THIS->dt = to<float>(dt);
29
28
 
30
29
  return rb_call_super(0, NULL);
31
30
  }
@@ -76,7 +75,7 @@ Init_draw_event ()
76
75
 
77
76
  cDrawEvent = mReflex.define_class("DrawEvent", Reflex::event_class());
78
77
  rb_define_alloc_func(cDrawEvent, alloc);
79
- rb_define_private_method(cDrawEvent, "initialize", RUBY_METHOD_FUNC(initialize), -1);
78
+ rb_define_private_method(cDrawEvent, "initialize", RUBY_METHOD_FUNC(initialize), 1);
80
79
  rb_define_private_method(cDrawEvent, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1);
81
80
  rb_define_method(cDrawEvent, "painter", RUBY_METHOD_FUNC(painter), 0);
82
81
  rb_define_method(cDrawEvent, "bounds", RUBY_METHOD_FUNC(bounds), 0);
@@ -20,16 +20,15 @@ VALUE alloc(VALUE klass)
20
20
  }
21
21
 
22
22
  static
23
- VALUE initialize(VALUE self)
23
+ VALUE initialize(VALUE self, VALUE frame, VALUE dx, VALUE dy, VALUE dwidth, VALUE dheight)
24
24
  {
25
25
  CHECK;
26
- check_arg_count(__FILE__, __LINE__, "FrameEvent#initialize", argc, 0, 1, 2, 3, 4, 5);
27
26
 
28
- THIS->frame = (argc >= 1) ? to<Rays::Bounds&>(argv[0]) : Rays::Bounds(0);
29
- THIS->dx = (argc >= 2) ? to<coord>(argv[1]) : 0;
30
- THIS->dy = (argc >= 3) ? to<coord>(argv[2]) : 0;
31
- THIS->dwidth = (argc >= 4) ? to<coord>(argv[3]) : 0;
32
- THIS->dheight = (argc >= 5) ? to<coord>(argv[4]) : 0;
27
+ THIS->frame = to<Rays::Bounds>(frame);
28
+ THIS->dx = to<coord>(dx);
29
+ THIS->dy = to<coord>(dy);
30
+ THIS->dwidth = to<coord>(dwidth);
31
+ THIS->dheight = to<coord>(dheight);
33
32
 
34
33
  return rb_call_super(0, NULL);
35
34
  }
@@ -136,7 +135,7 @@ Init_frame_event ()
136
135
 
137
136
  cFrameEvent = mReflex.define_class("FrameEvent", Reflex::event_class());
138
137
  rb_define_alloc_func(cFrameEvent, alloc);
139
- rb_define_private_method(cFrameEvent, "initialize", RUBY_METHOD_FUNC(initialize), -1);
138
+ rb_define_private_method(cFrameEvent, "initialize", RUBY_METHOD_FUNC(initialize), 5);
140
139
  rb_define_private_method(cFrameEvent, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1);
141
140
  rb_define_method(cFrameEvent, "frame", RUBY_METHOD_FUNC(frame), 0);
142
141
  rb_define_method(cFrameEvent, "dx", RUBY_METHOD_FUNC(dx), 0);
@@ -18,16 +18,15 @@ VALUE alloc(VALUE klass)
18
18
  }
19
19
 
20
20
  static
21
- VALUE initialize(VALUE self)
21
+ VALUE initialize(VALUE self, VALUE type, VALUE chars, VALUE code, VALUE repeat, VALUE modifiers)
22
22
  {
23
23
  CHECK;
24
- check_arg_count(__FILE__, __LINE__, "KeyEvent#initialize", argc, 0, 1, 2, 3, 4, 5);
25
24
 
26
- THIS->type = (argc >= 1) ? (Reflex::KeyEvent::Type) to<int>(argv[0]) : Reflex::KeyEvent::NONE;
27
- THIS->chars = (argc >= 2) ? argv[1].c_str() : NULL;
28
- THIS->code = (argc >= 3) ? to<int>(argv[2]) : Reflex::KEY_NONE;
29
- THIS->repeat = (argc >= 4) ? to<int>(argv[3]) : 1;
30
- THIS->modifiers = (argc >= 5) ? to<uint>(argv[4]) : (uint) Reflex::MOD_NONE;
25
+ THIS->type = (Reflex::KeyEvent::Type) to<int>(type);
26
+ THIS->chars = chars.c_str();
27
+ THIS->code = to<int>(code);
28
+ THIS->repeat = to<int>(repeat);
29
+ THIS->modifiers = to<uint>(modifiers);
31
30
 
32
31
  return rb_call_super(0, NULL);
33
32
  }
@@ -92,7 +91,7 @@ Init_key_event ()
92
91
 
93
92
  cKeyEvent = mReflex.define_class("KeyEvent", Reflex::event_class());
94
93
  rb_define_alloc_func(cKeyEvent, alloc);
95
- rb_define_private_method(cKeyEvent, "initialize", RUBY_METHOD_FUNC(initialize), -1);
94
+ rb_define_private_method(cKeyEvent, "initialize", RUBY_METHOD_FUNC(initialize), 5);
96
95
  rb_define_private_method(cKeyEvent, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1);
97
96
  rb_define_method(cKeyEvent, "type", RUBY_METHOD_FUNC(type), 0);
98
97
  rb_define_method(cKeyEvent, "chars", RUBY_METHOD_FUNC(chars), 0);
@@ -19,13 +19,11 @@ VALUE alloc(VALUE klass)
19
19
  }
20
20
 
21
21
  static
22
- VALUE initialize(VALUE self)
22
+ VALUE initialize(VALUE self, VALUE gravity)
23
23
  {
24
24
  CHECK;
25
- check_arg_count(__FILE__, __LINE__, "MotionEvent#initialize", argc, 0, 1);
26
25
 
27
- if (argc >= 1)
28
- THIS->gravity = to<Rays::Point>(argv[0]);
26
+ THIS->gravity = to<Rays::Point>(gravity);
29
27
 
30
28
  return rb_call_super(0, NULL);
31
29
  }
@@ -55,7 +53,7 @@ Init_motion_event ()
55
53
 
56
54
  cMotionEvent = mReflex.define_class("MotionEvent", Reflex::event_class());
57
55
  rb_define_alloc_func(cMotionEvent, alloc);
58
- rb_define_private_method(cMotionEvent, "initialize", RUBY_METHOD_FUNC(initialize), -1);
56
+ rb_define_private_method(cMotionEvent, "initialize", RUBY_METHOD_FUNC(initialize), 1);
59
57
  rb_define_private_method(cMotionEvent, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1);
60
58
  rb_define_method(cMotionEvent, "gravity", RUBY_METHOD_FUNC(gravity), 0);
61
59
  }
@@ -19,19 +19,23 @@ VALUE alloc(VALUE klass)
19
19
  }
20
20
 
21
21
  static
22
- VALUE initialize(VALUE self)
22
+ VALUE initialize(VALUE self, VALUE type, VALUE pointer_type, VALUE modifiers, VALUE count, VALUE drag, VALUE positions)
23
23
  {
24
24
  CHECK;
25
- check_arg_count(__FILE__, __LINE__, "PointerEvent#initialize", argc, 0, 1, 2, 3, 4, 5, 6, 7);
26
25
 
27
- THIS->type = (argc >= 1) ? (Reflex::PointerEvent::Type) to<int>(argv[0]) : Reflex::PointerEvent::NONE;
28
- THIS->pointer_type = (argc >= 2) ? to<uint>(argv[1]) : Reflex::POINTER_NONE;
29
- THIS->x = (argc >= 3) ? to<coord>(argv[2]) : 0;
30
- THIS->y = (argc >= 4) ? to<coord>(argv[3]) : 0;
31
- THIS->size = 1;
32
- THIS->modifiers = (argc >= 5) ? to<uint>(argv[4]) : (uint) Reflex::MOD_NONE;
33
- THIS->count = (argc >= 6) ? to<uint>(argv[5]) : 0;
34
- THIS->drag = (argc >= 7) ? to<bool>(argv[6]) : false;
26
+ int size = positions.size();
27
+ if (size <= 0 || Reflex::PointerEvent::MAX < size)
28
+ argument_error(__FILE__, __LINE__);
29
+
30
+ THIS->type = (Reflex::PointerEvent::Type) to<int>(type);
31
+ THIS->pointer_type = to<uint>(pointer_type);
32
+ THIS->modifiers = to<uint>(modifiers);
33
+ THIS->count = to<uint>(count);
34
+ THIS->drag = to<bool>(drag);
35
+ THIS->size = (size_t) size;
36
+
37
+ for (int i = 0; i < size; ++i)
38
+ THIS->positions[i] = to<Rays::Point>(positions[i]);
35
39
 
36
40
  return rb_call_super(0, NULL);
37
41
  }
@@ -118,10 +122,15 @@ VALUE position(VALUE self)
118
122
  }
119
123
 
120
124
  static
121
- VALUE array_get(VALUE self, VALUE index)
125
+ VALUE get_at(VALUE self, VALUE index)
122
126
  {
123
127
  CHECK;
124
- return value((*THIS)[to<int>(index)]);
128
+
129
+ int i = to<int>(index);
130
+ if (i < 0 || THIS->size <= (size_t) i)
131
+ index_error(__FILE__, __LINE__);
132
+
133
+ return value((*THIS)[i]);
125
134
  }
126
135
 
127
136
 
@@ -134,7 +143,7 @@ Init_pointer_event ()
134
143
 
135
144
  cPointerEvent = mReflex.define_class("PointerEvent", Reflex::event_class());
136
145
  rb_define_alloc_func(cPointerEvent, alloc);
137
- rb_define_private_method(cPointerEvent, "initialize", RUBY_METHOD_FUNC(initialize), -1);
146
+ rb_define_private_method(cPointerEvent, "initialize", RUBY_METHOD_FUNC(initialize), 6);
138
147
  rb_define_private_method(cPointerEvent, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1);
139
148
  rb_define_method(cPointerEvent, "type", RUBY_METHOD_FUNC(type), 0);
140
149
  rb_define_method(cPointerEvent, "pointer_type", RUBY_METHOD_FUNC(pointer_type), 0);
@@ -146,7 +155,7 @@ Init_pointer_event ()
146
155
  rb_define_method(cPointerEvent, "x", RUBY_METHOD_FUNC(x), 0);
147
156
  rb_define_method(cPointerEvent, "y", RUBY_METHOD_FUNC(y), 0);
148
157
  rb_define_method(cPointerEvent, "position", RUBY_METHOD_FUNC(position), -1);
149
- cPointerEvent.define_method("[]", array_get);
158
+ cPointerEvent.define_method("[]", get_at);
150
159
  cPointerEvent.define_const("TYPE_NONE", Reflex::PointerEvent::NONE);
151
160
  cPointerEvent.define_const("TYPE_DOWN", Reflex::PointerEvent::DOWN);
152
161
  cPointerEvent.define_const("TYPE_UP", Reflex::PointerEvent::UP);
@@ -157,7 +166,6 @@ Init_pointer_event ()
157
166
  cPointerEvent.define_const("POINTER_MOUSE_MIDDLE", Reflex::POINTER_MOUSE_MIDDLE);
158
167
  cPointerEvent.define_const("POINTER_TOUCH", Reflex::POINTER_TOUCH);
159
168
  cPointerEvent.define_const("POINTER_PEN", Reflex::POINTER_PEN);
160
- cPointerEvent.define_const("POINTER_TYPE_LAST", Reflex::POINTER_TYPE_LAST);
161
169
  }
162
170
 
163
171
 
@@ -1,4 +1,6 @@
1
- #include "reflex/reflex.h"
1
+ #include "reflex/ruby/reflex.h"
2
+
3
+
2
4
  #include "reflex/ruby/view.h"
3
5
  #include "reflex/ruby/timer.h"
4
6
  #include "../../src/window.h"
@@ -19,17 +19,16 @@ VALUE alloc(VALUE klass)
19
19
  }
20
20
 
21
21
  static
22
- VALUE initialize(VALUE self)
22
+ VALUE initialize(VALUE self, VALUE x, VALUE y, VALUE z, VALUE dx, VALUE dy, VALUE dz)
23
23
  {
24
24
  CHECK;
25
- check_arg_count(__FILE__, __LINE__, "ScrollEvent#initialize", argc, 0, 1, 2, 3, 4, 5, 6);
26
25
 
27
- THIS->x = (argc >= 1) ? to<coord>(argv[0]) : 0;
28
- THIS->y = (argc >= 2) ? to<coord>(argv[1]) : 0;
29
- THIS->z = (argc >= 3) ? to<coord>(argv[2]) : 0;
30
- THIS->dx = (argc >= 4) ? to<coord>(argv[3]) : 0;
31
- THIS->dy = (argc >= 5) ? to<coord>(argv[4]) : 0;
32
- THIS->dz = (argc >= 6) ? to<coord>(argv[5]) : 0;
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);
33
32
 
34
33
  return rb_call_super(0, NULL);
35
34
  }
@@ -108,7 +107,7 @@ Init_scroll_event ()
108
107
 
109
108
  cScrollEvent = mReflex.define_class("ScrollEvent", Reflex::event_class());
110
109
  rb_define_alloc_func(cScrollEvent, alloc);
111
- rb_define_private_method(cScrollEvent, "initialize", RUBY_METHOD_FUNC(initialize), -1);
110
+ rb_define_private_method(cScrollEvent, "initialize", RUBY_METHOD_FUNC(initialize), 6);
112
111
  rb_define_private_method(cScrollEvent, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1);
113
112
  rb_define_method(cScrollEvent, "x", RUBY_METHOD_FUNC(x), 0);
114
113
  rb_define_method(cScrollEvent, "y", RUBY_METHOD_FUNC(y), 0);
@@ -18,13 +18,12 @@ VALUE alloc(VALUE klass)
18
18
  }
19
19
 
20
20
  static
21
- VALUE initialize(VALUE self)
21
+ VALUE initialize(VALUE self, VALUE now, VALUE dt)
22
22
  {
23
23
  CHECK;
24
- check_arg_count(__FILE__, __LINE__, "UpdateEvent#initialize", argc, 0, 1, 2);
25
24
 
26
- THIS->now = (argc >= 1) ? to<double>(argv[0]) : 0;
27
- THIS->dt = (argc >= 2) ? to<float>(argv[1]) : 0;
25
+ THIS->now = to<double>(now);
26
+ THIS->dt = to<float>(dt);
28
27
 
29
28
  return rb_call_super(0, NULL);
30
29
  }
@@ -61,7 +60,7 @@ Init_update_event ()
61
60
 
62
61
  cUpdateEvent = mReflex.define_class("UpdateEvent", Reflex::event_class());
63
62
  rb_define_alloc_func(cUpdateEvent, alloc);
64
- rb_define_private_method(cUpdateEvent, "initialize", RUBY_METHOD_FUNC(initialize), -1);
63
+ rb_define_private_method(cUpdateEvent, "initialize", RUBY_METHOD_FUNC(initialize), 2);
65
64
  rb_define_private_method(cUpdateEvent, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1);
66
65
  rb_define_method(cUpdateEvent, "now", RUBY_METHOD_FUNC(now), 0);
67
66
  rb_define_method(cUpdateEvent, "dt", RUBY_METHOD_FUNC(dt), 0);
@@ -19,14 +19,13 @@ VALUE alloc(VALUE klass)
19
19
  }
20
20
 
21
21
  static
22
- VALUE initialize(VALUE self)
22
+ VALUE initialize(VALUE self, VALUE dx, VALUE dy, VALUE dz)
23
23
  {
24
24
  CHECK;
25
- check_arg_count(__FILE__, __LINE__, "WheelEvent#initialize", argc, 0, 1, 2, 3);
26
25
 
27
- THIS->dx = (argc >= 1) ? to<coord>(argv[0]) : 0;
28
- THIS->dy = (argc >= 2) ? to<coord>(argv[1]) : 0;
29
- THIS->dz = (argc >= 3) ? to<coord>(argv[2]) : 0;
26
+ THIS->dx = to<coord>(dx);
27
+ THIS->dy = to<coord>(dy);
28
+ THIS->dz = to<coord>(dz);
30
29
 
31
30
  return rb_call_super(0, NULL);
32
31
  }
@@ -98,7 +97,7 @@ Init_wheel_event ()
98
97
 
99
98
  cWheelEvent = mReflex.define_class("WheelEvent", Reflex::event_class());
100
99
  rb_define_alloc_func(cWheelEvent, alloc);
101
- rb_define_private_method(cWheelEvent, "initialize", RUBY_METHOD_FUNC(initialize), -1);
100
+ rb_define_private_method(cWheelEvent, "initialize", RUBY_METHOD_FUNC(initialize), 3);
102
101
  rb_define_private_method(cWheelEvent, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1);
103
102
  rb_define_method(cWheelEvent, "dx", RUBY_METHOD_FUNC(dx), 0);
104
103
  rb_define_method(cWheelEvent, "dy", RUBY_METHOD_FUNC(dy), 0);
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.14
1
+ 0.1.20
@@ -20,13 +20,12 @@ RUCY_DEF_ALLOC(alloc, klass)
20
20
  RUCY_END
21
21
 
22
22
  static
23
- RUCY_DEFN(initialize)
23
+ RUCY_DEF2(initialize, begin, end)
24
24
  {
25
25
  CHECK;
26
- check_arg_count(__FILE__, __LINE__, "CaptureEvent#initialize", argc, 0, 1, 2);
27
26
 
28
- THIS->begin = (argc >= 1) ? to<uint>(argv[0]) : 0;
29
- THIS->end = (argc >= 2) ? to<uint>(argv[1]) : 0;
27
+ THIS->begin = to<uint>(begin);
28
+ THIS->end = to<uint>(end);
30
29
 
31
30
  return rb_call_super(0, NULL);
32
31
  }
@@ -21,15 +21,12 @@ RUCY_DEF_ALLOC(alloc, klass)
21
21
  RUCY_END
22
22
 
23
23
  static
24
- RUCY_DEFN(initialize)
24
+ RUCY_DEF2(initialize, type, shape)
25
25
  {
26
26
  CHECK;
27
- check_arg_count(__FILE__, __LINE__, "ContactEvent#initialize", argc, 0, 2);
28
27
 
29
- THIS->type = (argc >= 1)
30
- ? (Reflex::ContactEvent::Type) to<int>(argv[0])
31
- : Reflex::ContactEvent::NONE;
32
- THIS->shape = (argc >= 2) ? to<Reflex::Shape*>(argv[1]) : NULL;
28
+ THIS->type = (Reflex::ContactEvent::Type) to<int>(type);
29
+ THIS->shape = to<Reflex::Shape*>(shape);
33
30
 
34
31
  return rb_call_super(0, NULL);
35
32
  }
@@ -21,12 +21,11 @@ RUCY_DEF_ALLOC(alloc, klass)
21
21
  RUCY_END
22
22
 
23
23
  static
24
- RUCY_DEFN(initialize)
24
+ RUCY_DEF1(initialize, dt)
25
25
  {
26
26
  CHECK;
27
- check_arg_count(__FILE__, __LINE__, "DrawEvent#initialize", argc, 0, 1);
28
27
 
29
- THIS->dt = (argc >= 1) ? to<float>(argv[0]) : 0;
28
+ THIS->dt = to<float>(dt);
30
29
 
31
30
  return rb_call_super(0, NULL);
32
31
  }
@@ -21,16 +21,15 @@ RUCY_DEF_ALLOC(alloc, klass)
21
21
  RUCY_END
22
22
 
23
23
  static
24
- RUCY_DEFN(initialize)
24
+ RUCY_DEF5(initialize, frame, dx, dy, dwidth, dheight)
25
25
  {
26
26
  CHECK;
27
- check_arg_count(__FILE__, __LINE__, "FrameEvent#initialize", argc, 0, 1, 2, 3, 4, 5);
28
27
 
29
- THIS->frame = (argc >= 1) ? to<Rays::Bounds&>(argv[0]) : Rays::Bounds(0);
30
- THIS->dx = (argc >= 2) ? to<coord>(argv[1]) : 0;
31
- THIS->dy = (argc >= 3) ? to<coord>(argv[2]) : 0;
32
- THIS->dwidth = (argc >= 4) ? to<coord>(argv[3]) : 0;
33
- THIS->dheight = (argc >= 5) ? to<coord>(argv[4]) : 0;
28
+ THIS->frame = to<Rays::Bounds>(frame);
29
+ THIS->dx = to<coord>(dx);
30
+ THIS->dy = to<coord>(dy);
31
+ THIS->dwidth = to<coord>(dwidth);
32
+ THIS->dheight = to<coord>(dheight);
34
33
 
35
34
  return rb_call_super(0, NULL);
36
35
  }
@@ -19,16 +19,15 @@ RUCY_DEF_ALLOC(alloc, klass)
19
19
  RUCY_END
20
20
 
21
21
  static
22
- RUCY_DEFN(initialize)
22
+ RUCY_DEF5(initialize, type, chars, code, repeat, modifiers)
23
23
  {
24
24
  CHECK;
25
- check_arg_count(__FILE__, __LINE__, "KeyEvent#initialize", argc, 0, 1, 2, 3, 4, 5);
26
25
 
27
- THIS->type = (argc >= 1) ? (Reflex::KeyEvent::Type) to<int>(argv[0]) : Reflex::KeyEvent::NONE;
28
- THIS->chars = (argc >= 2) ? argv[1].c_str() : NULL;
29
- THIS->code = (argc >= 3) ? to<int>(argv[2]) : Reflex::KEY_NONE;
30
- THIS->repeat = (argc >= 4) ? to<int>(argv[3]) : 1;
31
- THIS->modifiers = (argc >= 5) ? to<uint>(argv[4]) : (uint) Reflex::MOD_NONE;
26
+ THIS->type = (Reflex::KeyEvent::Type) to<int>(type);
27
+ THIS->chars = chars.c_str();
28
+ THIS->code = to<int>(code);
29
+ THIS->repeat = to<int>(repeat);
30
+ THIS->modifiers = to<uint>(modifiers);
32
31
 
33
32
  return rb_call_super(0, NULL);
34
33
  }