本文整理汇总了C++中MovingObject::scale方法的典型用法代码示例。如果您正苦于以下问题:C++ MovingObject::scale方法的具体用法?C++ MovingObject::scale怎么用?C++ MovingObject::scale使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MovingObject
的用法示例。
在下文中一共展示了MovingObject::scale方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadRoom
//.........这里部分代码省略.........
}
if (strcmp(placement, "wall") == 0)
{
tempWall->xLength *= 0.1f;
}
}
if (strcmp(dir, "left") == 0)
{
if (strcmp(placement, "") == 0)
{
tempWall->centerX += 0.4f;
tempWall->xRotation = -3.14f / 2.0f;
}
if (strcmp(placement, "wall") == 0)
{
tempWall->xLength *= 0.1f;
//tempWall->yLength = 1.0f;
}
}
tempWall->centerY = tempWall->centerY + tempWall->yLength / 2;
crestVector.push_back(tempWall);
}
// Create walls and add to GameObject vector
for (unsigned int i = 0; i < wallRowCol.size(); i++)
{
for (unsigned int j = 0; j < wallRowCol[i].size(); j++)
{
GameObject* wallObj = new GameObject("Cube", wallRowCol[i][j]->texture, physicsMan->createRigidBody("Cube", wallRowCol[i][j]->centerX + xPos, wallRowCol[i][j]->yLength / 2 + wallRowCol[i][j]->centerY, wallRowCol[i][j]->centerZ + zPos), physicsMan, WORLD);
wallObj->scale(wallRowCol[i][j]->xLength, wallRowCol[i][j]->yLength, wallRowCol[i][j]->zLength);
wallObj->SetTexScale(max(wallRowCol[i][j]->xLength, wallRowCol[i][j]->zLength), wallRowCol[i][j]->yLength, 0.0f, 1.0f);
gameObjs.push_back(wallObj);
}
}
for (unsigned int i = 0; i < floorVector.size(); i++)
{
GameObject* floorObj = new GameObject("Cube", floorVector[i]->texture, physicsMan->createRigidBody("Cube", floorVector[i]->centerX + xPos, floorVector[i]->centerY - 0.5f, floorVector[i]->centerZ + zPos), physicsMan, WORLD);
floorObj->scale(floorVector[i]->xLength, 1.0f, floorVector[i]->zLength);
floorObj->SetTexScale(floorVector[i]->xLength, floorVector[i]->zLength, 0.0f, 1.0f);
gameObjs.push_back(floorObj);
}
for (unsigned int i = 0; i < cubeVector.size(); i++)
{
MovingObject* cubeObj = new MovingObject("Cube", cubeVector[i]->texture, physicsMan->createRigidBody("Cube", cubeVector[i]->centerX + xPos, cubeVector[i]->centerY + cubeVector[i]->yLength / 2, cubeVector[i]->centerZ + zPos), physicsMan);
cubeObj->scale(cubeVector[i]->xLength, cubeVector[i]->yLength, cubeVector[i]->zLength);
cubeObj->SetTexScale(cubeVector[i]->xLength, cubeVector[i]->zLength, 0.0f, 1.0f);
cubeObj->AddPosition(XMFLOAT3(cubeVector[i]->centerX + xPos, cubeVector[i]->centerY + cubeVector[i]->yLength / 2, cubeVector[i]->centerZ + zPos));
cubeObj->AddPosition(XMFLOAT3(cubeVector[i]->centerX + xPos + cubeVector[i]->translateX, cubeVector[i]->centerY + (cubeVector[i]->yLength / 2) + cubeVector[i]->translateY, cubeVector[i]->centerZ + zPos + cubeVector[i]->translateZ));
float rowId = cubeVector[i]->row - mapOffsetZ;
float colId = cubeVector[i]->col - mapOffsetX;
char rowChar[30];
char colChar[30];
itoa((int)rowId, rowChar, 10);
itoa((int)colId, colChar, 10);
strcat(rowChar, "|");
strcat(rowChar, colChar);