|
|
@@ -4,42 +4,42 @@ HelloPolycodeApp::HelloPolycodeApp(PolycodeView *view) {
|
|
|
|
|
|
core = new POLYCODE_CORE(view, 640,480,false,false,0,0,90);
|
|
|
|
|
|
- PhysicsScreen *screen = new PhysicsScreen(10, 50);
|
|
|
+ PhysicsScene *scene = new PhysicsScene(10, 50);
|
|
|
|
|
|
- ScreenShape *ceiling = new ScreenShape(ScreenShape::SHAPE_RECT, 640, 20);
|
|
|
+ ScenePrimitive *ceiling = new ScenePrimitive(ScenePrimitive::TYPE_VPLANE, 640, 20);
|
|
|
ceiling->setColor(0.0, 0.0, 0.0, 1.0);
|
|
|
- ceiling->setPosition(640/2, 10);
|
|
|
- screen->addPhysicsChild(ceiling, PhysicsScreenEntity::ENTITY_RECT, true);
|
|
|
+ ceiling->setPosition(0, 480/2-10);
|
|
|
+ scene->addPhysicsChild(ceiling, PhysicsScene2DEntity::ENTITY_RECT, true);
|
|
|
|
|
|
// Revolute Joint
|
|
|
- ScreenShape *shape = new ScreenShape(ScreenShape::SHAPE_RECT, 10, 30);
|
|
|
- shape->setPosition(150, 20+15);
|
|
|
- screen->addPhysicsChild(shape, PhysicsScreenEntity::ENTITY_RECT, false);
|
|
|
- screen->createRevoluteJoint(shape, ceiling, 0, -15);
|
|
|
- screen->applyImpulse(shape, 10, 0);
|
|
|
+ ScenePrimitive *shape = new ScenePrimitive(ScenePrimitive::TYPE_VPLANE, 10, 30);
|
|
|
+ shape->setPosition(-170, 205);
|
|
|
+ scene->addPhysicsChild(shape, PhysicsScene2DEntity::ENTITY_RECT, false);
|
|
|
+ scene->createRevoluteJoint(shape, ceiling, -640/2, 255);
|
|
|
+ scene->applyImpulse(shape, 10, 0);
|
|
|
|
|
|
// Distance Joint
|
|
|
- shape = new ScreenShape(ScreenShape::SHAPE_RECT, 10, 30);
|
|
|
- shape->setPosition(250, 20+25);
|
|
|
- screen->addPhysicsChild(shape, PhysicsScreenEntity::ENTITY_RECT, false);
|
|
|
- screen->createDistanceJoint(shape, ceiling, false);
|
|
|
- screen->applyImpulse(shape, 200, 0);
|
|
|
+ shape = new ScenePrimitive(ScenePrimitive::TYPE_VPLANE, 10, 30);
|
|
|
+ shape->setPosition(-70, 195);
|
|
|
+ scene->addPhysicsChild(shape, PhysicsScene2DEntity::ENTITY_RECT, false);
|
|
|
+ scene->createDistanceJoint(shape, ceiling, false);
|
|
|
+ scene->applyImpulse(shape, 200, 0);
|
|
|
|
|
|
- ScreenLine *line = new ScreenLine(shape, ceiling);
|
|
|
+ SceneLine *line = new SceneLine(shape, ceiling);
|
|
|
line->setColor(1.0, 0.0, 0.0, 1.0);
|
|
|
- screen->addChild(line);
|
|
|
+ scene->addChild(line);
|
|
|
|
|
|
// Prismatic Joint
|
|
|
- shape = new ScreenShape(ScreenShape::SHAPE_RECT, 10, 30);
|
|
|
- shape->setPosition(450, 20+25);
|
|
|
- screen->addPhysicsChild(shape, PhysicsScreenEntity::ENTITY_RECT, false);
|
|
|
- screen->createPrismaticJoint(ceiling, shape, Vector2(0,1), 0,0, false, 100, 0, true);
|
|
|
-
|
|
|
- ScreenEntity *lineAnchor = new ScreenEntity();
|
|
|
- lineAnchor->setPosition(450,10);
|
|
|
- line = new ScreenLine(shape, lineAnchor);
|
|
|
+ shape = new ScenePrimitive(ScenePrimitive::TYPE_VPLANE, 10, 30);
|
|
|
+ shape->setPosition(130, 45);
|
|
|
+ scene->addPhysicsChild(shape, PhysicsScene2DEntity::ENTITY_RECT, false);
|
|
|
+ scene->createPrismaticJoint(ceiling, shape, Vector2(0,1), 0,0, false, 100, 0, true);
|
|
|
+
|
|
|
+ SceneEntity *lineAnchor = new SceneEntity();
|
|
|
+ lineAnchor->setPosition(130,480/2-10);
|
|
|
+ line = new SceneLine(shape, lineAnchor);
|
|
|
line->setColor(0.0, 1.0, 0.0, 1.0);
|
|
|
- screen->addChild(line);
|
|
|
+ scene->addChild(line);
|
|
|
}
|
|
|
|
|
|
HelloPolycodeApp::~HelloPolycodeApp() {
|