reflexion 0.1.23 → 0.1.24

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 (65) 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 +14 -12
  4. data/.doc/ext/reflex/draw_event.cpp +10 -8
  5. data/.doc/ext/reflex/event.cpp +2 -10
  6. data/.doc/ext/reflex/focus_event.cpp +14 -13
  7. data/.doc/ext/reflex/frame_event.cpp +17 -17
  8. data/.doc/ext/reflex/key_event.cpp +20 -19
  9. data/.doc/ext/reflex/pointer_event.cpp +1 -1
  10. data/.doc/ext/reflex/scroll_event.cpp +14 -17
  11. data/.doc/ext/reflex/timer.cpp +9 -1
  12. data/.doc/ext/reflex/timer_event.cpp +4 -13
  13. data/.doc/ext/reflex/update_event.cpp +6 -5
  14. data/.doc/ext/reflex/wheel_event.cpp +39 -22
  15. data/VERSION +1 -1
  16. data/ext/reflex/capture_event.cpp +6 -5
  17. data/ext/reflex/contact_event.cpp +16 -14
  18. data/ext/reflex/draw_event.cpp +9 -7
  19. data/ext/reflex/event.cpp +2 -11
  20. data/ext/reflex/focus_event.cpp +14 -13
  21. data/ext/reflex/frame_event.cpp +16 -16
  22. data/ext/reflex/key_event.cpp +20 -19
  23. data/ext/reflex/pointer_event.cpp +1 -1
  24. data/ext/reflex/scroll_event.cpp +15 -18
  25. data/ext/reflex/timer.cpp +15 -6
  26. data/ext/reflex/timer_event.cpp +9 -19
  27. data/ext/reflex/update_event.cpp +6 -5
  28. data/ext/reflex/wheel_event.cpp +40 -21
  29. data/include/reflex/event.h +224 -115
  30. data/include/reflex/shape.h +2 -2
  31. data/lib/reflex/contact_event.rb +7 -7
  32. data/lib/reflex/focus_event.rb +8 -8
  33. data/lib/reflex/key_event.rb +8 -8
  34. data/lib/reflex/pointer.rb +3 -3
  35. data/lib/reflex/timer_event.rb +2 -1
  36. data/lib/reflex/wheel_event.rb +1 -9
  37. data/lib/reflex/window.rb +1 -1
  38. data/reflex.gemspec +4 -4
  39. data/src/event.cpp +630 -76
  40. data/src/event.h +15 -0
  41. data/src/image_view.cpp +2 -2
  42. data/src/ios/view_controller.mm +1 -1
  43. data/src/osx/event.h +1 -1
  44. data/src/osx/event.mm +9 -9
  45. data/src/osx/native_window.mm +1 -1
  46. data/src/shape.cpp +11 -13
  47. data/src/shape.h +1 -1
  48. data/src/view.cpp +137 -89
  49. data/src/view.h +5 -6
  50. data/src/window.cpp +44 -38
  51. data/src/world.cpp +6 -4
  52. data/test/test_capture_event.rb +16 -0
  53. data/test/test_contact_event.rb +40 -0
  54. data/test/test_draw_event.rb +35 -0
  55. data/test/test_event.rb +20 -6
  56. data/test/test_focus_event.rb +34 -0
  57. data/test/test_frame_event.rb +38 -0
  58. data/test/test_key_event.rb +33 -0
  59. data/test/test_pointer.rb +14 -14
  60. data/test/test_pointer_event.rb +1 -1
  61. data/test/test_scroll_event.rb +39 -0
  62. data/test/test_timer_event.rb +38 -0
  63. data/test/test_update_event.rb +29 -0
  64. data/test/test_wheel_event.rb +40 -0
  65. metadata +29 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5c9de459b494d9ab8e2e94e53a26b0fd9d363a1c66dd442894d0385827634849
4
- data.tar.gz: 26858625a7e25d0cbba85d7a054ab9426c526997d0eb2ed704b125ee93ba436c
3
+ metadata.gz: b21f636473fd5ec680195625f775ee0e324c0a8b75da8b54495fa65fc4831240
4
+ data.tar.gz: f5fdb73a7042b0c8fbacecd3da1b12cd568540fb4bbff732bdec166870c9f3b5
5
5
  SHA512:
6
- metadata.gz: 6c0e16849f3de4b39cfe8270f8208b0e6e1f2cae808e3a678f4b79bad2d9a397f741e78474670350de327e54c91fe64f199f6b2dc437635950147a0f91610e5a
7
- data.tar.gz: 2c38f9a17ec2a0d8a81f067b3326c0dca5bc970d86735ac503238eb458ac8ed8c452bc32042ee96f4a109e78742a8b3107d48237775e4090a08885905e378709
6
+ metadata.gz: c84fe590235e2d6accdac0c1201f9eb3cc456ebc68f7826a50cd562f942e021d875e24e396431af19d62066badc0f365b256541cbccff8f99bfa30b8d5e382ff
7
+ data.tar.gz: aa65600b586920743817256a1ab0c34c5a1428c5c7785759521e2ab602ffed17c95ec6e816a488d48e0181d5516743c382cc56e85fe95a26dd7fa209cd04cde7
@@ -23,8 +23,9 @@ VALUE initialize(VALUE self, VALUE begin, VALUE end)
23
23
  {
24
24
  CHECK;
25
25
 
26
- THIS->begin = to<uint>(begin);
27
- THIS->end = to<uint>(end);
26
+ *THIS = Reflex::CaptureEvent(
27
+ to<uint>(begin),
28
+ to<uint>(end));
28
29
 
29
30
  return rb_call_super(0, NULL);
30
31
  }
@@ -33,7 +34,7 @@ static
33
34
  VALUE initialize_copy(VALUE self, VALUE obj)
34
35
  {
35
36
  CHECK;
36
- *THIS = to<Reflex::CaptureEvent&>(obj);
37
+ *THIS = to<Reflex::CaptureEvent&>(obj).dup();
37
38
  return self;
38
39
  }
39
40
 
@@ -41,14 +42,14 @@ static
41
42
  VALUE begin(VALUE self)
42
43
  {
43
44
  CHECK;
44
- return value(THIS->begin);
45
+ return value(THIS->begin());
45
46
  }
46
47
 
47
48
  static
48
49
  VALUE end(VALUE self)
49
50
  {
50
51
  CHECK;
51
- return value(THIS->end);
52
+ return value(THIS->end());
52
53
  }
53
54
 
54
55
 
@@ -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
 
@@ -20,12 +21,13 @@ VALUE alloc(VALUE klass)
20
21
  }
21
22
 
22
23
  static
23
- VALUE initialize(VALUE self, VALUE type, VALUE shape)
24
+ VALUE initialize(VALUE self, VALUE action, VALUE shape)
24
25
  {
25
26
  CHECK;
26
27
 
27
- THIS->type = (Reflex::ContactEvent::Type) to<int>(type);
28
- THIS->shape = to<Reflex::Shape*>(shape);
28
+ *THIS = Reflex::ContactEvent(
29
+ (Reflex::ContactEvent::Action) to<uint>(action),
30
+ to<Reflex::Shape*>(shape));
29
31
 
30
32
  return rb_call_super(0, NULL);
31
33
  }
@@ -34,29 +36,29 @@ static
34
36
  VALUE initialize_copy(VALUE self, VALUE obj)
35
37
  {
36
38
  CHECK;
37
- *THIS = to<Reflex::ContactEvent&>(obj);
39
+ *THIS = to<Reflex::ContactEvent&>(obj).dup();
38
40
  return self;
39
41
  }
40
42
 
41
43
  static
42
- VALUE get_type(VALUE self)
44
+ VALUE get_action(VALUE self)
43
45
  {
44
46
  CHECK;
45
- return value(THIS->type);
47
+ return value(THIS->action());
46
48
  }
47
49
 
48
50
  static
49
51
  VALUE get_shape(VALUE self)
50
52
  {
51
53
  CHECK;
52
- return value(THIS->shape);
54
+ return value(THIS->shape());
53
55
  }
54
56
 
55
57
  static
56
58
  VALUE get_view(VALUE self)
57
59
  {
58
60
  CHECK;
59
- return value(THIS->view);
61
+ return value(THIS->view());
60
62
  }
61
63
 
62
64
 
@@ -71,12 +73,12 @@ Init_contact_event ()
71
73
  rb_define_alloc_func(cContactEvent, alloc);
72
74
  rb_define_private_method(cContactEvent, "initialize", RUBY_METHOD_FUNC(initialize), 2);
73
75
  rb_define_private_method(cContactEvent, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1);
74
- rb_define_method(cContactEvent, "type", RUBY_METHOD_FUNC(get_type), 0);
76
+ rb_define_method(cContactEvent, "action", RUBY_METHOD_FUNC(get_action), 0);
75
77
  rb_define_method(cContactEvent, "shape", RUBY_METHOD_FUNC(get_shape), 0);
