reflexion 0.1.7 → 0.1.8

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 (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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4ab611843e39083046757ad8be7974cf3f08802b
4
- data.tar.gz: 348a2e5773ec70a2a5215e3bc8783aead028a7d3
3
+ metadata.gz: 79a0d8b46171362cf5f24dff3960d8495a066497
4
+ data.tar.gz: 37d83b584fccb668c2f58fbbde8e73240f29f002
5
5
  SHA512:
6
- metadata.gz: d1a4456dcf74b5d765fcc6819f2fe19a0d1a6bfc39bc610ff1e4d82f73cc23384f6f89fa735eb27c671b1cbc76f208326ecc1fcd63a5f70fe86986cb42ab594b
7
- data.tar.gz: d52e858d9aa75386455b8f262bdc7666c92d3481dd9bd2ea7f3b55b5b3d3f9b8c9054e7cd5cd454ec77cf66aac52a3e452ebf1c415558377175c2ebeb2552b6e
6
+ metadata.gz: ba12b310b4e57c5426aae9c5d90a12bc1220911b1276090da4a0427a504e1ec0ab7e9a9de63ca78e6022112327f183e8ca4f2140bd91151e889202fef90d2d62
7
+ data.tar.gz: 73449bffdbe6fb05e268f7f63aba4dccce08b1c8f1d101019df24a96638a25024a81cf8e8a4b13c1e2e4162652f5adedcf73a4bc83064c93fdadfe82a6fc78b8
@@ -8,13 +8,11 @@
8
8
  using namespace Rucy;
9
9
 
10
10
 
11
- static Class cApplication;
12
-
13
- RUCY_DEFINE_WRAPPER_VALUE_FROM_TO(Reflex::Application, cApplication)
11
+ RUCY_DEFINE_WRAPPER_VALUE_FROM_TO(Reflex::Application)
14
12
 
15
13
  #define THIS to<Reflex::Application*>(self)
16
14
 
17
- #define CHECK RUCY_CHECK_OBJECT(Reflex::Application, cApplication, self)
15
+ #define CHECK RUCY_CHECK_OBJECT(Reflex::Application, self)
18
16
 
19
17
  #define CALL(fun) RUCY_WRAPPER_CALL(Reflex::Application, THIS, fun)
20
18
 
@@ -91,6 +89,8 @@ VALUE instance(VALUE self)
91
89
  }
92
90
 
93
91
 
92
+ static Class cApplication;
93
+
94
94
  void
95
95
  Init_application ()
