|
@@ -2,41 +2,42 @@
|
|
|
|
|
|
|
|
HelloPolycodeApp::HelloPolycodeApp(PolycodeView *view) {
|
|
HelloPolycodeApp::HelloPolycodeApp(PolycodeView *view) {
|
|
|
|
|
|
|
|
- core = new POLYCODE_CORE(view, 640,480,false,false,0,0,90);
|
|
|
|
|
|
|
+ core = new POLYCODE_CORE(view, 640,480,false,true,0,0,90, 0, true);
|
|
|
|
|
|
|
|
- PhysicsScene2D *scene = new PhysicsScene2D(10, 50);
|
|
|
|
|
|
|
+ PhysicsScene2D *scene = new PhysicsScene2D(0.1, 50);
|
|
|
|
|
|
|
|
- ScenePrimitive *ceiling = new ScenePrimitive(ScenePrimitive::TYPE_VPLANE, 640, 20);
|
|
|
|
|
|
|
+ ScenePrimitive *ceiling = new ScenePrimitive(ScenePrimitive::TYPE_VPLANE, 2.0, 0.1);
|
|
|
ceiling->setColor(0.0, 0.0, 0.0, 1.0);
|
|
ceiling->setColor(0.0, 0.0, 0.0, 1.0);
|
|
|
- ceiling->setPosition(0, 480/2-10);
|
|
|
|
|
|
|
+ ceiling->setPosition(0, 0.5);
|
|
|
scene->addPhysicsChild(ceiling, PhysicsScene2DEntity::ENTITY_RECT, true);
|
|
scene->addPhysicsChild(ceiling, PhysicsScene2DEntity::ENTITY_RECT, true);
|
|
|
|
|
|
|
|
// Revolute Joint
|
|
// Revolute Joint
|
|
|
- ScenePrimitive *shape = new ScenePrimitive(ScenePrimitive::TYPE_VPLANE, 10, 30);
|
|
|
|
|
- shape->setPosition(-170, 205);
|
|
|
|
|
|
|
+ ScenePrimitive *shape = new ScenePrimitive(ScenePrimitive::TYPE_VPLANE, 0.03, 0.2);
|
|
|
|
|
+ shape->setAnchorPoint(0.0, 1.0, 0.0);
|
|
|
|
|
+ shape->setPosition(-0.3, 0.48);
|
|
|
scene->addPhysicsChild(shape, PhysicsScene2DEntity::ENTITY_RECT, false);
|
|
scene->addPhysicsChild(shape, PhysicsScene2DEntity::ENTITY_RECT, false);
|
|
|
- scene->createRevoluteJoint(shape, ceiling, -640/2, 255);
|
|
|
|
|
|
|
+ scene->createRevoluteJoint(shape, ceiling, 0.0, 0.01);
|
|
|
scene->applyImpulse(shape, 10, 0);
|
|
scene->applyImpulse(shape, 10, 0);
|
|
|
|
|
|
|
|
// Distance Joint
|
|
// Distance Joint
|
|
|
- shape = new ScenePrimitive(ScenePrimitive::TYPE_VPLANE, 10, 30);
|
|
|
|
|
- shape->setPosition(-70, 195);
|
|
|
|
|
|
|
+ shape = new ScenePrimitive(ScenePrimitive::TYPE_VPLANE, 0.1, 0.02);
|
|
|
|
|
+ shape->setPosition(0.0, 0.2);
|
|
|
scene->addPhysicsChild(shape, PhysicsScene2DEntity::ENTITY_RECT, false);
|
|
scene->addPhysicsChild(shape, PhysicsScene2DEntity::ENTITY_RECT, false);
|
|
|
scene->createDistanceJoint(shape, ceiling, false);
|
|
scene->createDistanceJoint(shape, ceiling, false);
|
|
|
- scene->applyImpulse(shape, 200, 0);
|
|
|
|
|
|
|
+ scene->applyImpulse(shape, 2, 0);
|
|
|
|
|
|
|
|
SceneLine *line = new SceneLine(shape, ceiling);
|
|
SceneLine *line = new SceneLine(shape, ceiling);
|
|
|
line->setColor(1.0, 0.0, 0.0, 1.0);
|
|
line->setColor(1.0, 0.0, 0.0, 1.0);
|
|
|
scene->addChild(line);
|
|
scene->addChild(line);
|
|
|
|
|
|
|
|
// Prismatic Joint
|
|
// Prismatic Joint
|
|
|
- shape = new ScenePrimitive(ScenePrimitive::TYPE_VPLANE, 10, 30);
|
|
|
|
|
- shape->setPosition(130, 45);
|
|
|
|
|
|
|
+ shape = new ScenePrimitive(ScenePrimitive::TYPE_VPLANE, 0.05, 0.1);
|
|
|
|
|
+ shape->setPosition(0.3, 0.3);
|
|
|
scene->addPhysicsChild(shape, PhysicsScene2DEntity::ENTITY_RECT, false);
|
|
scene->addPhysicsChild(shape, PhysicsScene2DEntity::ENTITY_RECT, false);
|
|
|
- scene->createPrismaticJoint(ceiling, shape, Vector2(0,1), 0,0, false, 100, 0, true);
|
|
|
|
|
|
|
+ scene->createPrismaticJoint(ceiling, shape, Vector2(0,1), 0,0, false, -0.3, 0, true);
|
|
|
|
|
|
|
|
SceneEntity *lineAnchor = new SceneEntity();
|
|
SceneEntity *lineAnchor = new SceneEntity();
|
|
|
- lineAnchor->setPosition(130,480/2-10);
|
|
|
|
|
|
|
+ lineAnchor->setPosition(0.3,0.5);
|
|
|
line = new SceneLine(shape, lineAnchor);
|
|
line = new SceneLine(shape, lineAnchor);
|
|
|
line->setColor(0.0, 1.0, 0.0, 1.0);
|
|
line->setColor(0.0, 1.0, 0.0, 1.0);
|
|
|
scene->addChild(line);
|
|
scene->addChild(line);
|