reflexion 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (223) hide show
  1. checksums.yaml +4 -4
  2. data/.doc/ext/reflex/application.cpp +5 -5
  3. data/.doc/ext/reflex/body.cpp +167 -0
  4. data/.doc/ext/reflex/capture_event.cpp +4 -4
  5. data/.doc/ext/reflex/draw_event.cpp +4 -4
  6. data/.doc/ext/reflex/event.cpp +4 -4
  7. data/.doc/ext/reflex/fixture.cpp +101 -0
  8. data/.doc/ext/reflex/focus_event.cpp +4 -4
  9. data/.doc/ext/reflex/frame_event.cpp +4 -4
  10. data/.doc/ext/reflex/image_view.cpp +22 -5
  11. data/.doc/ext/reflex/key_event.cpp +4 -4
  12. data/.doc/ext/reflex/native.cpp +6 -0
  13. data/.doc/ext/reflex/pointer_event.cpp +4 -4
  14. data/.doc/ext/reflex/reflex.cpp +2 -3
  15. data/.doc/ext/reflex/scroll_event.cpp +4 -4
  16. data/.doc/ext/reflex/selector.cpp +4 -4
  17. data/.doc/ext/reflex/style.cpp +4 -4
  18. data/.doc/ext/reflex/style_length.cpp +4 -4
  19. data/.doc/ext/reflex/style_length2.cpp +4 -4
  20. data/.doc/ext/reflex/style_length4.cpp +4 -4
  21. data/.doc/ext/reflex/update_event.cpp +4 -4
  22. data/.doc/ext/reflex/view.cpp +110 -8
  23. data/.doc/ext/reflex/wheel_event.cpp +4 -4
  24. data/.doc/ext/reflex/window.cpp +36 -12
  25. data/README.md +2 -2
  26. data/Rakefile +2 -1
  27. data/VERSION +1 -1
  28. data/ext/reflex/application.cpp +8 -8
  29. data/ext/reflex/body.cpp +181 -0
  30. data/ext/reflex/capture_event.cpp +4 -4
  31. data/ext/reflex/draw_event.cpp +4 -4
  32. data/ext/reflex/event.cpp +4 -4
  33. data/ext/reflex/fixture.cpp +108 -0
  34. data/ext/reflex/focus_event.cpp +4 -4
  35. data/ext/reflex/frame_event.cpp +4 -4
  36. data/ext/reflex/image_view.cpp +24 -5
  37. data/ext/reflex/key_event.cpp +4 -4
  38. data/ext/reflex/native.cpp +6 -0
  39. data/ext/reflex/pointer_event.cpp +4 -4
  40. data/ext/reflex/reflex.cpp +2 -3
  41. data/ext/reflex/scroll_event.cpp +4 -4
  42. data/ext/reflex/selector.cpp +4 -4
  43. data/ext/reflex/style.cpp +4 -4
  44. data/ext/reflex/style_length.cpp +4 -4
  45. data/ext/reflex/style_length2.cpp +4 -4
  46. data/ext/reflex/style_length4.cpp +4 -4
  47. data/ext/reflex/update_event.cpp +4 -4
  48. data/ext/reflex/view.cpp +126 -12
  49. data/ext/reflex/wheel_event.cpp +4 -4
  50. data/ext/reflex/window.cpp +39 -12
  51. data/include/reflex/bitmap.h +20 -0
  52. data/include/reflex/body.h +82 -0
  53. data/include/reflex/bounds.h +20 -0
  54. data/include/reflex/color.h +20 -0
  55. data/include/reflex/color_space.h +20 -0
  56. data/include/reflex/defs.h +5 -1
  57. data/include/reflex/event.h +16 -25
  58. data/include/reflex/fixture.h +116 -0
  59. data/include/reflex/font.h +20 -0
  60. data/include/reflex/image.h +20 -0
  61. data/include/reflex/image_view.h +1 -1
  62. data/include/reflex/matrix.h +20 -0
  63. data/include/reflex/painter.h +20 -0
  64. data/include/reflex/point.h +24 -0
  65. data/include/reflex/ruby/application.h +6 -0
  66. data/include/reflex/ruby/body.h +41 -0
  67. data/include/reflex/ruby/event.h +68 -0
  68. data/include/reflex/ruby/fixture.h +41 -0
  69. data/include/reflex/ruby/image_view.h +14 -0
  70. data/include/reflex/ruby/selector.h +14 -0
  71. data/include/reflex/ruby/style.h +14 -0
  72. data/include/reflex/ruby/style_length.h +26 -0
  73. data/include/reflex/ruby/view.h +43 -39
  74. data/include/reflex/ruby/window.h +27 -21
  75. data/include/reflex/ruby.h +2 -0
  76. data/include/reflex/shader.h +20 -0
  77. data/include/reflex/style.h +2 -3
  78. data/include/reflex/texture.h +20 -0
  79. data/include/reflex/view.h +45 -24
  80. data/include/reflex/window.h +11 -14
  81. data/include/reflex.h +3 -0
  82. data/lib/reflex/application.rb +6 -2
  83. data/lib/reflex/body.rb +17 -0
  84. data/lib/reflex/fixture.rb +17 -0
  85. data/lib/reflex/view.rb +16 -1
  86. data/lib/reflex/window.rb +13 -1
  87. data/lib/reflex.rb +2 -0
  88. data/reflex.gemspec +1 -1
  89. data/samples/bats.rb +4 -3
  90. data/samples/checker.rb +4 -3
  91. data/samples/fans.rb +4 -3
  92. data/samples/fps.rb +5 -3
  93. data/samples/grid.rb +5 -4
  94. data/samples/hello.rb +1 -1
  95. data/samples/image.rb +3 -2
  96. data/samples/ios/hello/hello/main.cpp +12 -3
  97. data/samples/ios/hello/hello.xcodeproj/project.pbxproj +376 -123
  98. data/samples/key.rb +5 -4
  99. data/samples/layout.rb +3 -2
  100. data/samples/model.rb +3 -2
  101. data/samples/osx/hello/hello/main.cpp +12 -3
  102. data/samples/osx/hello/hello.xcodeproj/project.pbxproj +375 -120
  103. data/samples/physics.rb +37 -0
  104. data/samples/repl.rb +3 -2
  105. data/samples/shader.rb +4 -4
  106. data/samples/shapes.rb +4 -4
  107. data/samples/text.rb +6 -4
  108. data/samples/tree.rb +5 -4
  109. data/samples/views.rb +3 -2
  110. data/samples/visuals.rb +1 -2
  111. data/src/body.cpp +244 -0
  112. data/src/event.cpp +18 -18
  113. data/src/fixture.cpp +108 -0
  114. data/src/image_view.cpp +1 -1
  115. data/src/ios/native_window.h +2 -0
  116. data/src/ios/native_window.mm +18 -1
  117. data/src/ios/opengl_view.mm +8 -0
  118. data/src/ios/window.mm +24 -3
  119. data/src/ios/window_data.h +3 -3
  120. data/src/osx/native_window.mm +17 -1
  121. data/src/osx/window.mm +24 -3
  122. data/src/osx/window_data.h +3 -3
  123. data/src/physics/Box2D/Box2D.h +68 -0
  124. data/src/physics/Box2D/Collision/Shapes/b2ChainShape.cpp +193 -0
  125. data/src/physics/Box2D/Collision/Shapes/b2ChainShape.h +105 -0
  126. data/src/physics/Box2D/Collision/Shapes/b2CircleShape.cpp +99 -0
  127. data/src/physics/Box2D/Collision/Shapes/b2CircleShape.h +91 -0
  128. data/src/physics/Box2D/Collision/Shapes/b2EdgeShape.cpp +138 -0
  129. data/src/physics/Box2D/Collision/Shapes/b2EdgeShape.h +74 -0
  130. data/src/physics/Box2D/Collision/Shapes/b2PolygonShape.cpp +467 -0
  131. data/src/physics/Box2D/Collision/Shapes/b2PolygonShape.h +101 -0
  132. data/src/physics/Box2D/Collision/Shapes/b2Shape.h +101 -0
  133. data/src/physics/Box2D/Collision/b2BroadPhase.cpp +119 -0
  134. data/src/physics/Box2D/Collision/b2BroadPhase.h +257 -0
  135. data/src/physics/Box2D/Collision/b2CollideCircle.cpp +154 -0
  136. data/src/physics/Box2D/Collision/b2CollideEdge.cpp +698 -0
  137. data/src/physics/Box2D/Collision/b2CollidePolygon.cpp +239 -0
  138. data/src/physics/Box2D/Collision/b2Collision.cpp +252 -0
  139. data/src/physics/Box2D/Collision/b2Collision.h +277 -0
  140. data/src/physics/Box2D/Collision/b2Distance.cpp +603 -0
  141. data/src/physics/Box2D/Collision/b2Distance.h +141 -0
  142. data/src/physics/Box2D/Collision/b2DynamicTree.cpp +778 -0
  143. data/src/physics/Box2D/Collision/b2DynamicTree.h +289 -0
  144. data/src/physics/Box2D/Collision/b2TimeOfImpact.cpp +486 -0
  145. data/src/physics/Box2D/Collision/b2TimeOfImpact.h +58 -0
  146. data/src/physics/Box2D/Common/b2BlockAllocator.cpp +215 -0
  147. data/src/physics/Box2D/Common/b2BlockAllocator.h +62 -0
  148. data/src/physics/Box2D/Common/b2Draw.cpp +44 -0
  149. data/src/physics/Box2D/Common/b2Draw.h +86 -0
  150. data/src/physics/Box2D/Common/b2GrowableStack.h +85 -0
  151. data/src/physics/Box2D/Common/b2Math.cpp +94 -0
  152. data/src/physics/Box2D/Common/b2Math.h +720 -0
  153. data/src/physics/Box2D/Common/b2Settings.cpp +44 -0
  154. data/src/physics/Box2D/Common/b2Settings.h +151 -0
  155. data/src/physics/Box2D/Common/b2StackAllocator.cpp +83 -0
  156. data/src/physics/Box2D/Common/b2StackAllocator.h +60 -0
  157. data/src/physics/Box2D/Common/b2Timer.cpp +101 -0
  158. data/src/physics/Box2D/Common/b2Timer.h +50 -0
  159. data/src/physics/Box2D/Dynamics/Contacts/b2ChainAndCircleContact.cpp +53 -0
  160. data/src/physics/Box2D/Dynamics/Contacts/b2ChainAndCircleContact.h +39 -0
  161. data/src/physics/Box2D/Dynamics/Contacts/b2ChainAndPolygonContact.cpp +53 -0
  162. data/src/physics/Box2D/Dynamics/Contacts/b2ChainAndPolygonContact.h +39 -0
  163. data/src/physics/Box2D/Dynamics/Contacts/b2CircleContact.cpp +52 -0
  164. data/src/physics/Box2D/Dynamics/Contacts/b2CircleContact.h +39 -0
  165. data/src/physics/Box2D/Dynamics/Contacts/b2Contact.cpp +247 -0
  166. data/src/physics/Box2D/Dynamics/Contacts/b2Contact.h +349 -0
  167. data/src/physics/Box2D/Dynamics/Contacts/b2ContactSolver.cpp +838 -0
  168. data/src/physics/Box2D/Dynamics/Contacts/b2ContactSolver.h +95 -0
  169. data/src/physics/Box2D/Dynamics/Contacts/b2EdgeAndCircleContact.cpp +49 -0
  170. data/src/physics/Box2D/Dynamics/Contacts/b2EdgeAndCircleContact.h +39 -0
  171. data/src/physics/Box2D/Dynamics/Contacts/b2EdgeAndPolygonContact.cpp +49 -0
  172. data/src/physics/Box2D/Dynamics/Contacts/b2EdgeAndPolygonContact.h +39 -0
  173. data/src/physics/Box2D/Dynamics/Contacts/b2PolygonAndCircleContact.cpp +49 -0
  174. data/src/physics/Box2D/Dynamics/Contacts/b2PolygonAndCircleContact.h +38 -0
  175. data/src/physics/Box2D/Dynamics/Contacts/b2PolygonContact.cpp +52 -0
  176. data/src/physics/Box2D/Dynamics/Contacts/b2PolygonContact.h +39 -0
  177. data/src/physics/Box2D/Dynamics/Joints/b2DistanceJoint.cpp +260 -0
  178. data/src/physics/Box2D/Dynamics/Joints/b2DistanceJoint.h +169 -0
  179. data/src/physics/Box2D/Dynamics/Joints/b2FrictionJoint.cpp +251 -0
  180. data/src/physics/Box2D/Dynamics/Joints/b2FrictionJoint.h +119 -0
  181. data/src/physics/Box2D/Dynamics/Joints/b2GearJoint.cpp +419 -0
  182. data/src/physics/Box2D/Dynamics/Joints/b2GearJoint.h +125 -0
  183. data/src/physics/Box2D/Dynamics/Joints/b2Joint.cpp +211 -0
  184. data/src/physics/Box2D/Dynamics/Joints/b2Joint.h +226 -0
  185. data/src/physics/Box2D/Dynamics/Joints/b2MotorJoint.cpp +304 -0
  186. data/src/physics/Box2D/Dynamics/Joints/b2MotorJoint.h +133 -0
  187. data/src/physics/Box2D/Dynamics/Joints/b2MouseJoint.cpp +222 -0
  188. data/src/physics/Box2D/Dynamics/Joints/b2MouseJoint.h +129 -0
  189. data/src/physics/Box2D/Dynamics/Joints/b2PrismaticJoint.cpp +629 -0
  190. data/src/physics/Box2D/Dynamics/Joints/b2PrismaticJoint.h +196 -0
  191. data/src/physics/Box2D/Dynamics/Joints/b2PulleyJoint.cpp +348 -0
  192. data/src/physics/Box2D/Dynamics/Joints/b2PulleyJoint.h +152 -0
  193. data/src/physics/Box2D/Dynamics/Joints/b2RevoluteJoint.cpp +502 -0
  194. data/src/physics/Box2D/Dynamics/Joints/b2RevoluteJoint.h +204 -0
  195. data/src/physics/Box2D/Dynamics/Joints/b2RopeJoint.cpp +241 -0
  196. data/src/physics/Box2D/Dynamics/Joints/b2RopeJoint.h +114 -0
  197. data/src/physics/Box2D/Dynamics/Joints/b2WeldJoint.cpp +344 -0
  198. data/src/physics/Box2D/Dynamics/Joints/b2WeldJoint.h +126 -0
  199. data/src/physics/Box2D/Dynamics/Joints/b2WheelJoint.cpp +419 -0
  200. data/src/physics/Box2D/Dynamics/Joints/b2WheelJoint.h +210 -0
  201. data/src/physics/Box2D/Dynamics/b2Body.cpp +549 -0
  202. data/src/physics/Box2D/Dynamics/b2Body.h +860 -0
  203. data/src/physics/Box2D/Dynamics/b2ContactManager.cpp +296 -0
  204. data/src/physics/Box2D/Dynamics/b2ContactManager.h +52 -0
  205. data/src/physics/Box2D/Dynamics/b2Fixture.cpp +303 -0
  206. data/src/physics/Box2D/Dynamics/b2Fixture.h +345 -0
  207. data/src/physics/Box2D/Dynamics/b2Island.cpp +539 -0
  208. data/src/physics/Box2D/Dynamics/b2Island.h +93 -0
  209. data/src/physics/Box2D/Dynamics/b2TimeStep.h +70 -0
  210. data/src/physics/Box2D/Dynamics/b2World.cpp +1339 -0
  211. data/src/physics/Box2D/Dynamics/b2World.h +354 -0
  212. data/src/physics/Box2D/Dynamics/b2WorldCallbacks.cpp +36 -0
  213. data/src/physics/Box2D/Dynamics/b2WorldCallbacks.h +155 -0
  214. data/src/physics/Box2D/Rope/b2Rope.cpp +259 -0
  215. data/src/physics/Box2D/Rope/b2Rope.h +115 -0
  216. data/src/style.cpp +2 -2
  217. data/src/view.cpp +217 -17
  218. data/src/window.cpp +25 -15
  219. data/src/world.cpp +206 -0
  220. data/src/world.h +96 -0
  221. data/task/box2d.rake +25 -0
  222. data/test/test_view.rb +5 -5
  223. metadata +125 -3
