reflexion 0.1.15 → 0.1.21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) 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 -14
  9. data/.doc/ext/reflex/scroll_event.cpp +8 -9
  10. data/.doc/ext/reflex/update_event.cpp +4 -5
  11. data/.doc/ext/reflex/wheel_event.cpp +5 -6
  12. data/.doc/ext/reflex/window.cpp +17 -0
  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 -13
  21. data/ext/reflex/scroll_event.cpp +8 -9
  22. data/ext/reflex/update_event.cpp +3 -4
  23. data/ext/reflex/wheel_event.cpp +4 -5
  24. data/ext/reflex/window.cpp +19 -0
  25. data/include/reflex/event.h +15 -15
  26. data/include/reflex/exception.h +9 -3
  27. data/include/reflex/ruby/event.h +11 -11
  28. data/include/reflex/window.h +4 -0
  29. data/lib/reflex.rb +2 -1
  30. data/lib/reflex/camera.rb +13 -0
  31. data/lib/reflex/pointer_event.rb +4 -0
  32. data/lib/reflex/window.rb +2 -1
  33. data/reflex.gemspec +4 -4
  34. data/samples/camera.rb +45 -0
  35. data/src/event.cpp +7 -7
  36. data/src/ios/view_controller.mm +1 -1
  37. data/src/ios/window.mm +18 -0
  38. data/src/osx/native_window.mm +1 -1
  39. data/src/osx/window.mm +22 -0
  40. data/src/timer.cpp +3 -6
  41. data/src/window.cpp +13 -1
  42. data/src/window.h +6 -0
  43. data/test/test_pointer_event.rb +79 -34
  44. data/test/test_window.rb +17 -0
  45. metadata +15 -13
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5161374ea08be1889e5cc2efe3e1428e8d9d620f8bac6073e5b010bd10bedebe
4
- data.tar.gz: 2ba43dca1df02955b05cf58f6a9046f21941a605f8c9d8c1bdc744fb8d808ab2
3
+ metadata.gz: 3a92694d805e53936c602a5b7b4f686c39505f90683f039d021678dae013408a
4
+ data.tar.gz: 78b1cc8751399d48133827f757bd53dd8b165afb695da6b233d80134977274ba
5
5
  SHA512:
6
- metadata.gz: 4e237f277deb2ca92edee8663023891f3bba4cc8d2ac8e54ed7317f1dee8907c159afb3e20a7b6c5d798e0d0979b8bec709cf19a18decba5578d782e36c1e8d8
7
- data.tar.gz: 61430437a4717c0547f3fb8432e0faa0532391e1bee56fa46083986e4f1c68d7aa194d261264144c1f7416f4c1926e6f7ca4e32a0ca371835337e9a57b5abb65
6
+ metadata.gz: e0086b7bcbc0f684dc3e94fe57fee7057e055708f338d22c11f6dea11dd9c36056079c2558c77bb24d8277b15758e86707a95c0c03ae9e21c35e8192385efe1f
7
+ data.tar.gz: 656414624e17e036e032b0904a7499c6fbb3846b96b8eac83bdf6c6ec6154e89fc93f73ca5d95ee340336830579546cc179342374a7624b8870af4c192ff97d4
@@ -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);
@@ -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);
@@ -84,6 +84,21 @@ VALUE get_frame(VALUE self)
84
84
  return value(THIS->frame());
85
85
  }
86
86
 
87
+ static
88
+ VALUE set_resizable(VALUE self, VALUE state)
89
+ {
90
+ CHECK;
91
+ THIS->set_resizable(to<bool>(state));
92
+ return value(THIS->is_resizable());
93
+ }
94
+
95
+ static
96
+ VALUE is_resizable(VALUE self)
97
+ {
98
+ CHECK;
99
+ return value(THIS->is_resizable());
100
+ }
101
+
87
102
  static
88
103
  VALUE hidden(VALUE self)
89
104
  {
@@ -239,6 +254,8 @@ Init_window ()
239
254
  rb_define_method(cWindow, "title", RUBY_METHOD_FUNC(get_title), 0);
240
255
  rb_define_method(cWindow, "frame=", RUBY_METHOD_FUNC(set_frame), -1);
241
256
  rb_define_method(cWindow, "frame", RUBY_METHOD_FUNC(get_frame), 0);
257
+ rb_define_method(cWindow, "resizable=", RUBY_METHOD_FUNC(set_resizable), 1);
258
+ cWindow.define_method("resizable?", is_resizable);
242
259
  rb_define_method(cWindow, "hidden", RUBY_METHOD_FUNC(hidden), 0);
243
260
  rb_define_method(cWindow, "root", RUBY_METHOD_FUNC(root), 0);
244
261
  rb_define_method(cWindow, "focus", RUBY_METHOD_FUNC(focus), 0);
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.15
1
+ 0.1.21
@@ -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
  }