reflexion 0.1.12 → 0.1.13
Sign up to get free protection for your applications and to get access to all the features.
- 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/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>
|
@@ -77,6 +77,59 @@ RUCY_DEF0(redraw)
|
|
77
77
|
}
|
78
78
|
RUCY_END
|
79
79
|
|
80
|
+
static
|
81
|
+
RUCY_DEFN(focus)
|
82
|
+
{
|
83
|
+
CHECK;
|
84
|
+
check_arg_count(__FILE__, __LINE__, "View#focus", argc, 0, 1);
|
85
|
+
|
86
|
+
bool state = (argc >= 1) ? to<bool>(argv[0]) : true;
|
87
|
+
|
88
|
+
THIS->focus(state);
|
89
|
+
return self;
|
90
|
+
}
|
91
|
+
RUCY_END
|
92
|
+
|
93
|
+
static
|
94
|
+
RUCY_DEF0(blur)
|
95
|
+
{
|
96
|
+
CHECK;
|
97
|
+
THIS->blur();
|
98
|
+
return self;
|
99
|
+
}
|
100
|
+
RUCY_END
|
101
|
+
|
102
|
+
static
|
103
|
+
RUCY_DEF0(has_focus)
|
104
|
+
{
|
105
|
+
CHECK;
|
106
|
+
return value(THIS->has_focus());
|
107
|
+
}
|
108
|
+
RUCY_END
|
109
|
+
|
110
|
+
static
|
111
|
+
RUCY_DEFN(start_timer)
|
112
|
+
{
|
113
|
+
CHECK;
|
114
|
+
check_arg_count(__FILE__, __LINE__, "View#start_timer", argc, 1, 2);
|
115
|
+
|
116
|
+
Reflex::Timer* timer = THIS->start_timer(
|
117
|
+
to<float>(argv[0]),
|
118
|
+
argc >= 2 ? to<int>(argv[1]) : 1);
|
119
|
+
|
120
|
+
return value(timer);
|
121
|
+
}
|
122
|
+
RUCY_END
|
123
|
+
|
124
|
+
static
|
125
|
+
RUCY_DEF0(update_layout)
|
126
|
+
{
|
127
|
+
CHECK;
|
128
|
+
THIS->update_layout();
|
129
|
+
return self;
|
130
|
+
}
|
131
|
+
RUCY_END
|
132
|
+
|
80
133
|
static
|
81
134
|
RUCY_DEF1(add_child, child)
|
82
135
|
{
|
@@ -95,16 +148,25 @@ RUCY_DEF1(remove_child, child)
|
|
95
148
|
}
|
96
149
|
RUCY_END
|
97
150
|
|
151
|
+
static
|
152
|
+
RUCY_DEF0(clear_children)
|
153
|
+
{
|
154
|
+
CHECK;
|
155
|
+
THIS->clear_children();
|
156
|
+
return self;
|
157
|
+
}
|
158
|
+
RUCY_END
|
159
|
+
|
98
160
|
static
|
99
161
|
RUCY_DEFN(find_children)
|
100
162
|
{
|
101
163
|
CHECK;
|
102
164
|
check_arg_count(__FILE__, __LINE__, "View#find_children", argc, 1, 2);
|
103
165
|
|
104
|
-
bool recursive = (argc >= 2) ? to<bool>(argv[1]) :
|
166
|
+
bool recursive = (argc >= 2) ? to<bool>(argv[1]) : true;
|
105
167
|
|
106
|
-
Reflex::View::ChildList children
|
107
|
-
|
168
|
+
Reflex::View::ChildList children =
|
169
|
+
THIS->find_children(to<Reflex::Selector>(argv[0]), recursive);
|
108
170
|
return array(children.begin(), children.end());
|
109
171
|
}
|
110
172
|
RUCY_END
|
@@ -147,9 +209,9 @@ RUCY_DEF1(get_style, selector)
|
|
147
209
|
|
148
210
|
Reflex::Style* s = NULL;
|
149
211
|
if (selector)
|
150
|
-
s = THIS->get_style(to<Reflex::Selector>(selector)
|
212
|
+
s = THIS->get_style(to<Reflex::Selector>(selector));
|
151
213
|
else
|
152
|
-
s = THIS->style(
|
214
|
+
s = THIS->style();
|
153
215
|
|
154
216
|
return s ? value(*s) : nil();
|
155
217
|
}
|
@@ -163,8 +225,8 @@ RUCY_DEFN(find_styles)
|
|
163
225
|
|
164
226
|
bool recursive = (argc >= 2) ? to<bool>(argv[1]) : false;
|
165
227
|
|
166
|
-
Reflex::View::StyleList styles
|
167
|
-
|
228
|
+
Reflex::View::StyleList styles =
|
229
|
+
THIS->find_styles(to<Reflex::Selector>(argv[0]), recursive);
|
168
230
|
return array(styles.begin(), styles.end());
|
169
231
|
}
|
170
232
|
RUCY_END
|
@@ -182,143 +244,205 @@ RUCY_DEF0(each_style)
|
|
182
244
|
}
|
183
245
|
RUCY_END
|
184
246
|
|
247
|
+
static Reflex::Shape::Ref
|
248
|
+
to_shape (Value value)
|
249
|
+
{
|
250
|
+
if (value.is_nil())
|
251
|
+
return NULL;
|
252
|
+
|
253
|
+
if (value.is_kind_of(Rays::polygon_class()))
|
254
|
+
{
|
255
|
+
Reflex::PolygonShape* shape = new Reflex::PolygonShape();
|
256
|
+
shape->set_polygon(to<Rays::Polygon&>(value));
|
257
|
+
return shape;
|
258
|
+
}
|
259
|
+
else
|
260
|
+
return to<Reflex::Shape*>(value);
|
261
|
+
}
|
262
|
+
|
185
263
|
static
|
186
|
-
|
264
|
+
RUCY_DEF1(set_shape, shape)
|
187
265
|
{
|
188
266
|
CHECK;
|
189
|
-
|
190
|
-
|
191
|
-
|
267
|
+
THIS->set_shape(to_shape(shape));
|
268
|
+
return shape;
|
269
|
+
}
|
270
|
+
RUCY_END
|
192
271
|
|
193
|
-
|
194
|
-
|
272
|
+
static
|
273
|
+
RUCY_DEF0(get_shape)
|
274
|
+
{
|
275
|
+
CHECK;
|
276
|
+
return value(THIS->shape());
|
195
277
|
}
|
196
278
|
RUCY_END
|
197
279
|
|
198
280
|
static
|
199
|
-
|
281
|
+
RUCY_DEF1(add_shape, shape)
|
200
282
|
{
|
201
283
|
CHECK;
|
202
|
-
THIS->
|
203
|
-
return
|
284
|
+
THIS->add_shape(to_shape(shape));
|
285
|
+
return shape;
|
204
286
|
}
|
205
287
|
RUCY_END
|
206
288
|
|
207
289
|
static
|
208
|
-
|
290
|
+
RUCY_DEF1(remove_shape, shape)
|
209
291
|
{
|
210
292
|
CHECK;
|
211
|
-
|
293
|
+
THIS->remove_shape(to<Reflex::Shape*>(shape));
|
294
|
+
return shape;
|
212
295
|
}
|
213
296
|
RUCY_END
|
214
297
|
|
215
298
|
static
|
216
|
-
RUCY_DEF0(
|
299
|
+
RUCY_DEF0(clear_shapes)
|
217
300
|
{
|
218
301
|
CHECK;
|
219
|
-
THIS->
|
302
|
+
THIS->clear_shapes();
|
220
303
|
return self;
|
221
304
|
}
|
222
305
|
RUCY_END
|
223
306
|
|
224
307
|
static
|
225
|
-
|
308
|
+
RUCY_DEFN(find_shapes)
|
226
309
|
{
|
227
310
|
CHECK;
|
228
|
-
|
311
|
+
check_arg_count(__FILE__, __LINE__, "View#find_shapes", argc, 1);
|
312
|
+
|
313
|
+
Reflex::View::ShapeList shapes =
|
314
|
+
THIS->find_shapes(to<Reflex::Selector>(argv[0]));
|
315
|
+
return array(shapes.begin(), shapes.end());
|
229
316
|
}
|
230
317
|
RUCY_END
|
231
318
|
|
232
319
|
static
|
233
|
-
RUCY_DEF0(
|
320
|
+
RUCY_DEF0(each_shape)
|
234
321
|
{
|
235
322
|
CHECK;
|
236
|
-
|
323
|
+
|
324
|
+
Value ret;
|
325
|
+
Reflex::View::shape_iterator end = THIS->shape_end();
|
326
|
+
for (Reflex::View::shape_iterator it = THIS->shape_begin(); it != end; ++it)
|
327
|
+
ret = rb_yield(value(it->get()));
|
328
|
+
return ret;
|
237
329
|
}
|
238
330
|
RUCY_END
|
239
331
|
|
240
332
|
static
|
241
|
-
|
333
|
+
RUCY_DEF1(set_filter, filter)
|
242
334
|
{
|
243
335
|
CHECK;
|
244
|
-
THIS->
|
336
|
+
THIS->set_filter(filter ? to<Reflex::Filter*>(filter) : NULL);
|
337
|
+
return filter;
|
245
338
|
}
|
246
339
|
RUCY_END
|
247
340
|
|
248
341
|
static
|
249
|
-
|
342
|
+
RUCY_DEF0(get_filter)
|
250
343
|
{
|
251
344
|
CHECK;
|
252
|
-
THIS->
|
345
|
+
return value(THIS->filter());
|
253
346
|
}
|
254
347
|
RUCY_END
|
255
348
|
|
256
349
|
static
|
257
|
-
|
350
|
+
RUCY_DEFN(set_frame)
|
258
351
|
{
|
259
352
|
CHECK;
|
260
|
-
|
353
|
+
THIS->set_frame(to<Rays::Bounds>(argc, argv));
|
354
|
+
return value(THIS->frame());
|
261
355
|
}
|
262
356
|
RUCY_END
|
263
357
|
|
264
358
|
static
|
265
|
-
|
359
|
+
RUCY_DEF0(get_frame)
|
266
360
|
{
|
267
361
|
CHECK;
|
268
|
-
THIS->
|
362
|
+
return value(THIS->frame());
|
269
363
|
}
|
270
364
|
RUCY_END
|
271
365
|
|
272
366
|
static
|
273
|
-
|
367
|
+
RUCY_DEF0(content_bounds)
|
274
368
|
{
|
275
369
|
CHECK;
|
276
|
-
|
370
|
+
return value(CALL(content_bounds()));
|
277
371
|
}
|
278
372
|
RUCY_END
|
279
373
|
|
280
374
|
static
|
281
|
-
RUCY_DEF0(
|
375
|
+
RUCY_DEF0(fit_to_content)
|
282
376
|
{
|
283
377
|
CHECK;
|
378
|
+
THIS->fit_to_content();
|
379
|
+
return self;
|
380
|
+
}
|
381
|
+
RUCY_END
|
284
382
|
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
383
|
+
static
|
384
|
+
RUCY_DEF1(set_angle, degree)
|
385
|
+
{
|
386
|
+
CHECK;
|
387
|
+
THIS->set_angle(to<float>(degree));
|
388
|
+
return degree;
|
290
389
|
}
|
291
390
|
RUCY_END
|
292
391
|
|
293
392
|
static
|
294
|
-
|
393
|
+
RUCY_DEF0(get_angle)
|
295
394
|
{
|
296
395
|
CHECK;
|
297
|
-
THIS->
|
396
|
+
return value(THIS->angle());
|
298
397
|
}
|
299
398
|
RUCY_END
|
300
399
|
|
301
400
|
static
|
302
|
-
|
401
|
+
RUCY_DEFN(scroll_to)
|
303
402
|
{
|
304
403
|
CHECK;
|
305
|
-
|
404
|
+
check_arg_count(__FILE__, __LINE__, "View#scroll_to", argc, 1, 2, 3);
|
405
|
+
|
406
|
+
if (argv[0].is_kind_of(Rays::point_class()))
|
407
|
+
THIS->scroll_to(to<Rays::Point&>(argv[0]));
|
408
|
+
else
|
409
|
+
{
|
410
|
+
const Rays::Point& p = THIS->scroll();
|
411
|
+
coord x = (argc >= 1 && argv[0]) ? to<coord>(argv[0]) : p.x;
|
412
|
+
coord y = (argc >= 2 && argv[1]) ? to<coord>(argv[1]) : p.y;
|
413
|
+
coord z = (argc >= 3 && argv[2]) ? to<coord>(argv[2]) : p.z;
|
414
|
+
THIS->scroll_to(x, y, z);
|
415
|
+
}
|
416
|
+
|
417
|
+
return self;
|
306
418
|
}
|
307
419
|
RUCY_END
|
308
420
|
|
309
421
|
static
|
310
|
-
|
422
|
+
RUCY_DEFN(scroll_by)
|
311
423
|
{
|
312
424
|
CHECK;
|
313
|
-
|
425
|
+
check_arg_count(__FILE__, __LINE__, "View#scroll_by", argc, 1, 2, 3);
|
426
|
+
|
427
|
+
if (argv[0].is_kind_of(Rays::point_class()))
|
428
|
+
THIS->scroll_by(to<Rays::Point&>(argv[0]));
|
429
|
+
else
|
430
|
+
{
|
431
|
+
coord x = (argc >= 1 && argv[0]) ? to<coord>(argv[0]) : 0;
|
432
|
+
coord y = (argc >= 2 && argv[1]) ? to<coord>(argv[1]) : 0;
|
433
|
+
coord z = (argc >= 3 && argv[2]) ? to<coord>(argv[2]) : 0;
|
434
|
+
THIS->scroll_by(x, y, z);
|
435
|
+
}
|
436
|
+
|
437
|
+
return self;
|
314
438
|
}
|
315
439
|
RUCY_END
|
316
440
|
|
317
441
|
static
|
318
|
-
RUCY_DEF0(
|
442
|
+
RUCY_DEF0(get_scroll)
|
319
443
|
{
|
320
444
|
CHECK;
|
321
|
-
return value(THIS->
|
445
|
+
return value(THIS->scroll());
|
322
446
|
}
|
323
447
|
RUCY_END
|
324
448
|
|
@@ -327,6 +451,7 @@ RUCY_DEF1(set_zoom, zoom)
|
|
327
451
|
{
|
328
452
|
CHECK;
|
329
453
|
THIS->set_zoom(to<float>(zoom));
|
454
|
+
return zoom;
|
330
455
|
}
|
331
456
|
RUCY_END
|
332
457
|
|
@@ -339,75 +464,107 @@ RUCY_DEF0(get_zoom)
|
|
339
464
|
RUCY_END
|
340
465
|
|
341
466
|
static
|
342
|
-
|
467
|
+
RUCY_DEF1(set_capture, types)
|
343
468
|
{
|
344
469
|
CHECK;
|
345
|
-
|
470
|
+
THIS->set_capture(to<uint>(types));
|
471
|
+
return types;
|
346
472
|
}
|
347
473
|
RUCY_END
|
348
474
|
|
349
475
|
static
|
350
|
-
|
476
|
+
RUCY_DEF0(get_capture)
|
351
477
|
{
|
352
478
|
CHECK;
|
353
|
-
THIS->
|
479
|
+
return value(THIS->capture());
|
354
480
|
}
|
355
481
|
RUCY_END
|
356
482
|
|
357
483
|
static
|
358
|
-
|
484
|
+
RUCY_DEF1(set_clip, clip)
|
359
485
|
{
|
360
486
|
CHECK;
|
361
|
-
|
487
|
+
|
488
|
+
if (clip)
|
489
|
+
THIS-> add_flag(Reflex::View::FLAG_CLIP);
|
490
|
+
else
|
491
|
+
THIS->remove_flag(Reflex::View::FLAG_CLIP);
|
492
|
+
|
493
|
+
return clip;
|
362
494
|
}
|
363
495
|
RUCY_END
|
364
496
|
|
365
497
|
static
|
366
|
-
|
498
|
+
RUCY_DEF0(get_clip)
|
367
499
|
{
|
368
500
|
CHECK;
|
369
|
-
|
501
|
+
return value(THIS->has_flag(Reflex::View::FLAG_CLIP));
|
502
|
+
}
|
503
|
+
RUCY_END
|
370
504
|
|
371
|
-
|
372
|
-
|
505
|
+
static
|
506
|
+
RUCY_DEF1(set_cache, cache)
|
507
|
+
{
|
508
|
+
CHECK;
|
509
|
+
|
510
|
+
if (cache)
|
511
|
+
THIS-> add_flag(Reflex::View::FLAG_CACHE);
|
373
512
|
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
|
-
}
|
513
|
+
THIS->remove_flag(Reflex::View::FLAG_CACHE);
|
381
514
|
|
382
|
-
return
|
515
|
+
return cache;
|
383
516
|
}
|
384
517
|
RUCY_END
|
385
518
|
|
386
519
|
static
|
387
|
-
|
520
|
+
RUCY_DEF0(get_cache)
|
388
521
|
{
|
389
522
|
CHECK;
|
390
|
-
|
523
|
+
return value(THIS->has_flag(Reflex::View::FLAG_CACHE));
|
524
|
+
}
|
525
|
+
RUCY_END
|
391
526
|
|
392
|
-
|
393
|
-
|
527
|
+
static
|
528
|
+
RUCY_DEF1(set_resize_to_fit, resize)
|
529
|
+
{
|
530
|
+
CHECK;
|
531
|
+
|
532
|
+
if (resize)
|
533
|
+
THIS-> add_flag(Reflex::View::FLAG_RESIZE_TO_FIT);
|
394
534
|
else
|
395
|
-
|
396
|
-
coord x = (argc >= 1 && argv[0]) ? to<coord>(argv[0]) : 0;
|
397
|
-
coord y = (argc >= 2 && argv[1]) ? to<coord>(argv[1]) : 0;
|
398
|
-
coord z = (argc >= 3 && argv[2]) ? to<coord>(argv[2]) : 0;
|
399
|
-
THIS->scroll_by(x, y, z);
|
400
|
-
}
|
535
|
+
THIS->remove_flag(Reflex::View::FLAG_RESIZE_TO_FIT);
|
401
536
|
|
402
|
-
return
|
537
|
+
return resize;
|
403
538
|
}
|
404
539
|
RUCY_END
|
405
540
|
|
406
541
|
static
|
407
|
-
RUCY_DEF0(
|
542
|
+
RUCY_DEF0(get_resize_to_fit)
|
408
543
|
{
|
409
544
|
CHECK;
|
410
|
-
return value(THIS->
|
545
|
+
return value(THIS->has_flag(Reflex::View::FLAG_RESIZE_TO_FIT));
|
546
|
+
}
|
547
|
+
RUCY_END
|
548
|
+
|
549
|
+
static
|
550
|
+
RUCY_DEF1(set_scroll_to_fit, scroll)
|
551
|
+
{
|
552
|
+
CHECK;
|
553
|
+
|
554
|
+
if (scroll)
|
555
|
+
THIS-> add_flag(Reflex::View::FLAG_SCROLL_TO_FIT);
|
556
|
+
else
|
557
|
+
THIS->remove_flag(Reflex::View::FLAG_SCROLL_TO_FIT);
|
558
|
+
|
559
|
+
return scroll;
|
560
|
+
}
|
561
|
+
RUCY_END
|
562
|
+
|
563
|
+
static
|
564
|
+
RUCY_DEF0(get_scroll_to_fit)
|
565
|
+
{
|
566
|
+
CHECK;
|
567
|
+
return value(THIS->has_flag(Reflex::View::FLAG_SCROLL_TO_FIT));
|
411
568
|
}
|
412
569
|
RUCY_END
|
413
570
|
|
@@ -428,10 +585,237 @@ RUCY_DEF0(window)
|
|
428
585
|
RUCY_END
|
429
586
|
|
430
587
|
static
|
431
|
-
|
588
|
+
RUCY_DEFN(apply_force)
|
589
|
+
{
|
590
|
+
CHECK;
|
591
|
+
THIS->apply_force(to<Rays::Point>(argc, argv));
|
592
|
+
return self;
|
593
|
+
}
|
594
|
+
RUCY_END
|
595
|
+
|
596
|
+
static
|
597
|
+
RUCY_DEF1(apply_torque, torque)
|
432
598
|
{
|
433
599
|
CHECK;
|
434
|
-
|
600
|
+
THIS->apply_torque(to<float>(torque));
|
601
|
+
return self;
|
602
|
+
}
|
603
|
+
RUCY_END
|
604
|
+
|
605
|
+
static
|
606
|
+
RUCY_DEFN(apply_linear_impulse)
|
607
|
+
{
|
608
|
+
CHECK;
|
609
|
+
THIS->apply_linear_impulse(to<Rays::Point>(argc, argv));
|
610
|
+
return self;
|
611
|
+
}
|
612
|
+
RUCY_END
|
613
|
+
|
614
|
+
static
|
615
|
+
RUCY_DEF1(apply_angular_impulse, impulse)
|
616
|
+
{
|
617
|
+
CHECK;
|
618
|
+
THIS->apply_angular_impulse(to<float>(impulse));
|
619
|
+
return self;
|
620
|
+
}
|
621
|
+
RUCY_END
|
622
|
+
|
623
|
+
static
|
624
|
+
RUCY_DEF1(set_static, state)
|
625
|
+
{
|
626
|
+
CHECK;
|
627
|
+
THIS->set_static(state);
|
628
|
+
return state;
|
629
|
+
}
|
630
|
+
RUCY_END
|
631
|
+
|
632
|
+
static
|
633
|
+
RUCY_DEF0(is_static)
|
634
|
+
{
|
635
|
+
CHECK;
|
636
|
+
return value(THIS->is_static());
|
637
|
+
}
|
638
|
+
RUCY_END
|
639
|
+
|
640
|
+
static
|
641
|
+
RUCY_DEF1(set_dynamic, state)
|
642
|
+
{
|
643
|
+
CHECK;
|
644
|
+
THIS->set_dynamic(state);
|
645
|
+
return state;
|
646
|
+
}
|
647
|
+
RUCY_END
|
648
|
+
|
649
|
+
static
|
650
|
+
RUCY_DEF0(is_dynamic)
|
651
|
+
{
|
652
|
+
CHECK;
|
653
|
+
return value(THIS->is_dynamic());
|
654
|
+
}
|
655
|
+
RUCY_END
|
656
|
+
|
657
|
+
static
|
658
|
+
RUCY_DEF1(set_density, density)
|
659
|
+
{
|
660
|
+
CHECK;
|
661
|
+
THIS->set_density(to<float>(density));
|
662
|
+
return density;
|
663
|
+
}
|
664
|
+
RUCY_END
|
665
|
+
|
666
|
+
static
|
667
|
+
RUCY_DEF0(get_density)
|
668
|
+
{
|
669
|
+
CHECK;
|
670
|
+
return value(THIS->density());
|
671
|
+
}
|
672
|
+
RUCY_END
|
673
|
+
|
674
|
+
static
|
675
|
+
RUCY_DEF1(set_friction, friction)
|
676
|
+
{
|
677
|
+
CHECK;
|
678
|
+
THIS->set_friction(to<float>(friction));
|
679
|
+
return friction;
|
680
|
+
}
|
681
|
+
RUCY_END
|
682
|
+
|
683
|
+
static
|
684
|
+
RUCY_DEF0(get_friction)
|
685
|
+
{
|
686
|
+
CHECK;
|
687
|
+
return value(THIS->friction());
|
688
|
+
}
|
689
|
+
RUCY_END
|
690
|
+
|
691
|
+
static
|
692
|
+
RUCY_DEF1(set_restitution, restitution)
|
693
|
+
{
|
694
|
+
CHECK;
|
695
|
+
THIS->set_restitution(to<float>(restitution));
|
696
|
+
return restitution;
|
697
|
+
}
|
698
|
+
RUCY_END
|
699
|
+
|
700
|
+
static
|
701
|
+
RUCY_DEF0(get_restitution)
|
702
|
+
{
|
703
|
+
CHECK;
|
704
|
+
return value(THIS->restitution());
|
705
|
+
}
|
706
|
+
RUCY_END
|
707
|
+
|
708
|
+
static
|
709
|
+
RUCY_DEF1(set_sensor, state)
|
710
|
+
{
|
711
|
+
CHECK;
|
712
|
+
THIS->set_sensor(state);
|
713
|
+
return state;
|
714
|
+
}
|
715
|
+
RUCY_END
|
716
|
+
|
717
|
+
static
|
718
|
+
RUCY_DEF0(is_sensor)
|
719
|
+
{
|
720
|
+
CHECK;
|
721
|
+
return value(THIS->is_sensor());
|
722
|
+
}
|
723
|
+
RUCY_END
|
724
|
+
|
725
|
+
static
|
726
|
+
RUCY_DEF1(set_category_bits, bits)
|
727
|
+
{
|
728
|
+
CHECK;
|
729
|
+
THIS->set_category_bits(to<uint>(bits));
|
730
|
+
return bits;
|
731
|
+
}
|
732
|
+
RUCY_END
|
733
|
+
|
734
|
+
static
|
735
|
+
RUCY_DEF0(get_category_bits)
|
736
|
+
{
|
737
|
+
CHECK;
|
738
|
+
return value(THIS->category_bits());
|
739
|
+
}
|
740
|
+
RUCY_END
|
741
|
+
|
742
|
+
static
|
743
|
+
RUCY_DEF1(set_collision_mask, mask)
|
744
|
+
{
|
745
|
+
CHECK;
|
746
|
+
THIS->set_collision_mask(to<uint>(mask));
|
747
|
+
return mask;
|
748
|
+
}
|
749
|
+
RUCY_END
|
750
|
+
|
751
|
+
static
|
752
|
+
RUCY_DEF0(get_collision_mask)
|
753
|
+
{
|
754
|
+
CHECK;
|
755
|
+
return value(THIS->collision_mask());
|
756
|
+
}
|
757
|
+
RUCY_END
|
758
|
+
|
759
|
+
static
|
760
|
+
RUCY_DEFN(set_linear_velocity)
|
761
|
+
{
|
762
|
+
CHECK;
|
763
|
+
THIS->set_linear_velocity(to<Rays::Point>(argc, argv));
|
764
|
+
return value(THIS->linear_velocity());
|
765
|
+
}
|
766
|
+
RUCY_END
|
767
|
+
|
768
|
+
static
|
769
|
+
RUCY_DEF0(get_linear_velocity)
|
770
|
+
{
|
771
|
+
CHECK;
|
772
|
+
return value(THIS->linear_velocity());
|
773
|
+
}
|
774
|
+
RUCY_END
|
775
|
+
|
776
|
+
static
|
777
|
+
RUCY_DEF1(set_angular_velocity, velocity)
|
778
|
+
{
|
779
|
+
CHECK;
|
780
|
+
THIS->set_angular_velocity(to<float>(velocity));
|
781
|
+
return velocity;
|
782
|
+
}
|
783
|
+
RUCY_END
|
784
|
+
|
785
|
+
static
|
786
|
+
RUCY_DEF0(get_angular_velocity)
|
787
|
+
{
|
788
|
+
CHECK;
|
789
|
+
return value(THIS->angular_velocity());
|
790
|
+
}
|
791
|
+
RUCY_END
|
792
|
+
|
793
|
+
static
|
794
|
+
RUCY_DEF1(set_gravity_scale, scale)
|
795
|
+
{
|
796
|
+
CHECK;
|
797
|
+
THIS->set_gravity_scale(to<float>(scale));
|
798
|
+
return scale;
|
799
|
+
}
|
800
|
+
RUCY_END
|
801
|
+
|
802
|
+
static
|
803
|
+
RUCY_DEF0(get_gravity_scale)
|
804
|
+
{
|
805
|
+
CHECK;
|
806
|
+
return value(THIS->gravity_scale());
|
807
|
+
}
|
808
|
+
RUCY_END
|
809
|
+
|
810
|
+
static
|
811
|
+
RUCY_DEFN(update_physics)
|
812
|
+
{
|
813
|
+
CHECK;
|
814
|
+
check_arg_count(__FILE__, __LINE__, "View#update_physics", argc, 0, 1);
|
815
|
+
|
816
|
+
float duration = argc >= 1 ? to<float>(argv[0]) : 0;
|
817
|
+
THIS->update_physics(duration);
|
818
|
+
return self;
|
435
819
|
}
|
436
820
|
RUCY_END
|
437
821
|
|
@@ -441,18 +825,18 @@ RUCY_DEFN(meter2pixel)
|
|
441
825
|
CHECK;
|
442
826
|
check_arg_count(__FILE__, __LINE__, "View#meter2pixel", argc, 0, 1, 2);
|
443
827
|
|
444
|
-
float meter = argc >= 1 ? argv[0]
|
445
|
-
bool create_world = argc >= 2 ?
|
828
|
+
float meter = argc >= 1 ? to<float>(argv[0]) : 1;
|
829
|
+
bool create_world = argc >= 2 ? to<bool> (argv[1]) : true;
|
446
830
|
return value(THIS->meter2pixel(meter, create_world));
|
447
831
|
}
|
448
832
|
RUCY_END
|
449
833
|
|
450
834
|
static
|
451
|
-
|
835
|
+
RUCY_DEFN(set_gravity)
|
452
836
|
{
|
453
837
|
CHECK;
|
454
|
-
THIS->set_gravity(
|
455
|
-
return
|
838
|
+
THIS->set_gravity(to<Rays::Point>(argc, argv));
|
839
|
+
return value(THIS->gravity());
|
456
840
|
}
|
457
841
|
RUCY_END
|
458
842
|
|
@@ -464,6 +848,23 @@ RUCY_DEF0(get_gravity)
|
|
464
848
|
}
|
465
849
|
RUCY_END
|
466
850
|
|
851
|
+
static
|
852
|
+
RUCY_DEF1(set_time_scale, scale)
|
853
|
+
{
|
854
|
+
CHECK;
|
855
|
+
THIS->set_time_scale(to<float>(scale));
|
856
|
+
return scale;
|
857
|
+
}
|
858
|
+
RUCY_END
|
859
|
+
|
860
|
+
static
|
861
|
+
RUCY_DEF0(get_time_scale)
|
862
|
+
{
|
863
|
+
CHECK;
|
864
|
+
return value(THIS->time_scale());
|
865
|
+
}
|
866
|
+
RUCY_END
|
867
|
+
|
467
868
|
static
|
468
869
|
RUCY_DEF0(wall)
|
469
870
|
{
|
@@ -482,10 +883,10 @@ RUCY_DEF1(set_debug, state)
|
|
482
883
|
RUCY_END
|
483
884
|
|
484
885
|
static
|
485
|
-
RUCY_DEF0(
|
886
|
+
RUCY_DEF0(get_debug)
|
486
887
|
{
|
487
888
|
CHECK;
|
488
|
-
return value(THIS->
|
889
|
+
return value(THIS->debug());
|
489
890
|
}
|
490
891
|
RUCY_END
|
491
892
|
|
@@ -493,10 +894,6 @@ static
|
|
493
894
|
RUCY_DEF1(on_attach, event)
|
494
895
|
{
|
495
896
|
CHECK;
|
496
|
-
|
497
|
-
RUCY_SYM(call_attach_block);
|
498
|
-
self.call(call_attach_block);
|
499
|
-
|
500
897
|
CALL(on_attach(to<Reflex::Event*>(event)));
|
501
898
|
}
|
502
899
|
RUCY_END
|
@@ -581,14 +978,6 @@ RUCY_DEF1(on_focus, event)
|
|
581
978
|
}
|
582
979
|
RUCY_END
|
583
980
|
|
584
|
-
static
|
585
|
-
RUCY_DEF1(on_blur, event)
|
586
|
-
{
|
587
|
-
CHECK;
|
588
|
-
CALL(on_blur(to<Reflex::FocusEvent*>(event)));
|
589
|
-
}
|
590
|
-
RUCY_END
|
591
|
-
|
592
981
|
static
|
593
982
|
RUCY_DEF1(on_key, event)
|
594
983
|
{
|
@@ -661,6 +1050,14 @@ RUCY_DEF1(on_capture, event)
|
|
661
1050
|
}
|
662
1051
|
RUCY_END
|
663
1052
|
|
1053
|
+
static
|
1054
|
+
RUCY_DEF1(on_timer, event)
|
1055
|
+
{
|
1056
|
+
CHECK;
|
1057
|
+
CALL(on_timer(to<Reflex::TimerEvent*>(event)));
|
1058
|
+
}
|
1059
|
+
RUCY_END
|
1060
|
+
|
664
1061
|
static
|
665
1062
|
RUCY_DEF1(on_contact, event)
|
666
1063
|
{
|
@@ -685,9 +1082,6 @@ RUCY_DEF1(on_contact_end, event)
|
|
685
1082
|
}
|
686
1083
|
RUCY_END
|
687
1084
|
|
688
|
-
static
|
689
|
-
RUCY_DEF_clear_override_flags(cof, Reflex::View);
|
690
|
-
|
691
1085
|
|
692
1086
|
static Class cView;
|
693
1087
|
|
@@ -702,48 +1096,96 @@ Init_view ()
|
|
702
1096
|
cView.define_method("hide", hide);
|
703
1097
|
cView.define_method("hidden?", hidden);
|
704
1098
|
cView.define_method("redraw", redraw);
|
705
|
-
cView.define_method("
|
706
|
-
cView.define_method("
|
707
|
-
cView.define_method("
|
708
|
-
cView.
|
1099
|
+
cView.define_method("focus", focus);
|
1100
|
+
cView.define_method("blur", blur);
|
1101
|
+
cView.define_method("focus?", has_focus);
|
1102
|
+
cView.define_private_method("start_timer", start_timer);
|
1103
|
+
cView.define_method("update_layout", update_layout);
|
1104
|
+
|
1105
|
+
cView.define_method("add_child", add_child);
|
1106
|
+
cView.define_method("remove_child", remove_child);
|
1107
|
+
cView.define_method("clear_children", clear_children);
|
1108
|
+
cView.define_method("find_children", find_children);
|
1109
|
+
cView.define_method("each_child", each_child);
|
1110
|
+
|
709
1111
|
cView.define_method("add_style", add_style);
|
710
1112
|
cView.define_method("remove_style", remove_style);
|
711
1113
|
cView.define_method("get_style", get_style);
|
712
1114
|
cView.define_method("find_styles", find_styles);
|
713
1115
|
cView.define_method("each_style", each_style);
|
714
|
-
|
715
|
-
cView.define_method("
|
716
|
-
cView.define_method("
|
717
|
-
cView.define_method("
|
718
|
-
cView.define_method("
|
719
|
-
cView.define_method("
|
720
|
-
cView.define_method("
|
721
|
-
cView.define_method("
|
722
|
-
|
723
|
-
cView.define_method("
|
724
|
-
cView.define_method("
|
725
|
-
|
726
|
-
cView.define_method("
|
727
|
-
cView.define_method("
|
728
|
-
cView.
|
729
|
-
cView.
|
730
|
-
cView.define_method("
|
731
|
-
cView.define_method("zoom", get_zoom);
|
1116
|
+
|
1117
|
+
cView.define_method("shape=", set_shape);
|
1118
|
+
cView.define_method("shape", get_shape);
|
1119
|
+
cView.define_method("add_shape", add_shape);
|
1120
|
+
cView.define_method("remove_shape", remove_shape);
|
1121
|
+
cView.define_method("clear_shapes", clear_shapes);
|
1122
|
+
cView.define_method("find_shapes", find_shapes);
|
1123
|
+
cView.define_method("each_shape", each_shape);
|
1124
|
+
|
1125
|
+
cView.define_method("filter=", set_filter);
|
1126
|
+
cView.define_method("filter", get_filter);
|
1127
|
+
|
1128
|
+
cView.define_method("frame=", set_frame);
|
1129
|
+
cView.define_method("frame", get_frame);
|
1130
|
+
cView.define_method("content_bounds", content_bounds);
|
1131
|
+
cView.define_method("fit_to_content", fit_to_content);
|
1132
|
+
cView.define_method("angle=", set_angle);
|
732
1133
|
cView.define_method("angle", get_angle);
|
733
1134
|
cView.define_method("scroll_to", scroll_to);
|
734
1135
|
cView.define_method("scroll_by", scroll_by);
|
735
1136
|
cView.define_method("scroll", get_scroll);
|
736
|
-
cView.define_method("
|
737
|
-
cView.define_method("
|
1137
|
+
cView.define_method("zoom=", set_zoom);
|
1138
|
+
cView.define_method("zoom", get_zoom);
|
1139
|
+
cView.define_method("capture=", set_capture);
|
1140
|
+
cView.define_method("capture", get_capture);
|
1141
|
+
cView.define_method("clip=", set_clip);
|
1142
|
+
cView.define_method("clip?", get_clip);
|
1143
|
+
cView.define_method("cache=", set_cache);
|
1144
|
+
cView.define_method("cache?", get_cache);
|
1145
|
+
cView.define_method("resize_to_fit=", set_resize_to_fit);
|
1146
|
+
cView.define_method("resize_to_fit?", get_resize_to_fit);
|
1147
|
+
cView.define_method("scroll_to_fit=", set_scroll_to_fit);
|
1148
|
+
cView.define_method("scroll_to_fit?", get_scroll_to_fit);
|
738
1149
|
cView.define_method("parent", parent);
|
739
1150
|
cView.define_method("window", window);
|
740
|
-
|
1151
|
+
|
1152
|
+
cView.define_method("apply_force", apply_force);
|
1153
|
+
cView.define_method("apply_torque", apply_torque);
|
1154
|
+
cView.define_method("apply_linear_impulse", apply_linear_impulse);
|
1155
|
+
cView.define_method("apply_angular_impulse", apply_angular_impulse);
|
1156
|
+
cView.define_method("static=", set_static);
|
1157
|
+
cView.define_method("static?", is_static);
|
1158
|
+
cView.define_method("dynamic=", set_dynamic);
|
1159
|
+
cView.define_method("dynamic?", is_dynamic);
|
1160
|
+
cView.define_method("density=", set_density);
|
1161
|
+
cView.define_method("density", get_density);
|
1162
|
+
cView.define_method("friction=", set_friction);
|
1163
|
+
cView.define_method("friction", get_friction);
|
1164
|
+
cView.define_method("restitution=", set_restitution);
|
1165
|
+
cView.define_method("restitution", get_restitution);
|
1166
|
+
cView.define_method("sensor=", set_sensor);
|
1167
|
+
cView.define_method("sensor?", is_sensor);
|
1168
|
+
cView.define_private_method("set_category_bits", set_category_bits);
|
1169
|
+
cView.define_private_method("get_category_bits", get_category_bits);
|
1170
|
+
cView.define_private_method("set_collision_mask", set_collision_mask);
|
1171
|
+
cView.define_private_method("get_collision_mask", get_collision_mask);
|
1172
|
+
cView.define_method("linear_velocity=", set_linear_velocity);
|
1173
|
+
cView.define_method("linear_velocity", get_linear_velocity);
|
1174
|
+
cView.define_method("angular_velocity=", set_angular_velocity);
|
1175
|
+
cView.define_method("angular_velocity", get_angular_velocity);
|
1176
|
+
cView.define_method("gravity_scale=", set_gravity_scale);
|
1177
|
+
cView.define_method("gravity_scale", get_gravity_scale);
|
1178
|
+
|
1179
|
+
cView.define_method("update_physics", update_physics);
|
741
1180
|
cView.define_method("meter2pixel", meter2pixel);
|
742
|
-
cView.define_method("
|
743
|
-
cView.define_method("gravity",
|
1181
|
+
cView.define_method("gravity=", set_gravity);
|
1182
|
+
cView.define_method("gravity", get_gravity);
|
1183
|
+
cView.define_method("time_scale=", set_time_scale);
|
1184
|
+
cView.define_method("time_scale", get_time_scale);
|
744
1185
|
cView.define_method("wall", wall);
|
745
1186
|
cView.define_method("debug=", set_debug);
|
746
|
-
cView.define_method("debug?",
|
1187
|
+
cView.define_method("debug?", get_debug);
|
1188
|
+
|
747
1189
|
cView.define_method("on_attach", on_attach);
|
748
1190
|
cView.define_method("on_detach", on_detach);
|
749
1191
|
cView.define_method("on_show", on_show);
|
@@ -755,7 +1197,6 @@ Init_view ()
|
|
755
1197
|
cView.define_method("on_rotate", on_rotate);
|
756
1198
|
cView.define_method("on_scroll", on_scroll);
|
757
1199
|
cView.define_method("on_focus", on_focus);
|
758
|
-
cView.define_method("on_blur", on_blur);
|
759
1200
|
cView.define_method("on_key", on_key);
|
760
1201
|
cView.define_method("on_key_down", on_key_down);
|
761
1202
|
cView.define_method("on_key_up", on_key_up);
|
@@ -765,14 +1206,17 @@ Init_view ()
|
|
765
1206
|
cView.define_method("on_pointer_move", on_pointer_move);
|
766
1207
|
cView.define_method("on_wheel", on_wheel);
|
767
1208
|
cView.define_method("on_capture", on_capture);
|
768
|
-
cView.define_method("
|
769
|
-
cView.
|
770
|
-
cView.
|
771
|
-
cView.
|
772
|
-
|
773
|
-
cView.define_const("
|
774
|
-
cView.define_const("
|
775
|
-
cView.
|
1209
|
+
cView.define_method("on_timer", on_timer);
|
1210
|
+
cView.define_private_method("call_contact!", on_contact);
|
1211
|
+
cView.define_private_method("call_contact_begin!", on_contact_begin);
|
1212
|
+
cView.define_private_method("call_contact_end!", on_contact_end);
|
1213
|
+
|
1214
|
+
cView.define_const("CAPTURE_NONE", Reflex::View::CAPTURE_NONE);
|
1215
|
+
cView.define_const("CAPTURE_KEY", Reflex::View::CAPTURE_KEY);
|
1216
|
+
cView.define_const("CAPTURE_POINTER", Reflex::View::CAPTURE_POINTER);
|
1217
|
+
cView.define_const("CAPTURE_ALL", Reflex::View::CAPTURE_ALL);
|
1218
|
+
|
1219
|
+
define_selector_methods<Reflex::View>(cView);
|
776
1220
|
}
|
777
1221
|
|
778
1222
|
|