data/ext/reflex/view.cpp CHANGED
@@ -8,6 +8,7 @@
8
8
  #include "reflex/ruby/window.h"
9
9
  #include "reflex/ruby/selector.h"
10
10
  #include "reflex/ruby/style.h"
11
+ #include "reflex/ruby/body.h"
11
12
 
12
13
 
13
14
  using namespace Rucy;
@@ -15,13 +16,11 @@ using namespace Rucy;
15
16
  using Reflex::coord;
16
17
 
17
18
 
18
- static Class cView;
19
-
20
- RUCY_DEFINE_WRAPPER_VALUE_FROM_TO(Reflex::View, cView)
19
+ RUCY_DEFINE_WRAPPER_VALUE_FROM_TO(Reflex::View)
21
20
 
22
21
  #define THIS to<Reflex::View*>(self)
23
22
 
24
- #define CHECK RUCY_CHECK_OBJECT(Reflex::View, cView, self)
23
+ #define CHECK RUCY_CHECK_OBJECT(Reflex::View, self)
25
24
 
26
25
  #define CALL(fun) RUCY_WRAPPER_CALL(Reflex::View, THIS, fun)
27
26
 
@@ -47,7 +46,7 @@ static
47
46
  RUCY_DEF0(show)
48
47
  {
49
48
  CHECK;
50
- CALL(show());
49
+ THIS->show();
51
50
  return self;
52
51
  }