96
96
  {
@@ -102,7 +102,7 @@ Init_application ()
102
102
  rb_define_method(cApplication, "quit", RUBY_METHOD_FUNC(quit), 0);
103
103
  rb_define_method(cApplication, "name=", RUBY_METHOD_FUNC(set_name), 1);
104
104
  rb_define_method(cApplication, "name", RUBY_METHOD_FUNC(get_name), 0);
105
- rb_define_method(cApplication, "on_start", RUBY_METHOD_FUNC(on_start), 1);
105
+ cApplication.define_method("on_start!", on_start);
106
106
  rb_define_method(cApplication, "on_quit", RUBY_METHOD_FUNC(on_quit), 1);
107
107
  rb_define_method(cApplication, "on_preference", RUBY_METHOD_FUNC(on_preference), 1);
108
108
  rb_define_method(cApplication, "on_about", RUBY_METHOD_FUNC(on_about), 1);
@@ -0,0 +1,167 @@
1
+ #include "reflex/ruby/body.h"
2
+
3
+
4
+ #include <rucy.h>
5
+ #include "rays/ruby/point.h"
6
+ #include "reflex/ruby/fixture.h"
7
+ #include "defs.h"
8
+
9
+
10
+ using namespace Rucy;
11
+
12
+
13
+ RUCY_DEFINE_VALUE_FROM_TO(Reflex::Body)
14
+
15
+ #define THIS to<Reflex::Body*>(self)
16
+
17
+ #define CHECK RUCY_CHECK_OBJ(Reflex::Body, self)
18
+
19
+
20
+ static
21
+ VALUE initialize_copy(VALUE self, VALUE obj)
22
+ {
23
+ CHECK;
24
+ *THIS = to<Reflex::Body&>(obj);
25
+ return self;
26
+ }
27
+
28
+ static
29
+ VALUE add_box(VALUE self, VALUE width, VALUE height)
30
+ {
31
+ CHECK;
32
+ return value(THIS->add_box(width.as_f(true), height.as_f(true)));
33
+ }
34
+
35
+ static
36
+ VALUE add_circle(VALUE self, VALUE size)
37
+ {
38
+ CHECK;
39
+ return value(THIS->add_circle(size.as_f(true)));
40
+ }
41
+
42
+ static
43
+ VALUE clear_fixtures(VALUE self)
44
+ {
45
+ CHECK;
46
+ THIS->clear_fixtures();
47
+ return self;
48
+ }
49
+
50
+ static
51
+ VALUE get_position(VALUE self)
52
+ {
53
+ CHECK;
54
+ return value(THIS->position());
55
+ }
56
+
57
+ static
58
+ VALUE get_angle(VALUE self)
59
+ {
60
+ CHECK;
61
+ return value(THIS->angle());
62
+ }
63
+
64
+ static
65
+ VALUE set_static(VALUE self, VALUE state)
66
+ {
67
+ CHECK;
68
+ THIS->set_static(state);
69
+ return state;
70
+ }
71
+
72
+ static
73
+ VALUE is_static(VALUE self)
74
+ {
75
+ CHECK;
76
+ return value(THIS->is_static());
77
+ }
78
+
79
+ static
80
+ VALUE set_dynamic(VALUE self, VALUE state)
81
+ {
82
+ CHECK;
83
+ THIS->set_dynamic(state);
84
+ return state;
85
+ }
86
+
87
+ static
88
+ VALUE is_dynamic(VALUE self)
89
+ {
90
+ CHECK;
91
+ return value(THIS->is_dynamic());
92
+ }
93
+
94
+ static
95
+ VALUE set_density(VALUE self, VALUE density)
96
+ {
97
+ CHECK;
98
+ THIS->set_density(density.as_f(true));
99
+ return self;
100
+ }
101
+
102
+ static
103
+ VALUE set_friction(VALUE self, VALUE friction)
104
+ {
105
+ CHECK;
106
+ THIS->set_friction(friction.as_f(true));
107
+ return self;
108
+ }
109
+
110
+ static
111
+ VALUE set_restitution(VALUE self, VALUE restitution)
112
+ {
113
+ CHECK;
114
+ THIS->set_restitution(restitution.as_f(true));
115
+ return self;
116
+ }
117
+
118
+ static
119
+ VALUE each(VALUE self)
120
+ {
121
+ CHECK;
122
+
123
+ Value ret;
124
+ Reflex::Body::iterator end = THIS->end();
125
+ for (Reflex::Body::iterator it = THIS->begin(); it != end; ++it)
126
+ ret = rb_yield(value(*it));
127
+ return ret;
128
+ }
129
+
130
+
131
+ static Class cBody;
132
+
133
+ void
134
+ Init_body ()
135
+ {
136
+ Module mReflex = rb_define_module("Reflex");
137
+
138
+ cBody = rb_define_class_under(mReflex, "Body", rb_cObject);
139
+ rb_define_private_method(cBody, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1);
140
+ rb_define_method(cBody, "add_box", RUBY_METHOD_FUNC(add_box), 2);
141
+ rb_define_method(cBody, "add_circle", RUBY_METHOD_FUNC(add_circle), 1);
142
+ rb_define_method(cBody, "clear_fixtures", RUBY_METHOD_FUNC(clear_fixtures), 0);
143
+ rb_define_method(cBody, "position", RUBY_METHOD_FUNC(get_position), 0);
144
+ rb_define_method(cBody, "angle", RUBY_METHOD_FUNC(get_angle), 0);
145
+ rb_define_method(cBody, "static=", RUBY_METHOD_FUNC(set_static), 1);
146
+ cBody.define_method("static?", is_static);
147
+ rb_define_method(cBody, "dynamic=", RUBY_METHOD_FUNC(set_dynamic), 1);
148
+ cBody.define_method("dynamic?", is_dynamic);
149
+ rb_define_method(cBody, "density=", RUBY_METHOD_FUNC(set_density), 1);
150
+ rb_define_method(cBody, "friction=", RUBY_METHOD_FUNC(set_friction), 1);
151
+ rb_define_method(cBody, "restitution=", RUBY_METHOD_FUNC(set_restitution), 1);
152
+ rb_define_method(cBody, "each", RUBY_METHOD_FUNC(each), 0);
153
+ }
154
+
155
+
156
+ namespace Reflex
157
+ {
158
+
159
+
160
+ Class
161
+ body_class ()
162
+ {
163
+ return cBody;
164
+ }
165
+
166
+
167
+ }// Reflex
@@ -9,13 +9,11 @@
9
9
  using namespace Rucy;
10
10
 
11
11
 
12
- static Class cCaptureEvent;
13
-
14
- RUCY_DEFINE_VALUE_FROM_TO(Reflex::CaptureEvent, cCaptureEvent)
12
+ RUCY_DEFINE_VALUE_FROM_TO(Reflex::CaptureEvent)
15
13
 
16
14
  #define THIS to<Reflex::CaptureEvent*>(self)
17
15
 
18
- #define CHECK RUCY_CHECK_OBJ(Reflex::CaptureEvent, cCaptureEvent, self)
16
+ #define CHECK RUCY_CHECK_OBJ(Reflex::CaptureEvent, self)
19
17
 
20
18
 
21
19
  static
@@ -59,6 +57,8 @@ VALUE end(VALUE self)
59
57
  }
