reflexion 0.1.12 → 0.1.13
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.
- checksums.yaml +5 -5
- data/.doc/ext/reflex/application.cpp +9 -5
- data/.doc/ext/reflex/capture_event.cpp +0 -4
- data/.doc/ext/reflex/contact_event.cpp +17 -10
- data/.doc/ext/reflex/draw_event.cpp +1 -5
- data/.doc/ext/reflex/ellipse_shape.cpp +51 -24
- data/.doc/ext/reflex/event.cpp +0 -4
- data/.doc/ext/reflex/filter.cpp +81 -0
- data/.doc/ext/reflex/focus_event.cpp +9 -13
- data/.doc/ext/reflex/frame_event.cpp +40 -6
- data/.doc/ext/reflex/image_view.cpp +1 -10
- data/.doc/ext/reflex/key_event.cpp +2 -6
- data/.doc/ext/reflex/line_shape.cpp +99 -0
- data/.doc/ext/reflex/motion_event.cpp +75 -0
- data/.doc/ext/reflex/native.cpp +18 -18
- data/.doc/ext/reflex/pointer_event.cpp +5 -11
- data/.doc/ext/reflex/polygon_shape.cpp +65 -0
- data/.doc/ext/reflex/rect_shape.cpp +102 -23
- data/.doc/ext/reflex/reflex.cpp +21 -2
- data/.doc/ext/reflex/scroll_event.cpp +0 -6
- data/.doc/ext/reflex/selector.cpp +43 -15
- data/.doc/ext/reflex/shape.cpp +211 -0
- data/.doc/ext/reflex/style.cpp +359 -185
- data/.doc/ext/reflex/style_length.cpp +163 -35
- data/.doc/ext/reflex/timer.cpp +101 -0
- data/.doc/ext/reflex/timer_event.cpp +123 -0
- data/.doc/ext/reflex/update_event.cpp +11 -6
- data/.doc/ext/reflex/view.cpp +548 -144
- data/.doc/ext/reflex/wheel_event.cpp +0 -22
- data/.doc/ext/reflex/window.cpp +7 -15
- data/README.md +1 -1
- data/Rakefile +14 -12
- data/VERSION +1 -1
- data/ext/reflex/application.cpp +10 -5
- data/ext/reflex/capture_event.cpp +1 -5
- data/ext/reflex/contact_event.cpp +19 -11
- data/ext/reflex/defs.h +5 -2
- data/ext/reflex/draw_event.cpp +2 -6
- data/ext/reflex/ellipse_shape.cpp +56 -25
- data/ext/reflex/event.cpp +0 -4
- data/ext/reflex/extconf.rb +1 -2
- data/ext/reflex/filter.cpp +86 -0
- data/ext/reflex/focus_event.cpp +11 -15
- data/ext/reflex/frame_event.cpp +46 -7
- data/ext/reflex/image_view.cpp +1 -10
- data/ext/reflex/key_event.cpp +3 -7
- data/ext/reflex/line_shape.cpp +104 -0
- data/ext/reflex/motion_event.cpp +79 -0
- data/ext/reflex/native.cpp +18 -18
- data/ext/reflex/pointer_event.cpp +6 -12
- data/ext/reflex/polygon_shape.cpp +68 -0
- data/ext/reflex/rect_shape.cpp +113 -24
- data/ext/reflex/reflex.cpp +21 -2
- data/ext/reflex/scroll_event.cpp +1 -7
- data/ext/reflex/selector.cpp +46 -16
- data/ext/reflex/selector.h +130 -0
- data/ext/reflex/shape.cpp +231 -0
- data/ext/reflex/style.cpp +363 -192
- data/ext/reflex/style_length.cpp +164 -37
- data/ext/reflex/timer.cpp +108 -0
- data/ext/reflex/timer_event.cpp +133 -0
- data/ext/reflex/update_event.cpp +13 -7
- data/ext/reflex/view.cpp +594 -150
- data/ext/reflex/wheel_event.cpp +1 -25
- data/ext/reflex/window.cpp +7 -15
- data/include/reflex/application.h +2 -0
- data/include/reflex/debug.h +22 -0
- data/include/reflex/defs.h +45 -0
- data/include/reflex/event.h +60 -16
- data/include/reflex/exception.h +9 -0
- data/include/reflex/filter.h +56 -0
- data/include/reflex/image_view.h +1 -1
- data/include/reflex/ruby/application.h +17 -9
- data/include/reflex/ruby/event.h +22 -0
- data/include/reflex/ruby/filter.h +69 -0
- data/include/reflex/ruby/selector.h +1 -1
- data/include/reflex/ruby/shape.h +140 -0
- data/include/reflex/ruby/style.h +1 -1
- data/include/reflex/ruby/timer.h +69 -0
- data/include/reflex/ruby/view.h +43 -76
- data/include/reflex/ruby/window.h +17 -32
- data/include/reflex/ruby.h +6 -4
- data/include/reflex/selector.h +54 -2
- data/include/reflex/shape.h +211 -0
- data/include/reflex/style.h +111 -77
- data/include/reflex/timer.h +73 -0
- data/include/reflex/view.h +181 -59
- data/include/reflex/window.h +4 -3
- data/include/reflex.h +5 -4
- data/lib/reflex/application.rb +6 -3
- data/lib/reflex/button.rb +2 -2
- data/lib/reflex/capture_event.rb +7 -6
- data/lib/reflex/contact_event.rb +10 -12
- data/lib/reflex/draw_event.rb +6 -1
- data/lib/reflex/ellipse_shape.rb +27 -0
- data/lib/reflex/filter.rb +18 -0
- data/lib/reflex/fixture.rb +4 -0
- data/lib/reflex/focus_event.rb +10 -12
- data/lib/reflex/frame_event.rb +1 -1
- data/lib/reflex/helper.rb +17 -29
- data/lib/reflex/key_event.rb +13 -11
- data/lib/reflex/line_shape.rb +18 -0
- data/lib/reflex/{texture.rb → matrix.rb} +2 -2
- data/lib/reflex/module.rb +4 -19
- data/lib/reflex/pointer_event.rb +26 -37
- data/lib/reflex/polygon.rb +14 -0
- data/lib/reflex/polygon_shape.rb +23 -0
- data/lib/reflex/polyline.rb +13 -0
- data/lib/reflex/rect_shape.rb +20 -0
- data/lib/reflex/reflex.rb +1 -3
- data/lib/reflex/scroll_event.rb +1 -1
- data/lib/reflex/selector.rb +2 -2
- data/lib/reflex/shape.rb +62 -0
- data/lib/reflex/style.rb +78 -11
- data/lib/reflex/style_length.rb +0 -11
- data/lib/reflex/text_view.rb +7 -24
- data/lib/reflex/timer.rb +30 -0
- data/lib/reflex/timer_event.rb +29 -0
- data/lib/reflex/update_event.rb +1 -1
- data/lib/reflex/view.rb +127 -32
- data/lib/reflex/wheel_event.rb +9 -1
- data/lib/reflex/window.rb +29 -9
- data/lib/reflex.rb +11 -5
- data/lib/reflexion.rb +23 -7
- data/reflex.gemspec +8 -10
- data/samples/bats.rb +4 -4
- data/samples/fans.rb +1 -1
- data/samples/fps.rb +5 -3
- data/samples/hello.rb +4 -6
- data/samples/image.rb +5 -4
- data/samples/ios/hello/hello.xcodeproj/project.pbxproj +0 -2
- data/samples/layout.rb +16 -7
- data/samples/model.rb +10 -7
- data/samples/physics.rb +22 -20
- data/samples/reflexion/breakout.rb +4 -5
- data/samples/reflexion/hello.rb +2 -2
- data/samples/reflexion/jump_action.rb +191 -0
- data/samples/reflexion/noise.rb +23 -0
- data/samples/reflexion/paint.rb +7 -6
- data/samples/reflexion/physics.rb +15 -8
- data/samples/reflexion/pulse.rb +24 -10
- data/samples/shader.rb +8 -6
- data/samples/shapes.rb +63 -14
- data/samples/tree.rb +9 -10
- data/samples/views.rb +3 -3
- data/samples/visuals.rb +2 -5
- data/src/body.cpp +146 -345
- data/src/body.h +91 -0
- data/src/event.cpp +66 -16
- data/src/exception.cpp +13 -3
- data/src/filter.cpp +76 -0
- data/src/fixture.cpp +164 -39
- data/src/fixture.h +85 -0
- data/src/image_view.cpp +4 -4
- data/src/ios/app_delegate.h +5 -10
- data/src/ios/app_delegate.mm +79 -41
- data/src/ios/application.h +32 -0
- data/src/ios/application.mm +35 -25
- data/src/ios/event.mm +8 -4
- data/src/ios/reflex.mm +0 -7
- data/src/ios/view_controller.h +33 -0
- data/src/ios/view_controller.mm +436 -0
- data/src/ios/window.h +40 -0
- data/src/ios/window.mm +59 -250
- data/src/osx/app_delegate.h +5 -10
- data/src/osx/app_delegate.mm +52 -55
- data/src/osx/application.h +32 -0
- data/src/osx/application.mm +44 -39
- data/src/osx/native_window.h +0 -15
- data/src/osx/native_window.mm +131 -115
- data/src/osx/opengl_view.h +0 -2
- data/src/osx/opengl_view.mm +12 -3
- data/src/osx/reflex.mm +0 -9
- data/src/osx/window.h +42 -0
- data/src/osx/window.mm +45 -252
- data/src/selector.cpp +232 -7
- data/src/selector.h +52 -0
- data/src/shape.cpp +1191 -0
- data/src/shape.h +61 -0
- data/src/style.cpp +571 -374
- data/src/style.h +39 -0
- data/src/timer.cpp +291 -0
- data/src/timer.h +55 -0
- data/src/view.cpp +1624 -984
- data/src/view.h +56 -0
- data/src/win32/window.cpp +3 -4
- data/src/window.cpp +275 -20
- data/src/window.h +92 -0
- data/src/world.cpp +112 -111
- data/src/world.h +34 -53
- data/task/box2d.rake +31 -10
- data/test/test_capture_event.rb +8 -6
- data/test/test_pointer_event.rb +85 -0
- data/test/test_selector.rb +1 -1
- data/test/test_shape.rb +71 -0
- data/test/test_style.rb +77 -11
- data/test/test_style_length.rb +42 -13
- data/test/test_view.rb +138 -14
- metadata +109 -210
- data/.doc/ext/reflex/arc_shape.cpp +0 -89
- data/.doc/ext/reflex/body.cpp +0 -299
- data/.doc/ext/reflex/fixture.cpp +0 -101
- data/.doc/ext/reflex/shape_view.cpp +0 -153
- data/ext/reflex/arc_shape.cpp +0 -94
- data/ext/reflex/body.cpp +0 -328
- data/ext/reflex/fixture.cpp +0 -108
- data/ext/reflex/shape_view.cpp +0 -161
- data/include/reflex/bitmap.h +0 -20
- data/include/reflex/body.h +0 -128
- data/include/reflex/bounds.h +0 -20
- data/include/reflex/color.h +0 -20
- data/include/reflex/color_space.h +0 -20
- data/include/reflex/fixture.h +0 -117
- data/include/reflex/font.h +0 -20
- data/include/reflex/image.h +0 -20
- data/include/reflex/matrix.h +0 -20
- data/include/reflex/painter.h +0 -20
- data/include/reflex/point.h +0 -24
- data/include/reflex/ruby/body.h +0 -41
- data/include/reflex/ruby/fixture.h +0 -41
- data/include/reflex/ruby/shape_view.h +0 -96
- data/include/reflex/shader.h +0 -20
- data/include/reflex/shape_view.h +0 -146
- data/include/reflex/texture.h +0 -20
- data/lib/reflex/body.rb +0 -22
- data/lib/reflex/flags.rb +0 -18
- data/lib/reflex/shape_view.rb +0 -25
- data/src/ios/application_data.h +0 -45
- data/src/ios/native_window.h +0 -39
- data/src/ios/native_window.mm +0 -224
- data/src/ios/opengl_view.h +0 -13
- data/src/ios/opengl_view.mm +0 -139
- data/src/ios/window_data.h +0 -75
- data/src/osx/application_data.h +0 -45
- data/src/osx/window_data.h +0 -75
- data/src/physics/Box2D/Box2D.h +0 -68
- data/src/physics/Box2D/Collision/Shapes/b2ChainShape.cpp +0 -193
- data/src/physics/Box2D/Collision/Shapes/b2ChainShape.h +0 -105
- data/src/physics/Box2D/Collision/Shapes/b2CircleShape.cpp +0 -99
- data/src/physics/Box2D/Collision/Shapes/b2CircleShape.h +0 -91
- data/src/physics/Box2D/Collision/Shapes/b2EdgeShape.cpp +0 -138
- data/src/physics/Box2D/Collision/Shapes/b2EdgeShape.h +0 -74
- data/src/physics/Box2D/Collision/Shapes/b2PolygonShape.cpp +0 -467
- data/src/physics/Box2D/Collision/Shapes/b2PolygonShape.h +0 -101
- data/src/physics/Box2D/Collision/Shapes/b2Shape.h +0 -101
- data/src/physics/Box2D/Collision/b2BroadPhase.cpp +0 -119
- data/src/physics/Box2D/Collision/b2BroadPhase.h +0 -257
- data/src/physics/Box2D/Collision/b2CollideCircle.cpp +0 -154
- data/src/physics/Box2D/Collision/b2CollideEdge.cpp +0 -698
- data/src/physics/Box2D/Collision/b2CollidePolygon.cpp +0 -239
- data/src/physics/Box2D/Collision/b2Collision.cpp +0 -252
- data/src/physics/Box2D/Collision/b2Collision.h +0 -277
- data/src/physics/Box2D/Collision/b2Distance.cpp +0 -603
- data/src/physics/Box2D/Collision/b2Distance.h +0 -141
- data/src/physics/Box2D/Collision/b2DynamicTree.cpp +0 -778
- data/src/physics/Box2D/Collision/b2DynamicTree.h +0 -289
- data/src/physics/Box2D/Collision/b2TimeOfImpact.cpp +0 -486
- data/src/physics/Box2D/Collision/b2TimeOfImpact.h +0 -58
- data/src/physics/Box2D/Common/b2BlockAllocator.cpp +0 -215
- data/src/physics/Box2D/Common/b2BlockAllocator.h +0 -62
- data/src/physics/Box2D/Common/b2Draw.cpp +0 -44
- data/src/physics/Box2D/Common/b2Draw.h +0 -86
- data/src/physics/Box2D/Common/b2GrowableStack.h +0 -85
- data/src/physics/Box2D/Common/b2Math.cpp +0 -94
- data/src/physics/Box2D/Common/b2Math.h +0 -720
- data/src/physics/Box2D/Common/b2Settings.cpp +0 -44
- data/src/physics/Box2D/Common/b2Settings.h +0 -151
- data/src/physics/Box2D/Common/b2StackAllocator.cpp +0 -83
- data/src/physics/Box2D/Common/b2StackAllocator.h +0 -60
- data/src/physics/Box2D/Common/b2Timer.cpp +0 -101
- data/src/physics/Box2D/Common/b2Timer.h +0 -50
- data/src/physics/Box2D/Dynamics/Contacts/b2ChainAndCircleContact.cpp +0 -53
- data/src/physics/Box2D/Dynamics/Contacts/b2ChainAndCircleContact.h +0 -39
- data/src/physics/Box2D/Dynamics/Contacts/b2ChainAndPolygonContact.cpp +0 -53
- data/src/physics/Box2D/Dynamics/Contacts/b2ChainAndPolygonContact.h +0 -39
- data/src/physics/Box2D/Dynamics/Contacts/b2CircleContact.cpp +0 -52
- data/src/physics/Box2D/Dynamics/Contacts/b2CircleContact.h +0 -39
- data/src/physics/Box2D/Dynamics/Contacts/b2Contact.cpp +0 -247
- data/src/physics/Box2D/Dynamics/Contacts/b2Contact.h +0 -349
- data/src/physics/Box2D/Dynamics/Contacts/b2ContactSolver.cpp +0 -838
- data/src/physics/Box2D/Dynamics/Contacts/b2ContactSolver.h +0 -95
- data/src/physics/Box2D/Dynamics/Contacts/b2EdgeAndCircleContact.cpp +0 -49
- data/src/physics/Box2D/Dynamics/Contacts/b2EdgeAndCircleContact.h +0 -39
- data/src/physics/Box2D/Dynamics/Contacts/b2EdgeAndPolygonContact.cpp +0 -49
- data/src/physics/Box2D/Dynamics/Contacts/b2EdgeAndPolygonContact.h +0 -39
- data/src/physics/Box2D/Dynamics/Contacts/b2PolygonAndCircleContact.cpp +0 -49
- data/src/physics/Box2D/Dynamics/Contacts/b2PolygonAndCircleContact.h +0 -38
- data/src/physics/Box2D/Dynamics/Contacts/b2PolygonContact.cpp +0 -52
- data/src/physics/Box2D/Dynamics/Contacts/b2PolygonContact.h +0 -39
- data/src/physics/Box2D/Dynamics/Joints/b2DistanceJoint.cpp +0 -260
- data/src/physics/Box2D/Dynamics/Joints/b2DistanceJoint.h +0 -169
- data/src/physics/Box2D/Dynamics/Joints/b2FrictionJoint.cpp +0 -251
- data/src/physics/Box2D/Dynamics/Joints/b2FrictionJoint.h +0 -119
- data/src/physics/Box2D/Dynamics/Joints/b2GearJoint.cpp +0 -419
- data/src/physics/Box2D/Dynamics/Joints/b2GearJoint.h +0 -125
- data/src/physics/Box2D/Dynamics/Joints/b2Joint.cpp +0 -211
- data/src/physics/Box2D/Dynamics/Joints/b2Joint.h +0 -226
- data/src/physics/Box2D/Dynamics/Joints/b2MotorJoint.cpp +0 -304
- data/src/physics/Box2D/Dynamics/Joints/b2MotorJoint.h +0 -133
- data/src/physics/Box2D/Dynamics/Joints/b2MouseJoint.cpp +0 -222
- data/src/physics/Box2D/Dynamics/Joints/b2MouseJoint.h +0 -129
- data/src/physics/Box2D/Dynamics/Joints/b2PrismaticJoint.cpp +0 -629
- data/src/physics/Box2D/Dynamics/Joints/b2PrismaticJoint.h +0 -196
- data/src/physics/Box2D/Dynamics/Joints/b2PulleyJoint.cpp +0 -348
- data/src/physics/Box2D/Dynamics/Joints/b2PulleyJoint.h +0 -152
- data/src/physics/Box2D/Dynamics/Joints/b2RevoluteJoint.cpp +0 -502
- data/src/physics/Box2D/Dynamics/Joints/b2RevoluteJoint.h +0 -204
- data/src/physics/Box2D/Dynamics/Joints/b2RopeJoint.cpp +0 -241
- data/src/physics/Box2D/Dynamics/Joints/b2RopeJoint.h +0 -114
- data/src/physics/Box2D/Dynamics/Joints/b2WeldJoint.cpp +0 -344
- data/src/physics/Box2D/Dynamics/Joints/b2WeldJoint.h +0 -126
- data/src/physics/Box2D/Dynamics/Joints/b2WheelJoint.cpp +0 -419
- data/src/physics/Box2D/Dynamics/Joints/b2WheelJoint.h +0 -210
- data/src/physics/Box2D/Dynamics/b2Body.cpp +0 -549
- data/src/physics/Box2D/Dynamics/b2Body.h +0 -860
- data/src/physics/Box2D/Dynamics/b2ContactManager.cpp +0 -296
- data/src/physics/Box2D/Dynamics/b2ContactManager.h +0 -52
- data/src/physics/Box2D/Dynamics/b2Fixture.cpp +0 -303
- data/src/physics/Box2D/Dynamics/b2Fixture.h +0 -345
- data/src/physics/Box2D/Dynamics/b2Island.cpp +0 -539
- data/src/physics/Box2D/Dynamics/b2Island.h +0 -93
- data/src/physics/Box2D/Dynamics/b2TimeStep.h +0 -70
- data/src/physics/Box2D/Dynamics/b2World.cpp +0 -1339
- data/src/physics/Box2D/Dynamics/b2World.h +0 -354
- data/src/physics/Box2D/Dynamics/b2WorldCallbacks.cpp +0 -36
- data/src/physics/Box2D/Dynamics/b2WorldCallbacks.h +0 -155
- data/src/physics/Box2D/Rope/b2Rope.cpp +0 -259
- data/src/physics/Box2D/Rope/b2Rope.h +0 -115
- data/src/shape_view.cpp +0 -306
data/.doc/ext/reflex/view.cpp
CHANGED
@@ -2,27 +2,27 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
#include <vector>
|
5
|
-
#include <rucy.h>
|
6
5
|
#include <rays/ruby/point.h>
|
7
6
|
#include <rays/ruby/bounds.h>
|
8
|
-
#include
|
7
|
+
#include <rays/ruby/polygon.h>
|
9
8
|
#include "reflex/ruby/selector.h"
|
9
|
+
#include "reflex/ruby/timer.h"
|
10
10
|
#include "reflex/ruby/style.h"
|
11
|
-
#include "reflex/ruby/
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
using Reflex::coord;
|
11
|
+
#include "reflex/ruby/shape.h"
|
12
|
+
#include "reflex/ruby/filter.h"
|
13
|
+
#include "reflex/ruby/window.h"
|
14
|
+
#include "defs.h"
|
15
|
+
#include "selector.h"
|
17
16
|
|
18
17
|
|
19
18
|
RUCY_DEFINE_WRAPPER_VALUE_FROM_TO(Reflex::View)
|
20
19
|
|
21
|
-
#define
|
20
|
+
#define THIS to< Reflex::View*>(self)
|
21
|
+
#define C_THIS to<const Reflex::View*>(self)
|
22
22
|
|
23
23
|
#define CHECK RUCY_CHECK_OBJECT(Reflex::View, self)
|
24
24
|
|
25
|
-
#define CALL(fun)
|
25
|
+
#define CALL(fun) RUCY_CALL_SUPER(THIS, fun)
|
26
26
|
|
27
27
|
|
28
28
|
template <typename T>
|
@@ -72,6 +72,54 @@ VALUE redraw(VALUE self)
|
|
72
72
|
return self;
|
73
73
|
}
|
74
74
|
|
75
|
+
static
|
76
|
+
VALUE focus(VALUE self)
|
77
|
+
{
|
78
|
+
CHECK;
|
79
|
+
check_arg_count(__FILE__, __LINE__, "View#focus", argc, 0, 1);
|
80
|
+
|
81
|
+
bool state = (argc >= 1) ? to<bool>(argv[0]) : true;
|
82
|
+
|
83
|
+
THIS->focus(state);
|
84
|
+
return self;
|
85
|
+
}
|
86
|
+
|
87
|
+
static
|
88
|
+
VALUE blur(VALUE self)
|
89
|
+
{
|
90
|
+
CHECK;
|
91
|
+
THIS->blur();
|
92
|
+
return self;
|
93
|
+
}
|
94
|
+
|
95
|
+
static
|
96
|
+
VALUE has_focus(VALUE self)
|
97
|
+
{
|
98
|
+
CHECK;
|
99
|
+
return value(THIS->has_focus());
|
100
|
+
}
|
101
|
+
|
102
|
+
static
|
103
|
+
VALUE start_timer(VALUE self)
|
104
|
+
{
|
105
|
+
CHECK;
|
106
|
+
check_arg_count(__FILE__, __LINE__, "View#start_timer", argc, 1, 2);
|
107
|
+
|
108
|
+
Reflex::Timer* timer = THIS->start_timer(
|
109
|
+
to<float>(argv[0]),
|
110
|
+
argc >= 2 ? to<int>(argv[1]) : 1);
|
111
|
+
|
112
|
+
return value(timer);
|
113
|
+
}
|
114
|
+
|
115
|
+
static
|
116
|
+
VALUE update_layout(VALUE self)
|
117
|
+
{
|
118
|
+
CHECK;
|
119
|
+
THIS->update_layout();
|
120
|
+
return self;
|
121
|
+
}
|
122
|
+
|
75
123
|
static
|
76
124
|
VALUE add_child(VALUE self, VALUE child)
|
77
125
|
{
|
@@ -88,16 +136,24 @@ VALUE remove_child(VALUE self, VALUE child)
|
|
88
136
|
return child;
|
89
137
|
}
|
90
138
|
|
139
|
+
static
|
140
|
+
VALUE clear_children(VALUE self)
|
141
|
+
{
|
142
|
+
CHECK;
|
143
|
+
THIS->clear_children();
|
144
|
+
return self;
|
145
|
+
}
|
146
|
+
|
91
147
|
static
|
92
148
|
VALUE find_children(VALUE self)
|
93
149
|
{
|
94
150
|
CHECK;
|
95
151
|
check_arg_count(__FILE__, __LINE__, "View#find_children", argc, 1, 2);
|
96
152
|
|
97
|
-
bool recursive = (argc >= 2) ? to<bool>(argv[1]) :
|
153
|
+
bool recursive = (argc >= 2) ? to<bool>(argv[1]) : true;
|
98
154
|
|
99
|
-
Reflex::View::ChildList children
|
100
|
-
|
155
|
+
Reflex::View::ChildList children =
|
156
|
+
THIS->find_children(to<Reflex::Selector>(argv[0]), recursive);
|
101
157
|
return array(children.begin(), children.end());
|
102
158
|
}
|
103
159
|
|
@@ -136,9 +192,9 @@ VALUE get_style(VALUE self, VALUE selector)
|
|
136
192
|
|
137
193
|
Reflex::Style* s = NULL;
|
138
194
|
if (selector)
|
139
|
-
s = THIS->get_style(to<Reflex::Selector>(selector)
|
195
|
+
s = THIS->get_style(to<Reflex::Selector>(selector));
|
140
196
|
else
|
141
|
-
s = THIS->style(
|
197
|
+
s = THIS->style();
|
142
198
|
|
143
199
|
return s ? value(*s) : nil();
|
144
200
|
}
|
@@ -151,8 +207,8 @@ VALUE find_styles(VALUE self)
|
|
151
207
|
|
152
208
|
bool recursive = (argc >= 2) ? to<bool>(argv[1]) : false;
|
153
209
|
|
154
|
-
Reflex::View::StyleList styles
|
155
|
-
|
210
|
+
Reflex::View::StyleList styles =
|
211
|
+
THIS->find_styles(to<Reflex::Selector>(argv[0]), recursive);
|
156
212
|
return array(styles.begin(), styles.end());
|
157
213
|
}
|
158
214
|
|
@@ -168,128 +224,188 @@ VALUE each_style(VALUE self)
|
|
168
224
|
return ret;
|
169
225
|
}
|
170
226
|
|
227
|
+
static Reflex::Shape::Ref
|
228
|
+
to_shape (Value value)
|
229
|
+
{
|
230
|
+
if (value.is_nil())
|
231
|
+
return NULL;
|
232
|
+
|
233
|
+
if (value.is_kind_of(Rays::polygon_class()))
|
234
|
+
{
|
235
|
+
Reflex::PolygonShape* shape = new Reflex::PolygonShape();
|
236
|
+
shape->set_polygon(to<Rays::Polygon&>(value));
|
237
|
+
return shape;
|
238
|
+
}
|
239
|
+
else
|
240
|
+
return to<Reflex::Shape*>(value);
|
241
|
+
}
|
242
|
+
|
171
243
|
static
|
172
|
-
VALUE
|
244
|
+
VALUE set_shape(VALUE self, VALUE shape)
|
173
245
|
{
|
174
246
|
CHECK;
|
175
|
-
|
176
|
-
|
177
|
-
|
247
|
+
THIS->set_shape(to_shape(shape));
|
248
|
+
return shape;
|
249
|
+
}
|
178
250
|
|
179
|
-
|
180
|
-
|
251
|
+
static
|
252
|
+
VALUE get_shape(VALUE self)
|
253
|
+
{
|
254
|
+
CHECK;
|
255
|
+
return value(THIS->shape());
|
181
256
|
}
|
182
257
|
|
183
258
|
static
|
184
|
-
VALUE
|
259
|
+
VALUE add_shape(VALUE self, VALUE shape)
|
185
260
|
{
|
186
261
|
CHECK;
|
187
|
-
THIS->
|
188
|
-
return
|
262
|
+
THIS->add_shape(to_shape(shape));
|
263
|
+
return shape;
|
189
264
|
}
|
190
265
|
|
191
266
|
static
|
192
|
-
VALUE
|
267
|
+
VALUE remove_shape(VALUE self, VALUE shape)
|
193
268
|
{
|
194
269
|
CHECK;
|
195
|
-
|
270
|
+
THIS->remove_shape(to<Reflex::Shape*>(shape));
|
271
|
+
return shape;
|
196
272
|
}
|
197
273
|
|
198
274
|
static
|
199
|
-
VALUE
|
275
|
+
VALUE clear_shapes(VALUE self)
|
200
276
|
{
|
201
277
|
CHECK;
|
202
|
-
THIS->
|
278
|
+
THIS->clear_shapes();
|
203
279
|
return self;
|
204
280
|
}
|
205
281
|
|
206
282
|
static
|
207
|
-
VALUE
|
283
|
+
VALUE find_shapes(VALUE self)
|
208
284
|
{
|
209
285
|
CHECK;
|
210
|
-
|
286
|
+
check_arg_count(__FILE__, __LINE__, "View#find_shapes", argc, 1);
|
287
|
+
|
288
|
+
Reflex::View::ShapeList shapes =
|
289
|
+
THIS->find_shapes(to<Reflex::Selector>(argv[0]));
|
290
|
+
return array(shapes.begin(), shapes.end());
|
211
291
|
}
|
212
292
|
|
213
293
|
static
|
214
|
-
VALUE
|
294
|
+
VALUE each_shape(VALUE self)
|
215
295
|
{
|
216
296
|
CHECK;
|
217
|
-
|
297
|
+
|
298
|
+
Value ret;
|
299
|
+
Reflex::View::shape_iterator end = THIS->shape_end();
|
300
|
+
for (Reflex::View::shape_iterator it = THIS->shape_begin(); it != end; ++it)
|
301
|
+
ret = rb_yield(value(it->get()));
|
302
|
+
return ret;
|
218
303
|
}
|
219
304
|
|
220
305
|
static
|
221
|
-
VALUE
|
306
|
+
VALUE set_filter(VALUE self, VALUE filter)
|
222
307
|
{
|
223
308
|
CHECK;
|
224
|
-
THIS->
|
309
|
+
THIS->set_filter(filter ? to<Reflex::Filter*>(filter) : NULL);
|
310
|
+
return filter;
|
225
311
|
}
|
226
312
|
|
227
313
|
static
|
228
|
-
VALUE
|
314
|
+
VALUE get_filter(VALUE self)
|
229
315
|
{
|
230
316
|
CHECK;
|
231
|
-
THIS->
|
317
|
+
return value(THIS->filter());
|
232
318
|
}
|
233
319
|
|
234
320
|
static
|
235
|
-
VALUE
|
321
|
+
VALUE set_frame(VALUE self)
|
236
322
|
{
|
237
323
|
CHECK;
|
238
|
-
|
324
|
+
THIS->set_frame(to<Rays::Bounds>(argc, argv));
|
325
|
+
return value(THIS->frame());
|
239
326
|
}
|
240
327
|
|
241
328
|
static
|
242
|
-
VALUE
|
329
|
+
VALUE get_frame(VALUE self)
|
243
330
|
{
|
244
331
|
CHECK;
|
245
|
-
THIS->
|
332
|
+
return value(THIS->frame());
|
246
333
|
}
|
247
334
|
|
248
335
|
static
|
249
|
-
VALUE
|
336
|
+
VALUE content_bounds(VALUE self)
|
250
337
|
{
|
251
338
|
CHECK;
|
252
|
-
|
339
|
+
return value(CALL(content_bounds()));
|
253
340
|
}
|
254
341
|
|
255
342
|
static
|
256
|
-
VALUE
|
343
|
+
VALUE fit_to_content(VALUE self)
|
257
344
|
{
|
258
345
|
CHECK;
|
346
|
+
THIS->fit_to_content();
|
347
|
+
return self;
|
348
|
+
}
|
259
349
|
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
350
|
+
static
|
351
|
+
VALUE set_angle(VALUE self, VALUE degree)
|
352
|
+
{
|
353
|
+
CHECK;
|
354
|
+
THIS->set_angle(to<float>(degree));
|
355
|
+
return degree;
|
265
356
|
}
|
266
357
|
|
267
358
|
static
|
268
|
-
VALUE
|
359
|
+
VALUE get_angle(VALUE self)
|
269
360
|
{
|
270
361
|
CHECK;
|
271
|
-
THIS->
|
362
|
+
return value(THIS->angle());
|
272
363
|
}
|
273
364
|
|
274
365
|
static
|
275
|
-
VALUE
|
366
|
+
VALUE scroll_to(VALUE self)
|
276
367
|
{
|
277
368
|
CHECK;
|
278
|
-
|
369
|
+
check_arg_count(__FILE__, __LINE__, "View#scroll_to", argc, 1, 2, 3);
|
370
|
+
|
371
|
+
if (argv[0].is_kind_of(Rays::point_class()))
|
372
|
+
THIS->scroll_to(to<Rays::Point&>(argv[0]));
|
373
|
+
else
|
374
|
+
{
|
375
|
+
const Rays::Point& p = THIS->scroll();
|
376
|
+
coord x = (argc >= 1 && argv[0]) ? to<coord>(argv[0]) : p.x;
|
377
|
+
coord y = (argc >= 2 && argv[1]) ? to<coord>(argv[1]) : p.y;
|
378
|
+
coord z = (argc >= 3 && argv[2]) ? to<coord>(argv[2]) : p.z;
|
379
|
+
THIS->scroll_to(x, y, z);
|
380
|
+
}
|
381
|
+
|
382
|
+
return self;
|
279
383
|
}
|
280
384
|
|
281
385
|
static
|
282
|
-
VALUE
|
386
|
+
VALUE scroll_by(VALUE self)
|
283
387
|
{
|
284
388
|
CHECK;
|
285
|
-
|
389
|
+
check_arg_count(__FILE__, __LINE__, "View#scroll_by", argc, 1, 2, 3);
|
390
|
+
|
391
|
+
if (argv[0].is_kind_of(Rays::point_class()))
|
392
|
+
THIS->scroll_by(to<Rays::Point&>(argv[0]));
|
393
|
+
else
|
394
|
+
{
|
395
|
+
coord x = (argc >= 1 && argv[0]) ? to<coord>(argv[0]) : 0;
|
396
|
+
coord y = (argc >= 2 && argv[1]) ? to<coord>(argv[1]) : 0;
|
397
|
+
coord z = (argc >= 3 && argv[2]) ? to<coord>(argv[2]) : 0;
|
398
|
+
THIS->scroll_by(x, y, z);
|
399
|
+
}
|
400
|
+
|
401
|
+
return self;
|
286
402
|
}
|
287
403
|
|
288
404
|
static
|
289
|
-
VALUE
|
405
|
+
VALUE get_scroll(VALUE self)
|
290
406
|
{
|
291
407
|
CHECK;
|
292
|
-
return value(THIS->
|
408
|
+
return value(THIS->scroll());
|
293
409
|
}
|
294
410
|
|
295
411
|
static
|
@@ -297,6 +413,7 @@ VALUE set_zoom(VALUE self, VALUE zoom)
|
|
297
413
|
{
|
298
414
|
CHECK;
|
299
415
|
THIS->set_zoom(to<float>(zoom));
|
416
|
+
return zoom;
|
300
417
|
}
|
301
418
|
|
302
419
|
static
|
@@ -307,70 +424,98 @@ VALUE get_zoom(VALUE self)
|
|
307
424
|
}
|
308
425
|
|
309
426
|
static
|
310
|
-
VALUE
|
427
|
+
VALUE set_capture(VALUE self, VALUE types)
|
311
428
|
{
|
312
429
|
CHECK;
|
313
|
-
|
430
|
+
THIS->set_capture(to<uint>(types));
|
431
|
+
return types;
|
314
432
|
}
|
315
433
|
|
316
434
|
static
|
317
|
-
VALUE
|
435
|
+
VALUE get_capture(VALUE self)
|
318
436
|
{
|
319
437
|
CHECK;
|
320
|
-
THIS->
|
438
|
+
return value(THIS->capture());
|
321
439
|
}
|
322
440
|
|
323
441
|
static
|
324
|
-
VALUE
|
442
|
+
VALUE set_clip(VALUE self, VALUE clip)
|
325
443
|
{
|
326
444
|
CHECK;
|
327
|
-
|
445
|
+
|
446
|
+
if (clip)
|
447
|
+
THIS-> add_flag(Reflex::View::FLAG_CLIP);
|
448
|
+
else
|
449
|
+
THIS->remove_flag(Reflex::View::FLAG_CLIP);
|
450
|
+
|
451
|
+
return clip;
|
328
452
|
}
|
329
453
|
|
330
454
|
static
|
331
|
-
VALUE
|
455
|
+
VALUE get_clip(VALUE self)
|
332
456
|
{
|
333
457
|
CHECK;
|
334
|
-
|
458
|
+
return value(THIS->has_flag(Reflex::View::FLAG_CLIP));
|
459
|
+
}
|
335
460
|
|
336
|
-
|
337
|
-
|
461
|
+
static
|
462
|
+
VALUE set_cache(VALUE self, VALUE cache)
|
463
|
+
{
|
464
|
+
CHECK;
|
465
|
+
|
466
|
+
if (cache)
|
467
|
+
THIS-> add_flag(Reflex::View::FLAG_CACHE);
|
338
468
|
else
|
339
|
-
|
340
|
-
const Rays::Point& p = THIS->scroll();
|
341
|
-
coord x = (argc >= 1 && argv[0]) ? to<coord>(argv[0]) : p.x;
|
342
|
-
coord y = (argc >= 2 && argv[1]) ? to<coord>(argv[1]) : p.y;
|
343
|
-
coord z = (argc >= 3 && argv[2]) ? to<coord>(argv[2]) : p.z;
|
344
|
-
THIS->scroll_to(x, y, z);
|
345
|
-
}
|
469
|
+
THIS->remove_flag(Reflex::View::FLAG_CACHE);
|
346
470
|
|
347
|
-
return
|
471
|
+
return cache;
|
348
472
|
}
|
349
473
|
|
350
474
|
static
|
351
|
-
VALUE
|
475
|
+
VALUE get_cache(VALUE self)
|
352
476
|
{
|
353
477
|
CHECK;
|
354
|
-
|
478
|
+
return value(THIS->has_flag(Reflex::View::FLAG_CACHE));
|
479
|
+
}
|
355
480
|
|
356
|
-
|
357
|
-
|
481
|
+
static
|
482
|
+
VALUE set_resize_to_fit(VALUE self, VALUE resize)
|
483
|
+
{
|
484
|
+
CHECK;
|
485
|
+
|
486
|
+
if (resize)
|
487
|
+
THIS-> add_flag(Reflex::View::FLAG_RESIZE_TO_FIT);
|
358
488
|
else
|
359
|
-
|
360
|
-
coord x = (argc >= 1 && argv[0]) ? to<coord>(argv[0]) : 0;
|
361
|
-
coord y = (argc >= 2 && argv[1]) ? to<coord>(argv[1]) : 0;
|
362
|
-
coord z = (argc >= 3 && argv[2]) ? to<coord>(argv[2]) : 0;
|
363
|
-
THIS->scroll_by(x, y, z);
|
364
|
-
}
|
489
|
+
THIS->remove_flag(Reflex::View::FLAG_RESIZE_TO_FIT);
|
365
490
|
|
366
|
-
return
|
491
|
+
return resize;
|
367
492
|
}
|
368
493
|
|
369
494
|
static
|
370
|
-
VALUE
|
495
|
+
VALUE get_resize_to_fit(VALUE self)
|
371
496
|
{
|
372
497
|
CHECK;
|
373
|
-
return value(THIS->
|
498
|
+
return value(THIS->has_flag(Reflex::View::FLAG_RESIZE_TO_FIT));
|
499
|
+
}
|
500
|
+
|
501
|
+
static
|
502
|
+
VALUE set_scroll_to_fit(VALUE self, VALUE scroll)
|
503
|
+
{
|
504
|
+
CHECK;
|
505
|
+
|
506
|
+
if (scroll)
|
507
|
+
THIS-> add_flag(Reflex::View::FLAG_SCROLL_TO_FIT);
|
508
|
+
else
|
509
|
+
THIS->remove_flag(Reflex::View::FLAG_SCROLL_TO_FIT);
|
510
|
+
|
511
|
+
return scroll;
|
512
|
+
}
|
513
|
+
|
514
|
+
static
|
515
|
+
VALUE get_scroll_to_fit(VALUE self)
|
516
|
+
{
|
517
|
+
CHECK;
|
518
|
+
return value(THIS->has_flag(Reflex::View::FLAG_SCROLL_TO_FIT));
|
374
519
|
}
|
375
520
|
|
376
521
|
static
|
@@ -388,10 +533,211 @@ VALUE window(VALUE self)
|
|
388
533
|
}
|
389
534
|
|
390
535
|
static
|
391
|
-
VALUE
|
536
|
+
VALUE apply_force(VALUE self)
|
537
|
+
{
|
538
|
+
CHECK;
|
539
|
+
THIS->apply_force(to<Rays::Point>(argc, argv));
|
540
|
+
return self;
|
541
|
+
}
|
542
|
+
|
543
|
+
static
|
544
|
+
VALUE apply_torque(VALUE self, VALUE torque)
|
545
|
+
{
|
546
|
+
CHECK;
|
547
|
+
THIS->apply_torque(to<float>(torque));
|
548
|
+
return self;
|
549
|
+
}
|
550
|
+
|
551
|
+
static
|
552
|
+
VALUE apply_linear_impulse(VALUE self)
|
553
|
+
{
|
554
|
+
CHECK;
|
555
|
+
THIS->apply_linear_impulse(to<Rays::Point>(argc, argv));
|
556
|
+
return self;
|
557
|
+
}
|
558
|
+
|
559
|
+
static
|
560
|
+
VALUE apply_angular_impulse(VALUE self, VALUE impulse)
|
561
|
+
{
|
562
|
+
CHECK;
|
563
|
+
THIS->apply_angular_impulse(to<float>(impulse));
|
564
|
+
return self;
|
565
|
+
}
|
566
|
+
|
567
|
+
static
|
568
|
+
VALUE set_static(VALUE self, VALUE state)
|
569
|
+
{
|
570
|
+
CHECK;
|
571
|
+
THIS->set_static(state);
|
572
|
+
return state;
|
573
|
+
}
|
574
|
+
|
575
|
+
static
|
576
|
+
VALUE is_static(VALUE self)
|
577
|
+
{
|
578
|
+
CHECK;
|
579
|
+
return value(THIS->is_static());
|
580
|
+
}
|
581
|
+
|
582
|
+
static
|
583
|
+
VALUE set_dynamic(VALUE self, VALUE state)
|
584
|
+
{
|
585
|
+
CHECK;
|
586
|
+
THIS->set_dynamic(state);
|
587
|
+
return state;
|
588
|
+
}
|
589
|
+
|
590
|
+
static
|
591
|
+
VALUE is_dynamic(VALUE self)
|
592
|
+
{
|
593
|
+
CHECK;
|
594
|
+
return value(THIS->is_dynamic());
|
595
|
+
}
|
596
|
+
|
597
|
+
static
|
598
|
+
VALUE set_density(VALUE self, VALUE density)
|
599
|
+
{
|
600
|
+
CHECK;
|
601
|
+
THIS->set_density(to<float>(density));
|
602
|
+
return density;
|
603
|
+
}
|
604
|
+
|
605
|
+
static
|
606
|
+
VALUE get_density(VALUE self)
|
607
|
+
{
|
608
|
+
CHECK;
|
609
|
+
return value(THIS->density());
|
610
|
+
}
|
611
|
+
|
612
|
+
static
|
613
|
+
VALUE set_friction(VALUE self, VALUE friction)
|
614
|
+
{
|
615
|
+
CHECK;
|
616
|
+
THIS->set_friction(to<float>(friction));
|
617
|
+
return friction;
|
618
|
+
}
|
619
|
+
|
620
|
+
static
|
621
|
+
VALUE get_friction(VALUE self)
|
622
|
+
{
|
623
|
+
CHECK;
|
624
|
+
return value(THIS->friction());
|
625
|
+
}
|
626
|
+
|
627
|
+
static
|
628
|
+
VALUE set_restitution(VALUE self, VALUE restitution)
|
629
|
+
{
|
630
|
+
CHECK;
|
631
|
+
THIS->set_restitution(to<float>(restitution));
|
632
|
+
return restitution;
|
633
|
+
}
|
634
|
+
|
635
|
+
static
|
636
|
+
VALUE get_restitution(VALUE self)
|
637
|
+
{
|
638
|
+
CHECK;
|
639
|
+
return value(THIS->restitution());
|
640
|
+
}
|
641
|
+
|
642
|
+
static
|
643
|
+
VALUE set_sensor(VALUE self, VALUE state)
|
644
|
+
{
|
645
|
+
CHECK;
|
646
|
+
THIS->set_sensor(state);
|
647
|
+
return state;
|
648
|
+
}
|
649
|
+
|
650
|
+
static
|
651
|
+
VALUE is_sensor(VALUE self)
|
652
|
+
{
|
653
|
+
CHECK;
|
654
|
+
return value(THIS->is_sensor());
|
655
|
+
}
|
656
|
+
|
657
|
+
static
|
658
|
+
VALUE set_category_bits(VALUE self, VALUE bits)
|
659
|
+
{
|
660
|
+
CHECK;
|
661
|
+
THIS->set_category_bits(to<uint>(bits));
|
662
|
+
return bits;
|
663
|
+
}
|
664
|
+
|
665
|
+
static
|
666
|
+
VALUE get_category_bits(VALUE self)
|
667
|
+
{
|
668
|
+
CHECK;
|
669
|
+
return value(THIS->category_bits());
|
670
|
+
}
|
671
|
+
|
672
|
+
static
|
673
|
+
VALUE set_collision_mask(VALUE self, VALUE mask)
|
674
|
+
{
|
675
|
+
CHECK;
|
676
|
+
THIS->set_collision_mask(to<uint>(mask));
|
677
|
+
return mask;
|
678
|
+
}
|
679
|
+
|
680
|
+
static
|
681
|
+
VALUE get_collision_mask(VALUE self)
|
682
|
+
{
|
683
|
+
CHECK;
|
684
|
+
return value(THIS->collision_mask());
|
685
|
+
}
|
686
|
+
|
687
|
+
static
|
688
|
+
VALUE set_linear_velocity(VALUE self)
|
689
|
+
{
|
690
|
+
CHECK;
|
691
|
+
THIS->set_linear_velocity(to<Rays::Point>(argc, argv));
|
692
|
+
return value(THIS->linear_velocity());
|
693
|
+
}
|
694
|
+
|
695
|
+
static
|
696
|
+
VALUE get_linear_velocity(VALUE self)
|
697
|
+
{
|
698
|
+
CHECK;
|
699
|
+
return value(THIS->linear_velocity());
|
700
|
+
}
|
701
|
+
|
702
|
+
static
|
703
|
+
VALUE set_angular_velocity(VALUE self, VALUE velocity)
|
704
|
+
{
|
705
|
+
CHECK;
|
706
|
+
THIS->set_angular_velocity(to<float>(velocity));
|
707
|
+
return velocity;
|
708
|
+
}
|
709
|
+
|
710
|
+
static
|
711
|
+
VALUE get_angular_velocity(VALUE self)
|
712
|
+
{
|
713
|
+
CHECK;
|
714
|
+
return value(THIS->angular_velocity());
|
715
|
+
}
|
716
|
+
|
717
|
+
static
|
718
|
+
VALUE set_gravity_scale(VALUE self, VALUE scale)
|
719
|
+
{
|
720
|
+
CHECK;
|
721
|
+
THIS->set_gravity_scale(to<float>(scale));
|
722
|
+
return scale;
|
723
|
+
}
|
724
|
+
|
725
|
+
static
|
726
|
+
VALUE get_gravity_scale(VALUE self)
|
727
|
+
{
|
728
|
+
CHECK;
|
729
|
+
return value(THIS->gravity_scale());
|
730
|
+
}
|
731
|
+
|
732
|
+
static
|
733
|
+
VALUE update_physics(VALUE self)
|
392
734
|
{
|
393
735
|
CHECK;
|
394
|
-
|
736
|
+
check_arg_count(__FILE__, __LINE__, "View#update_physics", argc, 0, 1);
|
737
|
+
|
738
|
+
float duration = argc >= 1 ? to<float>(argv[0]) : 0;
|
739
|
+
THIS->update_physics(duration);
|
740
|
+
return self;
|
395
741
|
}
|
396
742
|
|
397
743
|
static
|
@@ -400,17 +746,17 @@ VALUE meter2pixel(VALUE self)
|
|
400
746
|
CHECK;
|
401
747
|
check_arg_count(__FILE__, __LINE__, "View#meter2pixel", argc, 0, 1, 2);
|
402
748
|
|
403
|
-
float meter = argc >= 1 ? argv[0]
|
404
|
-
bool create_world = argc >= 2 ?
|
749
|
+
float meter = argc >= 1 ? to<float>(argv[0]) : 1;
|
750
|
+
bool create_world = argc >= 2 ? to<bool> (argv[1]) : true;
|
405
751
|
return value(THIS->meter2pixel(meter, create_world));
|
406
752
|
}
|
407
753
|
|
408
754
|
static
|
409
|
-
VALUE set_gravity(VALUE self
|
755
|
+
VALUE set_gravity(VALUE self)
|
410
756
|
{
|
411
757
|
CHECK;
|
412
|
-
THIS->set_gravity(
|
413
|
-
return
|
758
|
+
THIS->set_gravity(to<Rays::Point>(argc, argv));
|
759
|
+
return value(THIS->gravity());
|
414
760
|
}
|
415
761
|
|
416
762
|
static
|
@@ -420,6 +766,21 @@ VALUE get_gravity(VALUE self)
|
|
420
766
|
return value(THIS->gravity());
|
421
767
|
}
|
422
768
|
|
769
|
+
static
|
770
|
+
VALUE set_time_scale(VALUE self, VALUE scale)
|
771
|
+
{
|
772
|
+
CHECK;
|
773
|
+
THIS->set_time_scale(to<float>(scale));
|
774
|
+
return scale;
|
775
|
+
}
|
776
|
+
|
777
|
+
static
|
778
|
+
VALUE get_time_scale(VALUE self)
|
779
|
+
{
|
780
|
+
CHECK;
|
781
|
+
return value(THIS->time_scale());
|
782
|
+
}
|
783
|
+
|
423
784
|
static
|
424
785
|
VALUE wall(VALUE self)
|
425
786
|
{
|
@@ -436,20 +797,16 @@ VALUE set_debug(VALUE self, VALUE state)
|
|
436
797
|
}
|
437
798
|
|
438
799
|
static
|
439
|
-
VALUE
|
800
|
+
VALUE get_debug(VALUE self)
|
440
801
|
{
|
441
802
|
CHECK;
|
442
|
-
return value(THIS->
|
803
|
+
return value(THIS->debug());
|
443
804
|
}
|
444
805
|
|
445
806
|
static
|
446
807
|
VALUE on_attach(VALUE self, VALUE event)
|
447
808
|
{
|
448
809
|
CHECK;
|
449
|
-
|
450
|
-
RUCY_SYM(call_attach_block);
|
451
|
-
self.call(call_attach_block);
|
452
|
-
|
453
810
|
CALL(on_attach(to<Reflex::Event*>(event)));
|
454
811
|
}
|
455
812
|
|
@@ -523,13 +880,6 @@ VALUE on_focus(VALUE self, VALUE event)
|
|
523
880
|
CALL(on_focus(to<Reflex::FocusEvent*>(event)));
|
524
881
|
}
|
525
882
|
|
526
|
-
static
|
527
|
-
VALUE on_blur(VALUE self, VALUE event)
|
528
|
-
{
|
529
|
-
CHECK;
|
530
|
-
CALL(on_blur(to<Reflex::FocusEvent*>(event)));
|
531
|
-
}
|
532
|
-
|
533
883
|
static
|
534
884
|
VALUE on_key(VALUE self, VALUE event)
|
535
885
|
{
|
@@ -593,6 +943,13 @@ VALUE on_capture(VALUE self, VALUE event)
|
|
593
943
|
CALL(on_capture(to<Reflex::CaptureEvent*>(event)));
|
594
944
|
}
|
595
945
|
|
946
|
+
static
|
947
|
+
VALUE on_timer(VALUE self, VALUE event)
|
948
|
+
{
|
949
|
+
CHECK;
|
950
|
+
CALL(on_timer(to<Reflex::TimerEvent*>(event)));
|
951
|
+
}
|
952
|
+
|
596
953
|
static
|
597
954
|
VALUE on_contact(VALUE self, VALUE event)
|
598
955
|
{
|
@@ -614,9 +971,6 @@ VALUE on_contact_end(VALUE self, VALUE event)
|
|
614
971
|
CALL(on_contact_end(to<Reflex::ContactEvent*>(event)));
|
615
972
|
}
|
616
973
|
|
617
|
-
static
|
618
|
-
RUCY_DEF_clear_override_flags(cof, Reflex::View);
|
619
|
-
|
620
974
|
|
621
975
|
static Class cView;
|
622
976
|
|
@@ -631,48 +985,96 @@ Init_view ()
|
|
631
985
|
rb_define_method(cView, "hide", RUBY_METHOD_FUNC(hide), 0);
|
632
986
|
cView.define_method("hidden?", hidden);
|
633
987
|
rb_define_method(cView, "redraw", RUBY_METHOD_FUNC(redraw), 0);
|
988
|
+
rb_define_method(cView, "focus", RUBY_METHOD_FUNC(focus), -1);
|
989
|
+
rb_define_method(cView, "blur", RUBY_METHOD_FUNC(blur), 0);
|
990
|
+
cView.define_method("focus?", has_focus);
|
991
|
+
rb_define_private_method(cView, "start_timer", RUBY_METHOD_FUNC(start_timer), -1);
|
992
|
+
rb_define_method(cView, "update_layout", RUBY_METHOD_FUNC(update_layout), 0);
|
993
|
+
|
634
994
|
rb_define_method(cView, "add_child", RUBY_METHOD_FUNC(add_child), 1);
|
635
995
|
rb_define_method(cView, "remove_child", RUBY_METHOD_FUNC(remove_child), 1);
|
996
|
+
rb_define_method(cView, "clear_children", RUBY_METHOD_FUNC(clear_children), 0);
|
636
997
|
rb_define_method(cView, "find_children", RUBY_METHOD_FUNC(find_children), -1);
|
637
998
|
rb_define_method(cView, "each_child", RUBY_METHOD_FUNC(each_child), 0);
|
999
|
+
|
638
1000
|
rb_define_method(cView, "add_style", RUBY_METHOD_FUNC(add_style), 1);
|
639
1001
|
rb_define_method(cView, "remove_style", RUBY_METHOD_FUNC(remove_style), 1);
|
640
1002
|
rb_define_method(cView, "get_style", RUBY_METHOD_FUNC(get_style), 1);
|
641
1003
|
rb_define_method(cView, "find_styles", RUBY_METHOD_FUNC(find_styles), -1);
|
642
1004
|
rb_define_method(cView, "each_style", RUBY_METHOD_FUNC(each_style), 0);
|
643
|
-
|
644
|
-
rb_define_method(cView, "
|
645
|
-
cView
|
646
|
-
rb_define_method(cView, "
|
647
|
-
rb_define_method(cView, "
|
648
|
-
rb_define_method(cView, "
|
649
|
-
rb_define_method(cView, "
|
650
|
-
rb_define_method(cView, "
|
651
|
-
|
652
|
-
rb_define_method(cView, "
|
653
|
-
rb_define_method(cView, "
|
654
|
-
|
655
|
-
rb_define_method(cView, "
|
656
|
-
rb_define_method(cView, "
|
657
|
-
|
658
|
-
|
659
|
-
rb_define_method(cView, "
|
660
|
-
rb_define_method(cView, "zoom", RUBY_METHOD_FUNC(get_zoom), 0);
|
1005
|
+
|
1006
|
+
rb_define_method(cView, "shape=", RUBY_METHOD_FUNC(set_shape), 1);
|
1007
|
+
rb_define_method(cView, "shape", RUBY_METHOD_FUNC(get_shape), 0);
|
1008
|
+
rb_define_method(cView, "add_shape", RUBY_METHOD_FUNC(add_shape), 1);
|
1009
|
+
rb_define_method(cView, "remove_shape", RUBY_METHOD_FUNC(remove_shape), 1);
|
1010
|
+
rb_define_method(cView, "clear_shapes", RUBY_METHOD_FUNC(clear_shapes), 0);
|
1011
|
+
rb_define_method(cView, "find_shapes", RUBY_METHOD_FUNC(find_shapes), -1);
|
1012
|
+
rb_define_method(cView, "each_shape", RUBY_METHOD_FUNC(each_shape), 0);
|
1013
|
+
|
1014
|
+
rb_define_method(cView, "filter=", RUBY_METHOD_FUNC(set_filter), 1);
|
1015
|
+
rb_define_method(cView, "filter", RUBY_METHOD_FUNC(get_filter), 0);
|
1016
|
+
|
1017
|
+
rb_define_method(cView, "frame=", RUBY_METHOD_FUNC(set_frame), -1);
|
1018
|
+
rb_define_method(cView, "frame", RUBY_METHOD_FUNC(get_frame), 0);
|
1019
|
+
rb_define_method(cView, "content_bounds", RUBY_METHOD_FUNC(content_bounds), 0);
|
1020
|
+
rb_define_method(cView, "fit_to_content", RUBY_METHOD_FUNC(fit_to_content), 0);
|
1021
|
+
rb_define_method(cView, "angle=", RUBY_METHOD_FUNC(set_angle), 1);
|
661
1022
|
rb_define_method(cView, "angle", RUBY_METHOD_FUNC(get_angle), 0);
|
662
1023
|
rb_define_method(cView, "scroll_to", RUBY_METHOD_FUNC(scroll_to), -1);
|
663
1024
|
rb_define_method(cView, "scroll_by", RUBY_METHOD_FUNC(scroll_by), -1);
|
664
1025
|
rb_define_method(cView, "scroll", RUBY_METHOD_FUNC(get_scroll), 0);
|
665
|
-
rb_define_method(cView, "
|
666
|
-
rb_define_method(cView, "
|
1026
|
+
rb_define_method(cView, "zoom=", RUBY_METHOD_FUNC(set_zoom), 1);
|
1027
|
+
rb_define_method(cView, "zoom", RUBY_METHOD_FUNC(get_zoom), 0);
|
1028
|
+
rb_define_method(cView, "capture=", RUBY_METHOD_FUNC(set_capture), 1);
|
1029
|
+
rb_define_method(cView, "capture", RUBY_METHOD_FUNC(get_capture), 0);
|
1030
|
+
rb_define_method(cView, "clip=", RUBY_METHOD_FUNC(set_clip), 1);
|
1031
|
+
cView.define_method("clip?", get_clip);
|
1032
|
+
rb_define_method(cView, "cache=", RUBY_METHOD_FUNC(set_cache), 1);
|
1033
|
+
cView.define_method("cache?", get_cache);
|
1034
|
+
rb_define_method(cView, "resize_to_fit=", RUBY_METHOD_FUNC(set_resize_to_fit), 1);
|
1035
|
+
cView.define_method("resize_to_fit?", get_resize_to_fit);
|
1036
|
+
rb_define_method(cView, "scroll_to_fit=", RUBY_METHOD_FUNC(set_scroll_to_fit), 1);
|
1037
|
+
cView.define_method("scroll_to_fit?", get_scroll_to_fit);
|
667
1038
|
rb_define_method(cView, "parent", RUBY_METHOD_FUNC(parent), 0);
|
668
1039
|
rb_define_method(cView, "window", RUBY_METHOD_FUNC(window), 0);
|
669
|
-
|
1040
|
+
|
1041
|
+
rb_define_method(cView, "apply_force", RUBY_METHOD_FUNC(apply_force), -1);
|
1042
|
+
rb_define_method(cView, "apply_torque", RUBY_METHOD_FUNC(apply_torque), 1);
|
1043
|
+
rb_define_method(cView, "apply_linear_impulse", RUBY_METHOD_FUNC(apply_linear_impulse), -1);
|
1044
|
+
rb_define_method(cView, "apply_angular_impulse", RUBY_METHOD_FUNC(apply_angular_impulse), 1);
|
1045
|
+
rb_define_method(cView, "static=", RUBY_METHOD_FUNC(set_static), 1);
|
1046
|
+
cView.define_method("static?", is_static);
|
1047
|
+
rb_define_method(cView, "dynamic=", RUBY_METHOD_FUNC(set_dynamic), 1);
|
1048
|
+
cView.define_method("dynamic?", is_dynamic);
|
1049
|
+
rb_define_method(cView, "density=", RUBY_METHOD_FUNC(set_density), 1);
|
1050
|
+
rb_define_method(cView, "density", RUBY_METHOD_FUNC(get_density), 0);
|
1051
|
+
rb_define_method(cView, "friction=", RUBY_METHOD_FUNC(set_friction), 1);
|
1052
|
+
rb_define_method(cView, "friction", RUBY_METHOD_FUNC(get_friction), 0);
|
1053
|
+
rb_define_method(cView, "restitution=", RUBY_METHOD_FUNC(set_restitution), 1);
|
1054
|
+
rb_define_method(cView, "restitution", RUBY_METHOD_FUNC(get_restitution), 0);
|
1055
|
+
rb_define_method(cView, "sensor=", RUBY_METHOD_FUNC(set_sensor), 1);
|
1056
|
+
cView.define_method("sensor?", is_sensor);
|
1057
|
+
rb_define_private_method(cView, "set_category_bits", RUBY_METHOD_FUNC(set_category_bits), 1);
|
1058
|
+
rb_define_private_method(cView, "get_category_bits", RUBY_METHOD_FUNC(get_category_bits), 0);
|
1059
|
+
rb_define_private_method(cView, "set_collision_mask", RUBY_METHOD_FUNC(set_collision_mask), 1);
|
1060
|
+
rb_define_private_method(cView, "get_collision_mask", RUBY_METHOD_FUNC(get_collision_mask), 0);
|
1061
|
+
rb_define_method(cView, "linear_velocity=", RUBY_METHOD_FUNC(set_linear_velocity), -1);
|
1062
|
+
rb_define_method(cView, "linear_velocity", RUBY_METHOD_FUNC(get_linear_velocity), 0);
|
1063
|
+
rb_define_method(cView, "angular_velocity=", RUBY_METHOD_FUNC(set_angular_velocity), 1);
|
1064
|
+
rb_define_method(cView, "angular_velocity", RUBY_METHOD_FUNC(get_angular_velocity), 0);
|
1065
|
+
rb_define_method(cView, "gravity_scale=", RUBY_METHOD_FUNC(set_gravity_scale), 1);
|
1066
|
+
rb_define_method(cView, "gravity_scale", RUBY_METHOD_FUNC(get_gravity_scale), 0);
|
1067
|
+
|
1068
|
+
rb_define_method(cView, "update_physics", RUBY_METHOD_FUNC(update_physics), -1);
|
670
1069
|
rb_define_method(cView, "meter2pixel", RUBY_METHOD_FUNC(meter2pixel), -1);
|
671
|
-
rb_define_method(cView, "
|
1070
|
+
rb_define_method(cView, "gravity=", RUBY_METHOD_FUNC(set_gravity), -1);
|
672
1071
|
rb_define_method(cView, "gravity", RUBY_METHOD_FUNC(get_gravity), 0);
|
1072
|
+
rb_define_method(cView, "time_scale=", RUBY_METHOD_FUNC(set_time_scale), 1);
|
1073
|
+
rb_define_method(cView, "time_scale", RUBY_METHOD_FUNC(get_time_scale), 0);
|
673
1074
|
rb_define_method(cView, "wall", RUBY_METHOD_FUNC(wall), 0);
|
674
1075
|
rb_define_method(cView, "debug=", RUBY_METHOD_FUNC(set_debug), 1);
|
675
|
-
cView.define_method("debug?",
|
1076
|
+
cView.define_method("debug?", get_debug);
|
1077
|
+
|
676
1078
|
rb_define_method(cView, "on_attach", RUBY_METHOD_FUNC(on_attach), 1);
|
677
1079
|
rb_define_method(cView, "on_detach", RUBY_METHOD_FUNC(on_detach), 1);
|
678
1080
|
rb_define_method(cView, "on_show", RUBY_METHOD_FUNC(on_show), 1);
|
@@ -684,7 +1086,6 @@ Init_view ()
|
|
684
1086
|
rb_define_method(cView, "on_rotate", RUBY_METHOD_FUNC(on_rotate), 1);
|
685
1087
|
rb_define_method(cView, "on_scroll", RUBY_METHOD_FUNC(on_scroll), 1);
|
686
1088
|
rb_define_method(cView, "on_focus", RUBY_METHOD_FUNC(on_focus), 1);
|
687
|
-
rb_define_method(cView, "on_blur", RUBY_METHOD_FUNC(on_blur), 1);
|
688
1089
|
rb_define_method(cView, "on_key", RUBY_METHOD_FUNC(on_key), 1);
|
689
1090
|
rb_define_method(cView, "on_key_down", RUBY_METHOD_FUNC(on_key_down), 1);
|
690
1091
|
rb_define_method(cView, "on_key_up", RUBY_METHOD_FUNC(on_key_up), 1);
|
@@ -694,14 +1095,17 @@ Init_view ()
|
|
694
1095
|
rb_define_method(cView, "on_pointer_move", RUBY_METHOD_FUNC(on_pointer_move), 1);
|
695
1096
|
rb_define_method(cView, "on_wheel", RUBY_METHOD_FUNC(on_wheel), 1);
|
696
1097
|
rb_define_method(cView, "on_capture", RUBY_METHOD_FUNC(on_capture), 1);
|
697
|
-
rb_define_method(cView, "
|
698
|
-
|
699
|
-
|
700
|
-
cView.
|
701
|
-
|
702
|
-
cView.define_const("
|
703
|
-
cView.define_const("
|
704
|
-
|
1098
|
+
rb_define_method(cView, "on_timer", RUBY_METHOD_FUNC(on_timer), 1);
|
1099
|
+
cView.define_private_method("call_contact!", on_contact);
|
1100
|
+
cView.define_private_method("call_contact_begin!", on_contact_begin);
|
1101
|
+
cView.define_private_method("call_contact_end!", on_contact_end);
|
1102
|
+
|
1103
|
+
cView.define_const("CAPTURE_NONE", Reflex::View::CAPTURE_NONE);
|
1104
|
+
cView.define_const("CAPTURE_KEY", Reflex::View::CAPTURE_KEY);
|
1105
|
+
cView.define_const("CAPTURE_POINTER", Reflex::View::CAPTURE_POINTER);
|
1106
|
+
cView.define_const("CAPTURE_ALL", Reflex::View::CAPTURE_ALL);
|
1107
|
+
|
1108
|
+
define_selector_methods<Reflex::View>(cView);
|
705
1109
|
}
|
706
1110
|
|
707
1111
|
|