53
52
  RUCY_END
@@ -56,7 +55,7 @@ static
56
55
  RUCY_DEF0(hide)
57
56
  {
58
57
  CHECK;
59
- CALL(hide());
58
+ THIS->hide();
60
59
  return self;
61
60
  }
62
61
  RUCY_END
@@ -228,6 +227,22 @@ RUCY_DEF0(content_size)
228
227
  }
229
228
  RUCY_END
230
229
 
230
+ static
231
+ RUCY_DEF0(make_body)
232
+ {
233
+ CHECK;
234
+ CALL(make_body());
235
+ }
236
+ RUCY_END
237
+
238
+ static
239
+ RUCY_DEF0(clear_body)
240
+ {
241
+ CHECK;
242
+ THIS->clear_body();
243
+ }
244
+ RUCY_END
245
+
231
246
  static
232
247
  RUCY_DEF1(set_name, name)
233
248
  {
@@ -386,6 +401,75 @@ RUCY_DEF0(window)
386
401
  }
387
402
  RUCY_END
388
403
 
404
+ static
405
+ RUCY_DEF0(body)
406
+ {
407
+ CHECK;
408
+ return value(THIS->body());
409
+ }
410
+ RUCY_END
411
+
412
+ static
413
+ RUCY_DEF1(set_density, value)
414
+ {
415
+ CHECK;
416
+ THIS->set_density(value.as_f(true));
417
+ return value;
418
+ }
419
+ RUCY_END
420
+
421
+ static
422
+ RUCY_DEF1(set_friction, value)
423
+ {
424
+ CHECK;
425
+ THIS->set_friction(value.as_f(true));
426
+ return value;
427
+ }
428
+ RUCY_END
429
+
430
+ static
431
+ RUCY_DEF1(set_restitution, value)
432
+ {
433
+ CHECK;
434
+ THIS->set_restitution(value.as_f(true));
435
+ return value;
436
+ }
437
+ RUCY_END
438
+
439
+ static
440
+ RUCY_DEF2(set_gravity, x, y)
441
+ {
442
+ CHECK;
443
+ THIS->set_gravity(x.as_f(true), y.as_f(true));
444
+ return self;
445
+ }
446
+ RUCY_END
447
+
448
+ static
449
+ RUCY_DEF0(get_gravity)
450
+ {
451
+ CHECK;
452
+ return value(THIS->gravity());
453
+ }
454
+ RUCY_END
455
+
456
+ static
457
+ RUCY_DEF1(set_debug, state)
458
+ {
459
+ CHECK;
460
+ THIS->set_debug(state);
461
+ return state;
462
+ }
463
+ RUCY_END
464
+
465
+ static
466
+ RUCY_DEF0(is_debug)
467
+ {
468
+ CHECK;
469
+ return value(THIS->is_debug());
470
+ }
471
+ RUCY_END
472
+
389
473
  static