60
58
 
61
59
 
60
+ static Class cCaptureEvent;
61
+
62
62
  void
63
63
  Init_capture_event ()
64
64
  {
@@ -10,13 +10,11 @@
10
10
  using namespace Rucy;
11
11
 
12
12
 
13
- static Class cDrawEvent;
14
-
15
- RUCY_DEFINE_VALUE_FROM_TO(Reflex::DrawEvent, cDrawEvent)
13
+ RUCY_DEFINE_VALUE_FROM_TO(Reflex::DrawEvent)
16
14
 
17
15
  #define THIS to<Reflex::DrawEvent*>(self)
18
16
 
19
- #define CHECK RUCY_CHECK_OBJ(Reflex::DrawEvent, cDrawEvent, self)
17
+ #define CHECK RUCY_CHECK_OBJ(Reflex::DrawEvent, self)
20
18
 
21
19
 
22
20
  static
@@ -73,6 +71,8 @@ VALUE fps(VALUE self)
73
71
  }
74
72
 
75
73
 
74
+ static Class cDrawEvent;
75
+
76
76
  void
77
77
  Init_draw_event ()
78
78
  {
@@ -8,13 +8,11 @@
8
8
  using namespace Rucy;
9
9
 
10
10
 
11
- static Class cEvent;
12
-
13
- RUCY_DEFINE_VALUE_FROM_TO(Reflex::Event, cEvent)
11
+ RUCY_DEFINE_VALUE_FROM_TO(Reflex::Event)
14
12
 
15
13
  #define THIS to<Reflex::Event*>(self)
16
14
 
17
- #define CHECK RUCY_CHECK_OBJ(Reflex::Event, cEvent, self)
15
+ #define CHECK RUCY_CHECK_OBJ(Reflex::Event, self)
18
16
 
19
17
 
20
18
  static
@@ -46,6 +44,8 @@ VALUE is_blocked(VALUE self)
46
44
  }
47
45
 
48
46
 
47
+ static Class cEvent;
48
+
49
49
  void
50
50
  Init_event ()