76
78
  rb_define_method(cContactEvent, "view", RUBY_METHOD_FUNC(get_view), 0);
77
- cContactEvent.define_const("TYPE_NONE", Reflex::ContactEvent::NONE);
78
- cContactEvent.define_const("TYPE_BEGIN", Reflex::ContactEvent::BEGIN);
79
- cContactEvent.define_const("TYPE_END", Reflex::ContactEvent::END);
79
+ cContactEvent.define_const("ACTION_NONE", Reflex::ContactEvent::ACTION_NONE);
80
+ cContactEvent.define_const("BEGIN", Reflex::ContactEvent::BEGIN);
81
+ cContactEvent.define_const("END", Reflex::ContactEvent::END);
80
82
  }
81
83
 
82
84
 
@@ -20,11 +20,13 @@ VALUE alloc(VALUE klass)
20
20
  }
21
21
 
22
22
  static
23
- VALUE initialize(VALUE self, VALUE dt)
23
+ VALUE initialize(VALUE self, VALUE dt, VALUE fps)
24
24
  {
25
25
  CHECK;
26
26
 
27
- THIS->dt = to<float>(dt);
27
+ *THIS = Reflex::DrawEvent(
28
+ to<float>(dt),
29
+ to<float>(fps));
28
30
 
29
31
  return rb_call_super(0, NULL);
30
32
  }
@@ -33,7 +35,7 @@ static
33
35
  VALUE initialize_copy(VALUE self, VALUE obj)
34
36
  {
35
37
  CHECK;
36
- *THIS = to<Reflex::DrawEvent&>(obj);
38
+ *THIS = to<Reflex::DrawEvent&>(obj).dup();
37
39
  return self;
38
40
  }
39
41
 
@@ -41,28 +43,28 @@ static
41
43
  VALUE painter(VALUE self)
42
44
  {
43
45
  CHECK;
44
- return value(THIS->painter);
46
+ return value(THIS->painter());
45
47
  }
46
48
 
47
49
  static
48
50
  VALUE bounds(VALUE self)
49
51
  {
50
52
  CHECK;
51
- return value(THIS->bounds);
53
+ return value(THIS->bounds());
52
54
  }
53
55
 
54
56
  static
55
57
  VALUE dt(VALUE self)
56
58
  {
57
59
  CHECK;
58
- return value(THIS->dt);
60
+ return value(THIS->dt());
59
61
  }
60
62
 
61
63
  static
62
64
  VALUE fps(VALUE self)
63
65
  {
64
66
  CHECK;
65
- return value(THIS->fps);
67
+ return value(THIS->fps());
66
68
  }
67
69
 
68
70
 
@@ -75,7 +77,7 @@ Init_draw_event ()
75
77
 
76
78
  cDrawEvent = mReflex.define_class("DrawEvent", Reflex::event_class());
77
79
  rb_define_alloc_func(cDrawEvent, alloc);
78
- rb_define_private_method(cDrawEvent, "initialize", RUBY_METHOD_FUNC(initialize), 1);
80
+ rb_define_private_method(cDrawEvent, "initialize", RUBY_METHOD_FUNC(initialize), 2);
79
81
  rb_define_private_method(cDrawEvent, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1);
80
82
  rb_define_method(cDrawEvent, "painter", RUBY_METHOD_FUNC(painter), 0);
81
83
  rb_define_method(cDrawEvent, "bounds", RUBY_METHOD_FUNC(bounds), 0);
@@ -1,6 +1,7 @@
1
1
  #include "reflex/ruby/event.h"
2
2
 
3
3
 
4
+ #include "reflex/exception.h"
4
5
  #include "defs.h"
5
6
 
6
7
 
@@ -14,15 +15,7 @@ RUCY_DEFINE_VALUE_FROM_TO(Reflex::Event)
14
15
  static
15
16
  VALUE alloc(VALUE klass)
16
17
  {
17
- return new_type<Reflex::Event>(klass);
18
- }
19
-
20
- static
21
- VALUE initialize_copy(VALUE self, VALUE obj)
22
- {
23
- CHECK;
24
- *THIS = to<Reflex::Event&>(obj);
25
- return self;
18
+ Reflex::reflex_error(__FILE__, __LINE__, "can not instantiate Event class.");
26
19
  }
27
20
 
28
21
  static
@@ -56,7 +49,6 @@ Init_event ()
56
49
 
57
50
  cEvent = rb_define_class_under(mReflex, "Event", rb_cObject);