390
474
  RUCY_DEF1(on_attach, event)
391
475
  {
@@ -402,6 +486,22 @@ RUCY_DEF1(on_detach, event)
402
486
  }
403
487
  RUCY_END
404
488
 
489
+ static
490
+ RUCY_DEF1(on_show, event)
491
+ {
492
+ CHECK;
493
+ CALL(on_show(to<Reflex::Event*>(event)));
494
+ }
495
+ RUCY_END
496
+
497
+ static
498
+ RUCY_DEF1(on_hide, event)
499
+ {
500
+ CHECK;
501
+ CALL(on_hide(to<Reflex::Event*>(event)));
502
+ }
503
+ RUCY_END
504
+
405
505
  static
406
506
  RUCY_DEF1(on_update, event)
407
507
  {
@@ -531,9 +631,11 @@ RUCY_DEF1(on_capture, event)
531
631
  RUCY_END
532
632
 
533
633
  static
534
- RUCY_DEF_clear_override_flags(cof, Reflex::View, cView);
634
+ RUCY_DEF_clear_override_flags(cof, Reflex::View);
535
635
 
536
636
 
637
+ static Class cView;
638
+
537
639
  void
538
640
  Init_view ()
539
641
  {
@@ -559,13 +661,15 @@ Init_view ()
559
661
  cView.define_method("focus?", has_focus);
560
662
  cView.define_method("resize_to_fit", resize_to_fit);
561
663
  cView.define_method("content_size", content_size);
664
+ cView.define_method("make_body", make_body);
665
+ cView.define_method("clear_body", clear_body);
562
666
  cView.define_method("name=", set_name);
563
667
  cView.define_method("name", get_name);
564
668
  cView.define_method("add_tag", add_tag);
565
669
  cView.define_method("remove_tag", remove_tag);
566
670
  cView.define_method("each_tag", each_tag);
567
671
  cView.define_method("selector=", set_selector);
568
- cView.define_method("selector", get_selector);
672
+ cView.define_method("selector", get_selector);
569
673
  cView.define_private_method("set_frame", set_frame);
570
674
  cView.define_private_method("get_frame", get_frame);
571
675
  cView.define_method("scroll_to", scroll_to);
@@ -575,15 +679,25 @@ Init_view ()
575
679
  cView.define_method("get_capture", get_capture);
576
680
  cView.define_method("parent", parent);
577
681
  cView.define_method("window", window);
578
- cView.define_method("on_attach", on_attach);
579
- cView.define_method("on_detach", on_detach);
682
+ cView.define_method("body", body);
683
+ cView.define_method("density=", set_density);
684
+ cView.define_method("friction=", set_friction);
685
+ cView.define_method("restitution=", set_restitution);
686
+ cView.define_method("set_gravity", set_gravity);
687
+ cView.define_method("gravity", get_gravity);
688
+ cView.define_method("debug=", set_debug);
689
+ cView.define_method("debug?", is_debug);
690
+ cView.define_method("on_attach!", on_attach);
691
+ cView.define_method("on_detach", on_detach);
692
+ cView.define_method("on_show", on_show);
693
+ cView.define_method("on_hide", on_hide);
580
694
  cView.define_method("on_update", on_update);
581
695
  cView.define_method("on_draw", on_draw);
582
696
  cView.define_method("on_move", on_move);
583
697
  cView.define_method("on_resize", on_resize);
584
698
  cView.define_method("on_scroll", on_scroll);
585
- cView.define_method("on_focus", on_focus);
586
- cView.define_method("on_blur", on_blur);
699
+ cView.define_method("on_focus", on_focus);
700
+ cView.define_method("on_blur", on_blur);
587
701
  cView.define_method("on_key", on_key);
588
702
  cView.define_method("on_key_down", on_key_down);
589
703
  cView.define_method("on_key_up", on_key_up);
@@ -11,13 +11,11 @@ using namespace Rucy;
11
11
  using Reflex::coord;
12
12
 
13
13
 
14
- static Class cWheelEvent;
15
-
16
- RUCY_DEFINE_VALUE_FROM_TO(Reflex::WheelEvent, cWheelEvent)
14
+ RUCY_DEFINE_VALUE_FROM_TO(Reflex::WheelEvent)
17
15
 
18
16
  #define THIS to<Reflex::WheelEvent*>(self)
19
17
 
20
- #define CHECK RUCY_CHECK_OBJ(Reflex::WheelEvent, cWheelEvent, self)
18
+ #define CHECK RUCY_CHECK_OBJ(Reflex::WheelEvent, self)
21
19
 
22
20
 
23
21
  static
@@ -123,6 +121,8 @@ RUCY_DEF0(position)
123
121
  RUCY_END
124
122
 
125
123
 
124
+ static Class cWheelEvent;
125
+
126
126
  void
127
127
  Init_wheel_event ()
128
128
  {
@@ -12,13 +12,11 @@ using namespace Rucy;
12
12
  using Reflex::coord;
13
13
 
14
14
 
15
- static Class cWindow;
16
-
17
- RUCY_DEFINE_WRAPPER_VALUE_FROM_TO(Reflex::Window, cWindow)
15
+ RUCY_DEFINE_WRAPPER_VALUE_FROM_TO(Reflex::Window)
18
16
 
19
17
  #define THIS to<Reflex::Window*>(self)
20
18
 
21
- #define CHECK RUCY_CHECK_OBJECT(Reflex::Window, cWindow, self)
19
+ #define CHECK RUCY_CHECK_OBJECT(Reflex::Window, self)
22
20
 
23
21
  #define CALL(fun) RUCY_WRAPPER_CALL(Reflex::Window, THIS, fun)
24
22
 
@@ -31,28 +29,28 @@ RUCY_DEF_ALLOC(alloc, klass)
31
29
  RUCY_END
32
30
 
33
31
  static
34
- RUCY_DEF0(close)
32
+ RUCY_DEF0(show)
35
33
  {
36
34
  CHECK;
37
- CALL(close());
35
+ THIS->show();
38
36
  return self;
39
37
  }
40
38
  RUCY_END
41
39
 
42
40
  static
43
- RUCY_DEF0(show)
41
+ RUCY_DEF0(hide)
44
42
  {
45
43
  CHECK;
46
- CALL(show());
44
+ THIS->hide();
47
45
  return self;
48
46
  }
49
47
  RUCY_END
50
48
 
51
49
  static
52
- RUCY_DEF0(hide)
50
+ RUCY_DEF0(close)
53
51
  {
54
52
  CHECK;
55
- CALL(hide());
53
+ THIS->close();
56
54
  return self;
57
55
  }
58
56
  RUCY_END
@@ -131,6 +129,30 @@ RUCY_DEF0(painter)
131
129
  }
132
130
  RUCY_END
133
131
 
132
+ static
133
+ RUCY_DEF1(on_show, event)
134
+ {
135
+ CHECK;
136
+ CALL(on_show(to<Reflex::Event*>(event)));
137
+ }
138
+ RUCY_END
139
+
140
+ static
141
+ RUCY_DEF1(on_hide, event)
142
+ {
143
+ CHECK;
144
+ CALL(on_hide(to<Reflex::Event*>(event)));
145
+ }
146
+ RUCY_END
147
+
148
+ static
149
+ RUCY_DEF1(on_close, event)
150
+ {
151
+ CHECK;
152
+ CALL(on_close(to<Reflex::Event*>(event)));
153
+ }
154
+ RUCY_END
155
+
134
156
  static
135
157
  RUCY_DEF1(on_update, event)
136
158
  {
@@ -228,9 +250,11 @@ RUCY_DEF1(on_wheel, event)
228
250
  RUCY_END
229
251
 
230
252
  static
231
- RUCY_DEF_clear_override_flags(cof, Reflex::Window, cWindow);
253
+ RUCY_DEF_clear_override_flags(cof, Reflex::Window);
232
254
 
233
255
 
256
+ static Class cWindow;
257
+
234
258
  void
235
259
  Init_window ()
236
260
  {
@@ -238,9 +262,9 @@ Init_window ()
238
262
 
239
263
  cWindow = mReflex.define_class("Window");
240
264
  cWindow.define_alloc_func(alloc);
241
- cWindow.define_method("close", close);
242
265
  cWindow.define_method("show", show);
243
266
  cWindow.define_method("hide", hide);
267
+ cWindow.define_method("close", close);
244
268
  cWindow.define_method("redraw", redraw);
245
269
  cWindow.define_method("title=", set_title);
246
270
  cWindow.define_method("title", get_title);
@@ -250,6 +274,9 @@ Init_window ()
250
274
  cWindow.define_method("root", root);
251
275
  cWindow.define_method("focus", focus);
252
276
  cWindow.define_method("painter", painter);
277
+ cWindow.define_method("on_show!", on_show);
278
+ cWindow.define_method("on_hide", on_hide);
279
+ cWindow.define_method("on_close", on_close);
253
280
  cWindow.define_method("on_update", on_update);
254
281
  cWindow.define_method("on_draw", on_draw);
255
282
  cWindow.define_method("on_move", on_move);
@@ -0,0 +1,20 @@
1
+ // -*- c++ -*-
2
+ #pragma once
3
+ #ifndef __REFLEX_BITMAP_H__
4
+ #define __REFLEX_BITMAP_H__
5
+
6
+
7
+ #include <rays/bitmap.h>
8
+
9
+
10
+ namespace Reflex
11
+ {
12
+
13
+
14
+ using Rays::Bitmap;
15
+
16
+
17
+ }// Reflex
18
+
19
+
20
+ #endif//EOH
@@ -0,0 +1,82 @@
1
+ // -*- c++ -*-
2
+ #pragma once
3
+ #ifndef __REFLEX_BODY_H__
4
+ #define __REFLEX_BODY_H__
5
+
6
+
7
+ #include <reflex/point.h>
8
+ #include <reflex/fixture.h>
9
+
10
+
11
+ namespace Reflex
12
+ {
13
+
14
+
15
+ class Body
16
+ {
17
+
18
+ public:
19
+
20
+ typedef void* Handle;
21
+
22
+ typedef FixtureIterator< Fixture> iterator;
23
+
24
+ typedef FixtureIterator<const Fixture> const_iterator;
25
+
26
+ Fixture add_box (float width, float height);
27
+
28
+ Fixture add_circle (float size);
29
+
30
+ Fixture add_edge (const Point& begin, const Point& end);
31
+
32
+ Fixture add_edge (const Point* points, size_t size, bool loop = false);
33
+
34
+ Fixture add_polygon (const Point* points, size_t size);
35
+
36
+ void clear_fixtures ();
37
+
38
+ Point position () const;
39
+
40
+ float angle () const;
41
+
42
+ void set_static (bool state);
43
+
44
+ bool is_static () const;
45
+
46
+ void set_dynamic (bool state);
47
+
48
+ bool is_dynamic () const;
49
+
50
+ void set_density (float density);
51
+
52
+ void set_friction (float friction);
53
+
54
+ void set_restitution (float restitution);
55
+
56
+ iterator begin ();
57
+
58
+ const_iterator begin () const;
59
+
60
+ iterator end ();
61
+
62
+ const_iterator end () const;
63
+
64
+ protected:
65
+
66
+ Body (Handle h, float scale);
67
+
68
+ private:
69
+
70
+ friend class World;
71
+
72
+ Handle handle;
73
+
74
+ float scale;
75
+
76
+ };// Body
77
+
78
+
79
+ }// Reflex
80
+
81
+
82
+ #endif//EOH
@@ -0,0 +1,20 @@
1
+ // -*- c++ -*-
2
+ #pragma once
3
+ #ifndef __REFLEX_BOUNDS_H__
4
+ #define __REFLEX_BOUNDS_H__
5
+
6
+
7
+ #include <rays/bounds.h>
8
+
9
+
10
+ namespace Reflex
11
+ {
12
+
13
+
14
+ using Rays::Bounds;
15
+
16
+
17
+ }// Reflex
18
+
19
+
20
+ #endif//EOH
@@ -0,0 +1,20 @@
1
+ // -*- c++ -*-
2
+ #pragma once
3
+ #ifndef __REFLEX_COLOR_H__
4
+ #define __REFLEX_COLOR_H__
5
+
6
+
7
+ #include <rays/color.h>
8
+
9
+
10
+ namespace Reflex
11
+ {
12
+
13
+
14
+ using Rays::Color;
15
+
16
+
17
+ }// Reflex
18
+
19
+
20
+ #endif//EOH
@@ -0,0 +1,20 @@
1
+ // -*- c++ -*-
2
+ #pragma once
3
+ #ifndef __REFLEX_COLOR_SPACE_H__
4
+ #define __REFLEX_COLOR_SPACE_H__
5
+
6
+
7
+ #include <rays/color_space.h>
8
+
9
+
10
+ namespace Reflex
11
+ {
12
+
13
+
14
+ using Rays::ColorSpace;
15
+
16
+
17
+ }// Reflex
18
+
19
+
20
+ #endif//EOH
@@ -11,7 +11,11 @@ namespace Reflex
11
11
  {
12
12
 
13
13
 
14
- using namespace Rays;
14
+ using namespace Xot::Types;
15
+
16
+ using Rays::String;
17
+
18
+ using Rays::coord;
15
19
 
16
20
 
17
21
  enum KeyCode
@@ -4,17 +4,10 @@
4
4
  #define __REFLEX_EVENT_H__
5
5
 
6
6
 
7
- #include <rays/point.h>
8
- #include <rays/bounds.h>
9
7
  #include <reflex/defs.h>
10
-
11
-
12
- namespace Rays
13
- {
14
-
15
- class Painter;
16
-
17
- }// Rays
8
+ #include <reflex/point.h>
9
+ #include <reflex/bounds.h>
10
+ #include <reflex/painter.h>
18
11
 
19
12
 
20
13
  namespace Reflex
@@ -29,8 +22,6 @@ namespace Reflex
29
22
 
30
23
  public:
31
24
 
32
- struct Coord3 {coord x, y, z;};
33
-
34
25
  Event ();
35
26
 
36
27
  void block ();
@@ -111,13 +102,13 @@ namespace Reflex
111
102
 
112
103
  ScrollEvent (coord x, coord y, coord z, coord dx, coord dy, coord dz);
113
104
 
114
- Rays::Point& scroll ();
105
+ Point& scroll ();
115
106
 
116
- const Rays::Point& scroll () const;
107
+ const Point& scroll () const;
117
108
 
118
- Rays::Point& delta ();
109
+ Point& delta ();
119
110
 
120
- const Rays::Point& delta () const;
111
+ const Point& delta () const;
121
112
 
122
113
  };// ScrollEvent
123
114
 
@@ -194,16 +185,16 @@ namespace Reflex
194
185
  uint modifiers = 0, uint count = 1, bool drag = false);
195
186
 
196
187
  PointerEvent (
197
- Type type, uint pointer_type, const Rays::Point* positions, size_t size,
188
+ Type type, uint pointer_type, const Point* positions, size_t size,
198
189
  uint modifiers = 0, uint count = 1, bool drag = false);
199
190
 
200
- Rays::Point& position (size_t i = 0);
191
+ Point& position (size_t i = 0);
201
192
 
202
- const Rays::Point& position (size_t i = 0) const;
193
+ const Point& position (size_t i = 0) const;
203
194
 
204
- Rays::Point& operator [] (size_t i);
195
+ Point& operator [] (size_t i);
205
196
 
206
- const Rays::Point& operator [] (size_t i) const;
197
+ const Point& operator [] (size_t i) const;
207
198
 
208
199
  };// PointerEvent
209
200
 
@@ -231,13 +222,13 @@ namespace Reflex
231
222
  coord dx, coord dy, coord dz, coord x = 0, coord y = 0, coord z = 0,
232
223
  uint modifiers = 0);
233
224
 
234
- Rays::Point& delta ();
225
+ Point& delta ();
235
226
 
236
- const Rays::Point& delta () const;
227
+ const Point& delta () const;
237
228
 
238
- Rays::Point& position ();
229
+ Point& position ();
239
230
 
240
- const Rays::Point& position () const;
231
+ const Point& position () const;
241
232
 
242
233
  };// WheelEvent
243
234