51
51
  {
@@ -0,0 +1,101 @@
1
+ #include "reflex/ruby/fixture.h"
2
+
3
+
4
+ #include <rucy.h>
5
+ #include "defs.h"
6
+
7
+
8
+ using namespace Rucy;
9
+
10
+
11
+ RUCY_DEFINE_VALUE_FROM_TO(Reflex::Fixture)
12
+
13
+ #define THIS to<Reflex::Fixture*>(self)
14
+
15
+ #define CHECK RUCY_CHECK_OBJ(Reflex::Fixture, self)
16
+
17
+
18
+ static
19
+ VALUE initialize_copy(VALUE self, VALUE obj)
20
+ {
21
+ CHECK;
22
+ *THIS = to<Reflex::Fixture&>(obj);
23
+ return self;
24
+ }
25
+
26
+ static
27
+ VALUE set_density(VALUE self, VALUE density)
28
+ {
29
+ CHECK;
30
+ THIS->set_density(density.as_f(true));
31
+ return self;
32
+ }
33
+
34
+ static
35
+ VALUE get_density(VALUE self)
36
+ {
37
+ CHECK;
38
+ return value(THIS->density());
39
+ }
40
+
41
+ static
42
+ VALUE set_friction(VALUE self, VALUE friction)
43
+ {
44
+ CHECK;
45
+ THIS->set_friction(friction.as_f(true));
46
+ return self;
47
+ }
48
+
49
+ static
50
+ VALUE get_friction(VALUE self)
51
+ {
52
+ CHECK;
53
+ return value(THIS->friction());
54
+ }
55
+
56
+ static
57
+ VALUE set_restitution(VALUE self, VALUE restitution)
58
+ {
59
+ CHECK;
60
+ THIS->set_restitution(restitution.as_f(true));
61
+ return self;
62
+ }
63
+
64
+ static
65
+ VALUE get_restitution(VALUE self)
66
+ {
67
+ CHECK;
68
+ return value(THIS->restitution());
69
+ }
70
+
71
+
72
+ static Class cFixture;
73
+
74
+ void
75
+ Init_fixture ()
76
+ {
77
+ Module mReflex = rb_define_module("Reflex");
78
+
79
+ cFixture = rb_define_class_under(mReflex, "Fixture", rb_cObject);
80
+ rb_define_private_method(cFixture, "initialize_copy", RUBY_METHOD_FUNC(initialize_copy), 1);
81
+ rb_define_method(cFixture, "density=", RUBY_METHOD_FUNC(set_density), 1);
82
+ rb_define_method(cFixture, "density", RUBY_METHOD_FUNC(get_density), 0);
83
+ rb_define_method(cFixture, "friction=", RUBY_METHOD_FUNC(set_friction), 1);
84
+ rb_define_method(cFixture, "friction", RUBY_METHOD_FUNC(get_friction), 0);
85
+ rb_define_method(cFixture, "restitution=", RUBY_METHOD_FUNC(set_restitution), 1);
86
+ rb_define_method(cFixture, "restitution", RUBY_METHOD_FUNC(get_restitution), 0);
87
+ }
88
+
89
+
90
+ namespace Reflex
91
+ {
92
+
93
+
94
+ Class
95
+ fixture_class ()
96
+ {
97
+ return cFixture;
98
+ }
99
+
100
+
101
+ }// Reflex
@@ -9,13 +9,11 @@
9
9
  using namespace Rucy;
10
10
 
11
11
 
12
- static Class cFocusEvent;
13
-
14
- RUCY_DEFINE_VALUE_FROM_TO(Reflex::FocusEvent, cFocusEvent)
12
+ RUCY_DEFINE_VALUE_FROM_TO(Reflex::FocusEvent)
15
13
 
16
14
  #define THIS to<Reflex::FocusEvent*>(self)
17
15
 
18
- #define CHECK RUCY_CHECK_OBJ(Reflex::FocusEvent, cFocusEvent, self)
16
+ #define CHECK RUCY_CHECK_OBJ(Reflex::FocusEvent, self)
19
17
 
20
18
 
21
19
  static
@@ -66,6 +64,8 @@ VALUE last(VALUE self)
66
64
  }
67
65
 
68
66
 
67
+ static Class cFocusEvent;
68
+
69
69
  void
70
70
  Init_focus_event ()
71
71
  {
@@ -12,13 +12,11 @@ using namespace Rucy;
12
12
  using Reflex::coord;
13
13
 
14
14
 
15
- static Class cFrameEvent;
16
-
17
- RUCY_DEFINE_VALUE_FROM_TO(Reflex::FrameEvent, cFrameEvent)
15
+ RUCY_DEFINE_VALUE_FROM_TO(Reflex::FrameEvent)
18
16
 
19
17
  #define THIS to<Reflex::FrameEvent*>(self)
20
18
 
21
- #define CHECK RUCY_CHECK_OBJ(Reflex::FrameEvent, cFrameEvent, self)
19
+ #define CHECK RUCY_CHECK_OBJ(Reflex::FrameEvent, self)
22
20
 
23
21
 
24
22
  static
@@ -100,6 +98,8 @@ VALUE dsize(VALUE self)
100
98
  }
101
99
 
102
100
 
101
+ static Class cFrameEvent;
102
+
103
103
  void
104
104
  Init_frame_event ()
