reflexion 0.1.13 → 0.1.19

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.
Files changed (49) 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/LICENSE +21 -0
  14. data/VERSION +1 -1
  15. data/ext/reflex/capture_event.cpp +3 -4
  16. data/ext/reflex/contact_event.cpp +3 -6
  17. data/ext/reflex/draw_event.cpp +2 -3
  18. data/ext/reflex/frame_event.cpp +6 -7
  19. data/ext/reflex/key_event.cpp +6 -7
  20. data/ext/reflex/motion_event.cpp +2 -4
  21. data/ext/reflex/pointer_event.cpp +22 -14
  22. data/ext/reflex/reflex.cpp +3 -1
  23. data/ext/reflex/scroll_event.cpp +8 -9
  24. data/ext/reflex/update_event.cpp +3 -4
  25. data/ext/reflex/wheel_event.cpp +4 -5
  26. data/include/reflex/defs.h +0 -2
  27. data/include/reflex/event.h +15 -15
  28. data/include/reflex/exception.h +9 -3
  29. data/include/reflex/ruby/event.h +11 -11
  30. data/include/reflex/ruby/reflex.h +1 -0
  31. data/include/reflex/style.h +30 -4
  32. data/lib/reflex.rb +2 -1
  33. data/lib/reflex/camera.rb +13 -0
  34. data/lib/reflex/pointer_event.rb +4 -0
  35. data/reflex.gemspec +4 -4
  36. data/samples/camera.rb +45 -0
  37. data/samples/shapes.rb +16 -0
  38. data/src/event.cpp +7 -7
  39. data/src/ios/view_controller.h +4 -0
  40. data/src/ios/view_controller.mm +22 -34
  41. data/src/osx/native_window.mm +10 -26
  42. data/src/shape.cpp +4 -4
  43. data/src/style.cpp +4 -4
  44. data/src/timer.cpp +3 -6
  45. data/src/view.cpp +2 -2
  46. data/src/window.cpp +27 -0
  47. data/src/window.h +2 -0
  48. data/test/test_pointer_event.rb +79 -34
  49. metadata +16 -13
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a2bb469e3b1abf80f565057e6d358a8e94e655903f9e0ba4305fedbaeda4c784
4
- data.tar.gz: c142e94f6412857c9c72e6edbc1556e1dd8e1c8b37f02c9135719684928a6a12
3
+ metadata.gz: 677d72a43f7a17301138300a14b259ef99688cff51ffc78dd9b5e265f3dd1138
4
+ data.tar.gz: e1d7f5ab950ef7bb9a48fb429fbf4345efda40097b5f4fb1f5da435baa4c1565
5
5
  SHA512:
6
- metadata.gz: a2f43e90b2c849dda364feba2465a820ddf10d7319de25763d36732fecb00aa0e1586bb133b5f28392674f8f686badcb209f846b06ad71597af6780c9f915c8e
7
- data.tar.gz: a2112d4d6af9a6027c736a6ba099a1c3e672add1d9fec42b420bd114481ae1bfe1feabd072e3c1edccc18f857b63f45f36448aa6b15264ec2125c5176c92f932
6
+ metadata.gz: c51257ea8fe427fe3c2631ee394c98280c1cd22e40608d341908e8878f9efcb7d0c3dadb89e9759b43d924f9dcb0e9630ccfe28a2fb54016b5888d9123a23312
7
+ data.tar.gz: dcd652695bb9af96a7dce764b796672ee94682b0dc86e3bee3b2e4840f293ecf45a7a8bd97d64dc948730365945afbb80c8f4d7c03edc8f52ddcd0d44d5b64e7
@@ -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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019 xord.org
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.13
1
+ 0.1.19
@@ -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
  }