Exemplo n.º 1
0
void Level::managedLevel()
{
    //Level type initialization logic
    switch(mLevelType)
    {
        case RUBE_BOX2D_LEVEL:{
            rubeB2DLevel(mBox2dJson);
        }
            break;
        default:break;
    }

    // Index the actors in the scene graph and in the set
    for (Actor* actor : findChildren<Actor*>())
    {
        mActors[actor->getActorType()].insert(actor);

        Body* aBody = actor->getBody();
        if(aBody && aBody->manualInitialization()){
            aBody->initBody();
#ifdef D_PARSE
            Json::Value val  = mBox2dJson.b2j(aBody->getBody());
            qDebug() << "Manual Inited Body = " << QByteArray(val.toStyledString().c_str());
#endif
        }
        // For now, we define the teleporter to be an actor with the activationThreshold property.
        QVariant variant = actor->property("activationThreshold");
        if (variant.isValid()) {
            if (mPortal) {
                qDebug() << "Warning: Level has more than one teleporter.";
            }
            mPortal = actor;
        }
    }
}
Exemplo n.º 2
0
	void Render::DrawBodies(list<Body*> bodies) {

		list<Body*>::iterator bIter;
		for (bIter = bodies.begin(); bIter != bodies.end(); ++bIter) {
			Body* b = *bIter;
			const b2Transform& xf = b->getBody()->GetTransform();
			list<Fixture*> fixtures = b->getFixtureList();
			list<Fixture*>::iterator fIter;
			for (fIter = fixtures.begin(); fIter != fixtures.end(); ++fIter) {
				Fixture* f = *fIter;
				DrawShape(f->getFixture(), xf, f->getColor());
			}
		}
	}