105
105
  {
@@ -2,6 +2,7 @@
2
2
 
3
3
 
4
4
  #include <rucy.h>
5
+ #include <rays/ruby/point.h>
5
6
  #include "reflex/ruby/view.h"
6
7
 
7
8
 
@@ -10,13 +11,11 @@ using namespace Rucy;
10
11
  using Reflex::coord;
11
12
 
12
13
 
13
- static Class cImageView;
14
-
15
- RUCY_DEFINE_WRAPPER_VALUE_FROM_TO(Reflex::ImageView, cImageView)
14
+ RUCY_DEFINE_WRAPPER_VALUE_FROM_TO(Reflex::ImageView)
16
15
 
17
16
  #define THIS to<Reflex::ImageView*>(self)
18
17
 
19
- #define CHECK RUCY_CHECK_OBJECT(Reflex::ImageView, cImageView, self)
18
+ #define CHECK RUCY_CHECK_OBJECT(Reflex::ImageView, self)
20
19
 
21
20
  #define CALL(fun) RUCY_WRAPPER_CALL(Reflex::ImageView, THIS, fun)
22
21
 
@@ -44,8 +43,24 @@ VALUE set_image(VALUE self, VALUE image)
44
43
  }
45
44
 
46
45
  static
47
- RUCY_DEF_clear_override_flags(cof, Reflex::ImageView, cImageView);
46
+ VALUE content_size(VALUE self)
47
+ {
48
+ CHECK;
49
+ return value(THIS->content_size());
50
+ }
51
+
52
+ static
53
+ VALUE on_draw(VALUE self, VALUE event)
54
+ {
55
+ CHECK;
56
+ CALL(on_draw(to<Reflex::DrawEvent*>(event)));
57
+ }
48
58
 
59
+ static
60
+ RUCY_DEF_clear_override_flags(cof, Reflex::ImageView);
61
+
62
+
63
+ static Class cImageView;
49
64
 
50
65
  void
51
66
  Init_image_view ()
@@ -56,6 +71,8 @@ Init_image_view ()
56
71
  rb_define_alloc_func(cImageView, alloc);
57
72
  rb_define_private_method(cImageView, "set_image", RUBY_METHOD_FUNC(set_image), 1);
58
73
  rb_define_method(cImageView, "image", RUBY_METHOD_FUNC(get_image), 0);
74
+ rb_define_method(cImageView, "content_size", RUBY_METHOD_FUNC(content_size), 0);
75
+ rb_define_method(cImageView, "on_draw", RUBY_METHOD_FUNC(on_draw), 1);
59
76
 
60
77
  }
61
78
 
@@ -8,13 +8,11 @@
8
8
  using namespace Rucy;
9
9
 
10
10
 
11
- static Class cKeyEvent;
12
-
13
- RUCY_DEFINE_VALUE_FROM_TO(Reflex::KeyEvent, cKeyEvent)
11
+ RUCY_DEFINE_VALUE_FROM_TO(Reflex::KeyEvent)
14
12
 
15
13
  #define THIS to<Reflex::KeyEvent*>(self)
16
14
 
17
- #define CHECK RUCY_CHECK_OBJ(Reflex::KeyEvent, cKeyEvent, self)
15
+ #define CHECK RUCY_CHECK_OBJ(Reflex::KeyEvent, self)
18
16
 
19
17
 
20
18
  static
@@ -89,6 +87,8 @@ VALUE capture(VALUE self)
89
87
  }
90
88
 
91
89
 
90
+ static Class cKeyEvent;
91
+
92
92
  void
93
93
  Init_key_event ()
94
94
  {
@@ -28,6 +28,9 @@ void Init_application ();
28
28
  void Init_window ();
29
29
  void Init_view ();
30
30
 
31
+ void Init_body ();
32
+ void Init_fixture ();
33
+
31
34
  void Init_image_view ();
32
35
 
33
36
 
@@ -61,6 +64,9 @@ Init_native ()
61
64
  Init_window();
62
65
  Init_view();
63
66
 
67
+ Init_body();
68
+ Init_fixture();
69
+
64
70
  Init_image_view();
65
71
 
66
72
  RUCY_CATCH
@@ -11,13 +11,11 @@ using namespace Rucy;
11
11
  using Reflex::coord;
12
12
 
13
13
 
14
- static Class cPointerEvent;
15
-
16
- RUCY_DEFINE_VALUE_FROM_TO(Reflex::PointerEvent, cPointerEvent)
14
+ RUCY_DEFINE_VALUE_FROM_TO(Reflex::PointerEvent)
17
15
 
18
16
  #define THIS to<Reflex::PointerEvent*>(self)
19
17
 
20
- #define CHECK RUCY_CHECK_OBJ(Reflex::PointerEvent, cPointerEvent, self)
18
+ #define CHECK RUCY_CHECK_OBJ(Reflex::PointerEvent, self)
21
19
 
22
20
 
23
21
  static
@@ -133,6 +131,8 @@ VALUE array_get(VALUE self, VALUE index)
133
131
  }
134
132
 
135
133
 
