本文整理汇总了C++中Body::fromConvexSet方法的典型用法代码示例。如果您正苦于以下问题:C++ Body::fromConvexSet方法的具体用法?C++ Body::fromConvexSet怎么用?C++ Body::fromConvexSet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Body
的用法示例。
在下文中一共展示了Body::fromConvexSet方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Init
void Game::Init()
{
GameInstance::instance()->setGame(this);
Body* b;
for(int i=0; i<512; i++) {
Mine* m = new Mine(vec2(rand()%W_WIDTH, rand()%W_HEIGHT));
}
for(int i=0; i<400; i++) {
b = PhysicsManager::instance()->getFromPool();
b->fromConvexSet(createConvexSet(4+rand()%2, 180+rand()%50, vec2(rand()%W_WIDTH, rand()%W_HEIGHT)));
b->setCollisionCallback(&dcallback);
b->getShape().setColor(0x74BBFB);
float area = getSetArea(b->getShape().getVertices());
if(area == area) {} else {
PhysicsManager::instance()->releaseToPool(b);
continue;
}
float mass = area/100000.f;
if(mass < 1.f) mass = 1.f;
if(mass > 3.f) mass = 3.f;
b->setMass(mass);
renderQueue.push_back(b);
}
ctime = 0;
ltime = 0;
desired_fps = 240.f;
debug = new DebugConsole(this, 16, 10, 10, 400);
status = new StatusConsole(this, 4, 500, 10, 260);
// status->addMsg("StatusConsole v0.1");
state_pg = new PreGameState();
state_ig =new InGameState();
state_go =new GameOverState();
StateManager::instance()->registerState("pregame", state_pg);
StateManager::instance()->registerState("ingame", state_ig);
StateManager::instance()->registerState("gameover", state_go);
shiftDown = false;
ConstraintSolver::instance()->setIterations(6);
Rasterizer::instance()->setScreen(m_Screen);
}