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