134
+ static Class cPointerEvent;
135
+
136
136
  void
137
137
  Init_pointer_event ()
138
138
  {
@@ -6,9 +6,6 @@
6
6
  using namespace Rucy;
7
7
 
8
8
 
9
- static Module mReflex;
10
-
11
-
12
9
  static
13
10
  VALUE init(VALUE self)
14
11
  {
@@ -24,6 +21,8 @@ VALUE fin(VALUE self)
24
21
  }
25
22
 
26
23
 
24
+ static Module mReflex;
25
+
27
26
  void
28
27
  Init_reflex ()
29
28
  {
@@ -11,13 +11,11 @@ using namespace Rucy;
11
11
  using Reflex::coord;
12
12
 
13
13
 
14
- static Class cScrollEvent;
15
-
16
- RUCY_DEFINE_VALUE_FROM_TO(Reflex::ScrollEvent, cScrollEvent)
14
+ RUCY_DEFINE_VALUE_FROM_TO(Reflex::ScrollEvent)
17
15
 
18
16
  #define THIS to<Reflex::ScrollEvent*>(self)
19
17
 
20
- #define CHECK RUCY_CHECK_OBJ(Reflex::ScrollEvent, cScrollEvent, self)
18
+ #define CHECK RUCY_CHECK_OBJ(Reflex::ScrollEvent, self)
21
19
 
22
20
 
23
21
  static
@@ -107,6 +105,8 @@ VALUE delta(VALUE self)
107
105
  }
108
106
 
109
107
 
108
+ static Class cScrollEvent;
109
+
110
110
  void
111
111
  Init_scroll_event ()
112
112
  {
@@ -8,13 +8,11 @@
8
8
  using namespace Rucy;
9
9
 
10
10
 
11
- static Class cSelector;
12
-
13
- RUCY_DEFINE_VALUE_FROM_TO(Reflex::Selector, cSelector)
11
+ RUCY_DEFINE_VALUE_FROM_TO(Reflex::Selector)
14
12
 
15
13
  #define THIS to<Reflex::Selector*>(self)
16
14
 
17
- #define CHECK RUCY_CHECK_OBJ(Reflex::Selector, cSelector, self)
15
+ #define CHECK RUCY_CHECK_OBJ(Reflex::Selector, self)
18
16
 
19
17
 
20
18
  static
@@ -86,6 +84,8 @@ VALUE equal(VALUE self, VALUE selector)
86
84
  }
87
85
 
88
86
 
87
+ static Class cSelector;
88
+
89
89
  void
90
90
  Init_selector ()
91
91
  {
@@ -12,13 +12,11 @@
12
12
  using namespace Rucy;
13
13
 
14
14
 
15
- static Class cStyle;
16
-
17
- RUCY_DEFINE_VALUE_FROM_TO(Reflex::Style, cStyle)
15
+ RUCY_DEFINE_VALUE_FROM_TO(Reflex::Style)
18
16
 
19
17
  #define THIS to<Reflex::Style*>(self)
20
18
 
21
- #define CHECK RUCY_CHECK_OBJ(Reflex::Style, cStyle, self)
19
+ #define CHECK RUCY_CHECK_OBJ(Reflex::Style, self)
22
20
 
23
21
 
24
22
  static
@@ -201,6 +199,8 @@ VALUE equal(VALUE self, VALUE style)
201
199
  }
202
200
 
203
201
 
202
+ static Class cStyle;
203
+
204
204
  void
205
205
  Init_style ()
206
206
  {
@@ -8,13 +8,11 @@
8
8
  using namespace Rucy;
9
9
 
10
10
 
11
- static Class cStyleLength;
12
-
13
- RUCY_DEFINE_VALUE_FROM_TO(Reflex::StyleLength, cStyleLength)
11
+ RUCY_DEFINE_VALUE_FROM_TO(Reflex::StyleLength)
14
12
 
15
13
  #define THIS to<Reflex::StyleLength*>(self)
16
14
 
17
- #define CHECK RUCY_CHECK_OBJ(Reflex::StyleLength, cStyleLength, self)
15
+ #define CHECK RUCY_CHECK_OBJ(Reflex::StyleLength, self)
18
16
 
19
17
 
20
18
  static
@@ -81,6 +79,8 @@ VALUE to_s(VALUE self)
81
79
  }
82
80
 
83
81
 
82
+ static Class cStyleLength;
83
+
84
84
  void
85
85
  Init_style_length ()
86
86
  {