本文整理汇总了C++中Wall类的典型用法代码示例。如果您正苦于以下问题:C++ Wall类的具体用法?C++ Wall怎么用?C++ Wall使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Wall类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
Matrix<float,2,1> Breach::getAdjustedShotPoint(const Wall& wall, const Matrix<float,2,1> shotPoint)
{
float x = shotPoint[0];
float y = shotPoint[1];
float aNorm = wall.getAxisA().norm();
float bNorm = wall.getAxisB().norm();
if (x - DEFAULT_BREACH_WIDTH /2/aNorm < 0) x = DEFAULT_BREACH_WIDTH /2/aNorm;
if (x + DEFAULT_BREACH_WIDTH /2/aNorm > 1) x = 1 - DEFAULT_BREACH_WIDTH /2/aNorm;
if (y - DEFAULT_BREACH_HEIGHT/2/bNorm < 0) y = DEFAULT_BREACH_HEIGHT/2/bNorm;
if (y + DEFAULT_BREACH_HEIGHT/2/bNorm > 1) y = 1 - DEFAULT_BREACH_HEIGHT/2/bNorm;
if (x < 0 || y < 0) return shotPoint;
return Matrix<float,2,1>((float[]){x, y});
示例2: clearWall
void Board::clearWall(bool hORv, int x, int y)
{
Wall * temp;
for (int i = -1; i < 2; i++) {
if (hORv) {
temp = dynamic_cast<Wall*>(board_[x + i][y]);
temp->demolish();
}else{
temp = dynamic_cast<Wall*>(board_[x][y + i]);
temp->demolish();
}
}
}
示例3: addDoor
void Block::addDoor(){
Wall* temp = wall[MapModelContainer::getMirror()];
temp->setFrame(new BreakableModel(DOORFRAME,
MapModelContainer::getMirror(),
MapModelContainer::getCondition(DOORFRAME),
MapModelContainer::getIndex(DOORFRAME)));
temp->setDoor(new DoorModel(MapModelContainer::getMirror(),
MapModelContainer::getShift(),
MapModelContainer::getInvert(),
MapModelContainer::getAngle(),
MapModelContainer::getIndex(DOOR)));
LevelMap::updateMap();
}
示例4: while
void WallSet::init(Vec2 viewPoint)
{
int i = 0;
//endPoint = 1136 * 1.3f;
endPoint = 0;
while (i < 5){
Wall* wall = Wall::create();
wall->regen();
wall->setPosition(endPoint, 0);
this->addChild(wall);
walls.push_back(wall);
endPoint += SPACE;
i++;
}
}
示例5: Wall
Wall* Wall::create(ValueMap& model)
{
Wall *pRet = new Wall(model);
if (pRet && pRet->init())
{
pRet->autorelease();
return pRet;
}
else
{
delete pRet;
pRet = NULL;
return NULL;
}
}
示例6: drawAt
void drawAt(int x, int y, Shape s){
if(s == ATTACKER){
attackers[attackersSize] = Attacker(x,y - 3);
attackersSize ++;
}else{
if(board[x][y].getMyStatus() == EMPTY){
int index = -1;
if(s == DEFENDER){
index = defendersSize;
Defender d (x-5,y-3);
if(resources >= d.getCost()){
defenders[defendersSize] = d;
defendersSize ++;
board[x][y].setMyStatus(OCCUPIED);
board[x][y].setOCCupiedBy(s);
board[x][y].setShapeIndex(index);
resources -= d.getCost();
}
}else if(s == RESOURCE_GATHERER){
index = gathererSize;
ResourceGatherer r (x-5,y-3, x, y);
if(resources >= r.getCost()){
gatherers[gathererSize] = r;
gathererSize ++;
board[x][y].setMyStatus(OCCUPIED);
board[x][y].setOCCupiedBy(s);
board[x][y].setShapeIndex(index);
resources -= r.getCost();
}
}else if(s == WALL){
index = wallSize;
Wall r (x-5,y-3);
if(resources >= r.getCost()){
walls[wallSize] = r;
wallSize ++;
board[x][y].setMyStatus(OCCUPIED);
board[x][y].setOCCupiedBy(s);
board[x][y].setShapeIndex(index);
resources -= r.getCost();
}
}
}
}
removeSelection();
}
示例7: Wall
Wall* Wall::create(const std::string & filename)
{
Wall* pSprite = new Wall();
if (pSprite->initWithFile(filename))
{
pSprite->autorelease();
pSprite->initOptions();
return pSprite;
}
CC_SAFE_DELETE(pSprite);
return NULL;
}
示例8: new
Wall* Wall::create(const Size& size,const PhysicsMaterial& pm )
{
Wall* wall = new (std::nothrow) Wall;
if (wall && wall->init())
{
wall->initBody(size,pm);
wall->autorelease();
return wall;
}
else
{
CC_SAFE_DELETE(wall);
return nullptr;
}
}
示例9: OnDrawFrame
void OnDrawFrame() {
float dt=NowMs()-savedTime;
gameState.flappyBird->update(dt);
bool needResetLevel;
for(List<Wall>::Node *node = gameState.wallsList.begin; node;) {
Wall *wall = node->obj;
wall->update(dt, needResetLevel);
List<Wall>::Node *next_node = node->next;
if(wall->x + wall->w < 0.0f) {
delete wall;
gameState.wallsList.remove(node);
}
node = next_node;
}
if(needResetLevel)
gameState.resetLevel();
gameState.idleTime = gameState.idleTime - dt;
if(gameState.idleTime <= 0) {
gameState.idleTime = 2000.f + ((rand()%1000)*0.001f) * 1000.f;
Wall *wall = new Wall;
wall->x = gameState.screenWidth / gameState.scale;
wall->y = 0.0f;
wall->w = 40.0f + ((rand()%1000)*0.001f) * 20.0f;
wall->h = 100.0f + ((rand()%1000)*0.001f) * 500.0f;
if(gameState.side) {
wall->y = 1000.f - wall->h;
}
gameState.side = !gameState.side;
gameState.wallsList.add(wall);
}
savedTime=NowMs();
glClear(GL_COLOR_BUFFER_BIT);
gameState.flappyBird->draw();
for(List<Wall>::Node *node = gameState.wallsList.begin;
node; node = node->next)
{
Wall *wall = node->obj;
wall->draw();
}
}
示例10: Wall
int Stage::addWall(
int left, int bottom, int width, int height, bool addWallLines) {
if (numWalls_ >= MAX_WALLS) {
return 0;
} else {
Wall* wall = new Wall(left, bottom, width, height);
walls_[numWalls_++] = wall;
if (addWallLines) {
Line2D** wallLines = wall->getLines();
for (int x = 0; x < 4; x++) {
innerWallLines_[numInnerWallLines_++] =
wallLines_[numWallLines_++] = wallLines[x];
}
}
return 1;
}
}
示例11: findWallCollisions
void SphereContainer::findWallCollisions(){
for(unsigned i = 0;i<spheres.size();i++){
Wall temp;
if(collision.checkForWallCollision(
spheres[i].getMassCenter(),spheres[i].getMassCenter(), spheres[i].getRadius(),
temp)){
//handle wall collision
spheres[i].collisionHandler(temp.getWallDirection());
//inc counter
wallCollisionCounter.incCounter();
}
}
}
示例12: createRootEntity
Wall* Application::createWall(Ogre::String nme, GameObject::objectType tp, Ogre::String meshName, int x, int y, int z, Ogre::Vector3 scale, Ogre::Degree pitch, Ogre::Degree yaw, Ogre::Degree roll, Ogre::SceneManager* scnMgr, GameManager* ssm, Ogre::Real mss, Ogre::Real rest, Ogre::Real frict, bool kinematic, Simulator* mySim) {
createRootEntity(nme, meshName, x, y, z);
Ogre::SceneNode* sn = mSceneManager->getSceneNode(nme);
Ogre::Entity* ent = SceneHelper::getEntity(mSceneManager, nme, 0);
const btTransform pos;
OgreMotionState* ms = new OgreMotionState(pos, sn);
sn->setScale(scale.x, scale.y, scale.z);
sn->pitch(pitch);
sn->yaw(yaw);
sn->roll(roll);
Wall* obj = new Wall(nme, tp, mSceneManager, ssm, sn, ent, ms, mySim, mss, rest, frict, scale, kinematic);
obj->addToSimulator();
return obj;
}
示例13: main
int main()
{
UserList dataList;
Wall userWall;
userWall.printAll();
//dataList.readFile();
bool goBackToFirstMenu = true;
int choice;
while(goBackToFirstMenu == true)
{
cout << "Look at the menu below and\nenter the corresponding number." << endl;
cout << "1)Log in as a user.\n2)Create a new user\n3)Print Users\n4)Delete User" << endl << endl;
cin >> choice;
menu(choice, goBackToFirstMenu, dataList);
cout << "Would you like to go back to the main menu? (Y/N)" << endl;
string goBackToMainMenu;
cin >> goBackToMainMenu;
if(goBackToMainMenu == "Y" || goBackToMainMenu == "y")
{
goBackToFirstMenu = true;
//menu(choice, goBackToFirstMenu, dataList);
}
else if(goBackToMainMenu == "N" || goBackToMainMenu == "n")
{
cout << "Goodbye! Hope you have a good one!" << endl;
goBackToFirstMenu = false;
}
else
{
cout << "Enter a valid choice" << endl;
cin >> goBackToMainMenu;
}
dataList.writeFile();
}
return 0;
}
示例14: Wall
RoomObject* XmlWorldBuilder::parseRoomQuadWall(TiXmlElement* e) {
Wall* w = new Wall(
parseVector(e->FirstChildElement("x0")),
parseVector(e->FirstChildElement("x1")),
parseVector(e->FirstChildElement("x2")),
parseVector(e->FirstChildElement("x3")));
TiXmlElement* t = e->FirstChildElement("tex-coords");
if (t != NULL) {
w->setTexCoords(
parseVector(t->FirstChildElement("t0")),
parseVector(t->FirstChildElement("t1")),
parseVector(t->FirstChildElement("t2")),
parseVector(t->FirstChildElement("t3")));
}
const char* material = e->Attribute("material");
if (material != NULL) {
w->setMaterial(*materials_[material]);
}
return w;
}
示例15: DEBUGSTR
unsigned int NetClient::handleWallState(Uint8 *data, unsigned int size)
{
DEBUGSTR("net", "handleWallState()");
Uint16 eid;
CRC32 type;
float qx, qy, qz, qw, bx, by, bz;
unpack(data, "hl ffff fff",
&eid, &type,
&qx, &qy, &qz, &qw,
&bx, &by, &bz
);
Entity* e = st->getEntity(eid);
Wall* w = (Wall*) e;
// If don't exist, create
if (w == NULL) {
WallType *wt = GEng()->mm->getWallType(type);
if (! wt) {
this->error("Invalid wall type " + type);
return 34;
}
w = new Wall(wt, st, bx, bz, by, 0);
st->addWall(w);
w->eid = eid;
}
// Update the transform
btTransform xform = btTransform(
btQuaternion(qx, qy, qz, qw),
btVector3(bx, by, bz)
);
w->setTransform(xform);
return 34;
}