本文整理汇总了C++中Puzzle::isActivated方法的典型用法代码示例。如果您正苦于以下问题:C++ Puzzle::isActivated方法的具体用法?C++ Puzzle::isActivated怎么用?C++ Puzzle::isActivated使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Puzzle
的用法示例。
在下文中一共展示了Puzzle::isActivated方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updatePlatforms
void World::updatePlatforms() {
platformVBO->clear();
b2Body *B = world->GetBodyList();
int colorId = platforms->size() - 1;
//squareVBO->clear();
while (B != NULL) {
b2Fixture* F = B->GetFixtureList();
while (F != NULL) {
switch (F->GetType()) {
case b2Shape::e_polygon: {
b2PolygonShape* poly = (b2PolygonShape*) F->GetShape();
b2Vec2 points[4];
for (int i = 0; i < 4; i++) {
points[i] = poly->GetVertex(i);
}
//Check if platform is unlit
b2Vec3 curColor = platformColors->at(colorId);
if (curColor.x == COLOR_LIT.x && curColor.y == COLOR_LIT.y && curColor.z == COLOR_LIT.z) {
platformVBO->pushBackLigthPostionLit(B->GetWorldCenter());
}
if (curColor.x == COLOR_UNLIT.x && curColor.y == COLOR_UNLIT.y && curColor.z == COLOR_UNLIT.z) {
platformVBO->pushBackLigthPostionUnlit(B->GetWorldCenter());
}
Puzzle *puzzle = puzzles->at(puzzleId);
if (puzzle->isActivated()) {
if (curColor.x == COLOR_UNLIT.x && curColor.y == COLOR_UNLIT.y && curColor.z == COLOR_UNLIT.z) {
b2Body *platBody = platforms->at(colorId);
b2Vec2 platPos = platBody->GetPosition();
b2Vec2 x1 = platPos + points[0];
b2Vec2 x2 = platPos + points[2];
platPos *= M2P;
x1 *= M2P;
x2 *= M2P;
//Check if any particles collide
int ant = particles->size();
for (int i = 0; i < ant; i++) {
Particle *tempParticle = particles->at(i);
if (tempParticle->isFired()) {
//Get handle
b2Body *parBody = tempParticle->getBody();
b2Vec2 parXY = parBody->GetPosition();
parXY *= M2P;
if (parXY.x >= x1.x - BUTTON_BOX_SIZE && parXY.x <= x2.x + BUTTON_BOX_SIZE) {
if (parXY.y >= x1.y - BUTTON_BOX_SIZE && parXY.y <= x2.y + BUTTON_BOX_SIZE) {
//Light platform
curColor = COLOR_LIT;
platformColors->at(colorId) = COLOR_LIT;
Puzzle *puzzle = puzzles->at(puzzleId);
puzzle->taskDone();
}
}
}
}
}
}
//Draw platform
int a = 0;
platformVBO->pushBack( points, B->GetWorldCenter(), B->GetAngle(), curColor);
colorId--;
break;
}
}
F = F->GetNext();
}
B = B->GetNext();
}
}