58
51
  rb_define_alloc_func(cEvent, alloc);
59
- rb_define_private_method(cEvent, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1);
60
52
  rb_define_method(cEvent, "block", RUBY_METHOD_FUNC(block), 0);
61
53
  cEvent.define_method("blocked?", is_blocked);
62
54
  rb_define_method(cEvent, "time", RUBY_METHOD_FUNC(get_time), 0);
@@ -19,13 +19,14 @@ VALUE alloc(VALUE klass)
19
19
  }
20
20
 
21
21
  static
22
- VALUE initialize(VALUE self, VALUE type, VALUE current, VALUE last)
22
+ VALUE initialize(VALUE self, VALUE action, VALUE current, VALUE last)
23
23
  {
24
24
  CHECK;
25
25
 
26
- THIS->type = (Reflex::FocusEvent::Type) to<uint>(type);
27
- THIS->current = to<Reflex::View*>(current);
28
- THIS->last = to<Reflex::View*>(last);
26
+ *THIS = Reflex::FocusEvent(
27
+ (Reflex::FocusEvent::Action) to<uint>(action),
28
+ to<Reflex::View*>(current),
29
+ to<Reflex::View*>(last));
29
30
 
30
31
  return rb_call_super(0, NULL);
31
32
  }
@@ -34,29 +35,29 @@ static
34
35
  VALUE initialize_copy(VALUE self, VALUE obj)
35
36
  {
36
37
  CHECK;
37
- *THIS = to<Reflex::FocusEvent&>(obj);
38
+ *THIS = to<Reflex::FocusEvent&>(obj).dup();
38
39
  return self;
39
40
  }
40
41
 
41
42
  static
42
- VALUE get_type(VALUE self)
43
+ VALUE get_action(VALUE self)
43
44
  {
44
45
  CHECK;
45
- return value(THIS->type);
46
+ return value(THIS->action());
46
47
  }
47
48
 
48
49
  static
49
50
  VALUE get_current(VALUE self)
50
51
  {
51
52
  CHECK;
52
- return THIS->current ? value(THIS->current) : nil();
53
+ return THIS->current() ? value(THIS->current()) : nil();
53
54
  }
54
55
 
55
56
  static
56
57
  VALUE get_last(VALUE self)
57
58
  {
58
59
  CHECK;
59
- return THIS->last ? value(THIS->last) : nil();
60
+ return THIS->last() ? value(THIS->last()) : nil();
60
61
  }
61
62
 
62
63
 
@@ -71,12 +72,12 @@ Init_focus_event ()
71
72
  rb_define_alloc_func(cFocusEvent, alloc);
72
73
  rb_define_private_method(cFocusEvent, "initialize", RUBY_METHOD_FUNC(initialize), 3);
73
74
  rb_define_private_method(cFocusEvent, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1);
74
- rb_define_method(cFocusEvent, "type", RUBY_METHOD_FUNC(get_type), 0);
75
+ rb_define_method(cFocusEvent, "action", RUBY_METHOD_FUNC(get_action), 0);
75
76
  rb_define_method(cFocusEvent, "current", RUBY_METHOD_FUNC(get_current), 0);
76
77
  rb_define_method(cFocusEvent, "last", RUBY_METHOD_FUNC(get_last), 0);
77
- cFocusEvent.define_const("TYPE_NONE", Reflex::FocusEvent::NONE);
78
- cFocusEvent.define_const("TYPE_FOCUS", Reflex::FocusEvent::FOCUS);
79
- cFocusEvent.define_const("TYPE_BLUR", Reflex::FocusEvent::BLUR);
78
+ cFocusEvent.define_const("ACTION_NONE", Reflex::FocusEvent::ACTION_NONE);
79
+ cFocusEvent.define_const("FOCUS", Reflex::FocusEvent::FOCUS);
80
+ cFocusEvent.define_const("BLUR", Reflex::FocusEvent::BLUR);
80
81
  }
81
82
 
82
83
 
@@ -20,15 +20,15 @@ VALUE alloc(VALUE klass)
20
20
  }
21
21
 
22
22
  static
23
- VALUE initialize(VALUE self, VALUE frame, VALUE dx, VALUE dy, VALUE dwidth, VALUE dheight)
23
+ VALUE initialize(VALUE self, VALUE frame, VALUE dx, VALUE dy, VALUE dwidth, VALUE dheight, VALUE angle, VALUE dangle)
24
24
  {
25
25
  CHECK;
26
26
 
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);
27
+ *THIS = Reflex::FrameEvent(
28
+ to<Rays::Bounds>(frame),
29
+ to<coord>(dx), to<coord>(dy),
30
+ to<coord>(dwidth), to<coord>(dheight),
31
+ to<float>(angle), to<float>(dangle));
32
32
 
33
33
  return rb_call_super(0, NULL);
34
34
  }
@@ -37,7 +37,7 @@ static
37
37
  VALUE initialize_copy(VALUE self, VALUE obj)
38
38
  {
39
39
  CHECK;
40
- *THIS = to<Reflex::FrameEvent&>(obj);
40
+ *THIS = to<Reflex::FrameEvent&>(obj).dup();
41
41
  return self;
42
42
  }
43
43
 
@@ -45,63 +45,63 @@ static
45
45
  VALUE frame(VALUE self)
46
46
  {
47
47
  CHECK;
48
- return value(THIS->frame);
48
+ return value(THIS->frame());
49
49
  }
50
50
 
51
51
  static
52
52
  VALUE dx(VALUE self)
53
53
  {
54
54
  CHECK;
55
- return value(THIS->dx);
55
+ return value(THIS->dx());
56
56
  }
57
57
 
58
58
  static
59
59
  VALUE dy(VALUE self)
60
60
  {
61
61
  CHECK;
62
- return value(THIS->dy);
62
+ return value(THIS->dy());
63
63
  }
64
64
 
65
65
  static
66
66
  VALUE dwidth(VALUE self)
67
67
  {
68
68
  CHECK;
69
- return value(THIS->dwidth);
69
+ return value(THIS->dwidth());
70
70
  }
71
71
 
72
72
  static
73
73
  VALUE dheight(VALUE self)
74
74
  {
75
75
  CHECK;
76
- return value(THIS->dheight);
76
+ return value(THIS->dheight());
77
77
  }
78
78
 
79
79
  static
80
80
  VALUE dposition(VALUE self)
81
81
  {
82
82
  CHECK;
83
- return value(Rays::Point(THIS->dx, THIS->dy));
83
+ return value(Rays::Point(THIS->dx(), THIS->dy()));
84
84
  }
85
85
 
86
86
  static
87
87
  VALUE dsize(VALUE self)
88
88
  {
89
89
  CHECK;
90
- return value(Rays::Point(THIS->dw, THIS->dh));
90
+ return value(Rays::Point(THIS->dwidth(), THIS->dheight()));
91
91
  }
92
92
 
93
93
  static
94
94
  VALUE angle(VALUE self)
95
95
  {
96
96
  CHECK;
97
- return value(THIS->angle);
97
+ return value(THIS->angle());
98
98
  }
99
99
 
100
100
  static
101
101
  VALUE dangle(VALUE self)
102
102
  {
103
103
  CHECK;
104
- return value(THIS->dangle);
104
+ return value(THIS->dangle());
105
105
  }
106
106
 
107
107
  static
@@ -135,7 +135,7 @@ Init_frame_event ()
135
135
 
136
136
  cFrameEvent = mReflex.define_class("FrameEvent", Reflex::event_class());
137
137
  rb_define_alloc_func(cFrameEvent, alloc);
138
- rb_define_private_method(cFrameEvent, "initialize", RUBY_METHOD_FUNC(initialize), 5);
138
+ rb_define_private_method(cFrameEvent, "initialize", RUBY_METHOD_FUNC(initialize), 7);
139
139
  rb_define_private_method(cFrameEvent, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1);
140
140
  rb_define_method(cFrameEvent, "frame", RUBY_METHOD_FUNC(frame), 0);
141
141
  rb_define_method(cFrameEvent, "dx", RUBY_METHOD_FUNC(dx), 0);
@@ -18,15 +18,16 @@ VALUE alloc(VALUE klass)
18
18
  }
19
19
 
20
20
  static
21
- VALUE initialize(VALUE self, VALUE type, VALUE chars, VALUE code, VALUE repeat, VALUE modifiers)
21
+ VALUE initialize(VALUE self, VALUE action, VALUE chars, VALUE code, VALUE modifiers, VALUE repeat)
22
22
  {
23
23
  CHECK;
24
24
 
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);
25
+ *THIS = Reflex::KeyEvent(
26
+ (Reflex::KeyEvent::Action) to<uint>(action),
27
+ chars.c_str(),
28
+ to<int>(code),
29
+ to<uint>(modifiers),
30
+ to<int>(repeat));
30
31
 
31
32
  return rb_call_super(0, NULL);
32
33
  }
@@ -35,22 +36,22 @@ static
35
36
  VALUE initialize_copy(VALUE self, VALUE obj)
36
37
  {
37
38
  CHECK;
38
- *THIS = to<Reflex::KeyEvent&>(obj);
39
+ *THIS = to<Reflex::KeyEvent&>(obj).dup();
39
40
  return self;
40
41
  }
41
42
 
42
43
  static
43
- VALUE get_type(VALUE self)
44
+ VALUE get_action(VALUE self)
44
45
  {
45
46
  CHECK;
46
- return value(THIS->type);
47
+ return value(THIS->action());
47
48
  }
48
49
 
49
50
  static
50
51
  VALUE get_key(VALUE self)
51
52
  {
52
53
  CHECK;
53
- switch (THIS->code)
54
+ switch (THIS->code())
54
55
  {
55
56
  #define CASE(key) case Reflex::KEY_##key
56
57
  #define SYMBOL1(name) SYMBOL2(_##name, #name)
@@ -247,35 +248,35 @@ static
247
248
  VALUE get_chars(VALUE self)
248
249
  {
249
250
  CHECK;
250
- return value(THIS->chars.c_str());
251
+ return value(THIS->chars());
251
252
  }
252
253
 
253
254
  static
254
255
  VALUE get_code(VALUE self)
255
256
  {
256
257
  CHECK;
257
- return value(THIS->code);
258
+ return value(THIS->code());
258
259
  }
259
260
 
260
261
  static
261
262
  VALUE get_modifiers(VALUE self)
262
263
  {
263
264
  CHECK;
264
- return value(THIS->modifiers);
265
+ return value(THIS->modifiers());
265
266
  }
266
267
 
267
268
  static
268
269
  VALUE get_repeat(VALUE self)
269
270
  {
270
271
  CHECK;
271
- return value(THIS->repeat);
272
+ return value(THIS->repeat());
272
273
  }
273
274
 
274
275
  static
275
276
  VALUE is_captured(VALUE self)
276
277
  {
277
278
  CHECK;
278
- return value(THIS->captured);
279
+ return value(THIS->is_captured());
279
280
  }
280
281
 
281
282
 
@@ -290,16 +291,16 @@ Init_key_event ()
290
291
  rb_define_alloc_func(cKeyEvent, alloc);
291
292
  rb_define_private_method(cKeyEvent, "initialize", RUBY_METHOD_FUNC(initialize), 5);
292
293
  rb_define_private_method(cKeyEvent, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1);
293
- rb_define_method(cKeyEvent, "type", RUBY_METHOD_FUNC(get_type), 0);
294
+ rb_define_method(cKeyEvent, "action", RUBY_METHOD_FUNC(get_action), 0);
294
295
  rb_define_method(cKeyEvent, "key", RUBY_METHOD_FUNC(get_key), 0);
295
296
  rb_define_method(cKeyEvent, "chars", RUBY_METHOD_FUNC(get_chars), 0);
296
297
  rb_define_method(cKeyEvent, "code", RUBY_METHOD_FUNC(get_code), 0);
297
298
  rb_define_method(cKeyEvent, "modifiers", RUBY_METHOD_FUNC(get_modifiers), 0);
298
299
  rb_define_method(cKeyEvent, "repeat", RUBY_METHOD_FUNC(get_repeat), 0);
299
300
  cKeyEvent.define_method("captured?", is_captured);
300
- cKeyEvent.define_const("TYPE_NONE", Reflex::KeyEvent::NONE);
301
- cKeyEvent.define_const("TYPE_DOWN", Reflex::KeyEvent::DOWN);
302
- cKeyEvent.define_const("TYPE_UP", Reflex::KeyEvent::UP);
301
+ cKeyEvent.define_const("ACTION_NONE", Reflex::KeyEvent::ACTION_NONE);
302
+ cKeyEvent.define_const("DOWN", Reflex::KeyEvent::DOWN);
303
+ cKeyEvent.define_const("UP", Reflex::KeyEvent::UP);
303
304
  }
304
305
 
305
306
 
@@ -41,7 +41,7 @@ static
41
41
  VALUE initialize_copy(VALUE self, VALUE obj)
42
42
  {
43
43
  CHECK;
44
- *THIS = to<Reflex::PointerEvent&>(obj);
44
+ *THIS = to<Reflex::PointerEvent&>(obj).dup();
45
45
  return self;
46
46
  }
47
47
 
@@ -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
 
@@ -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
  }