• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ Wall类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中Wall的典型用法代码示例。如果您正苦于以下问题:C++ Wall类的具体用法?C++ Wall怎么用?C++ Wall使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Wall类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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});
开发者ID:ofavre,项目名称:Breach,代码行数:12,代码来源:breaches.cpp


示例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();
        }
    }
}
开发者ID:quentin557,项目名称:ProjetCPPL,代码行数:13,代码来源:board.cpp


示例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();
}
开发者ID:Kartonschachtel,项目名称:public,代码行数:13,代码来源:Block.cpp


示例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++;
	}
}
开发者ID:baochi810,项目名称:freelance_03,代码行数:15,代码来源:WallSet.cpp


示例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;
	}	
}
开发者ID:sdlwlxf1,项目名称:tower-skycity-two,代码行数:15,代码来源:Wall.cpp


示例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();

}
开发者ID:ebrahim-elgaml,项目名称:attackers-VS-defenders-game,代码行数:48,代码来源:grapichsProject2.cpp


示例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;
}
开发者ID:betterwithlasers,项目名称:gash-prototype,代码行数:16,代码来源:Wall.cpp


示例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;
	}
	
}
开发者ID:Chonger8888,项目名称:project,代码行数:16,代码来源:SpecialBody.cpp


示例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();
  }
}
开发者ID:dmitriy-lodyanov,项目名称:zeptolab-test,代码行数:47,代码来源:game.cpp


示例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;
  }
}
开发者ID:Voidious,项目名称:BerryBots,代码行数:17,代码来源:stage.cpp


示例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();
		}
	}

}
开发者ID:mitkof6,项目名称:MovingParticles,代码行数:17,代码来源:SphereContainer.cpp


示例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;
}
开发者ID:David-Parker,项目名称:Paddle-Game,代码行数:18,代码来源:Application.cpp


示例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;
}
开发者ID:shawwshank,项目名称:projects,代码行数:43,代码来源:asd.cpp


示例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;
}
开发者ID:chrisfairc,项目名称:polly-b-gone,代码行数:20,代码来源:worlds.cpp


示例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;
}
开发者ID:,项目名称:,代码行数:41,代码来源:


示例16: Player

void Game::reset()
{
	/* Set up the adding counters */
	addWallLimit = WALL_HEIGHT / SCROLL_MOVE_DIST;
	addWallCounter = 0;
	addObstLimit = 5 * OBSTACLE_HEIGHT / SCROLL_MOVE_DIST;
	addObstCounter = 0;
	scoreLimit = 10;
	scoreCounter = 0;
	myScene.clear();
	myObjects.clear();
	myScore = 0;

	if (myPlayer == NULL)
	{
		delete myPlayer;
	}
	/** Set up the player and the initial scene **/
	myPlayer = new Player(WALL_WIDTH + 1,
							EXTRA_SCENE_SPACE + VIEW_HEIGHT - 2*PLAYER_HEIGHT,
							true);
	myScene.addItem(myPlayer);
	for (int i = VIEW_HEIGHT + EXTRA_SCENE_SPACE; i >= 0; i -= WALL_HEIGHT)
	{
		Wall* x = new Wall(0, i);
		Wall* y = new Wall(400 - WALL_WIDTH, i);
		myObjects.append(x);
		myScene.addItem(x);
		myObjects.append(y);
		myScene.addItem(y);
		x->setVisible(true);
		y->setVisible(true);
	}
	myScene.addItem(myPlayer);
	myPlayerWantsToJump = false;

	/** Make a bunch of walls **/
	int i = VIEW_HEIGHT + EXTRA_SCENE_SPACE - WALL_HEIGHT - 1;
	for (i = i + 1; i >= 0; i -= WALL_HEIGHT)
	{
		Wall* x = new Wall(0, i);
		Wall* y = new Wall(VIEW_WIDTH - WALL_WIDTH, i);
		myObjects.append(x);
		myScene.addItem(x);
		myObjects.append(y);
		myScene.addItem(y);
		x->setVisible(true);
		y->setVisible(true);
	}
}
开发者ID:Bcssd1234,项目名称:HackSC2014,代码行数:50,代码来源:game.cpp


示例17: createWall

Wall* ObjectFactory::createWall(WallDTO* wallDTO, b2World* world)
{
    Wall* wall = Wall::create();
    wall->setDeadWall(wallDTO->deadWall);
    
    b2EdgeShape edge;
    edge.Set(b2Vec2(0,0),b2Vec2(wallDTO->edge_x/PTM_RATIO,wallDTO->edge_y/PTM_RATIO));
    
    // edge.SetAsBox(1/PTM_RATIO, 4);
    
    b2FixtureDef fixDef;
    fixDef.shape = &edge;
    fixDef.friction = 0;
    
    
    PhysicData* data = new PhysicData();
    data->gameObjectID = WALL;
    data->bodyId = WALL_BODY;
    data->data = wall;
    
    fixDef.userData = data;
    
    b2BodyDef bodyDef;
    bodyDef.type = b2_staticBody;
    bodyDef.angle = ccpToAngle(ccp(0,0));
    
    b2Body *body = world->CreateBody(&bodyDef);
    body->CreateFixture(&fixDef);
    
    for (b2Fixture* f = body->GetFixtureList(); f; f = f->GetNext())
    {
        Util::setFixtureGroup(f, GROUP_WALL);
    }
    
    wall->setSkin(body, NULL);
    wall->setPositionInPixel(ccp(wallDTO->x, wallDTO->y));
    wall->setGroup(TERRAIN);

    return wall;
}
开发者ID:quinsmpang,项目名称:TinyZodiacs,代码行数:40,代码来源:ObjectFactory.cpp


示例18: Circle2D

bool Stage::isShipInWall(double x, double y) {
  for (int z = 0; z < numWalls_; z++) {
    Wall *wall = walls_[z];
    double left = wall->getLeft();
    double bottom = wall->getBottom();
    if (x > left && x < left + wall->getWidth() && y > bottom
        && y < bottom + wall->getHeight()) {
      return true;
    }
  }

  Circle2D *shipCircle = new Circle2D(x, y, SHIP_RADIUS);
  for (int z = 0; z < numWallLines_; z++) {
    Line2D* line = wallLines_[z];
    if (shipCircle->intersects(line)) {
      delete shipCircle;
      return true;
    }
  }
  delete shipCircle;
  return false;
}
开发者ID:Voidious,项目名称:BerryBots,代码行数:22,代码来源:stage.cpp


示例19: collisionCarWall

bool collisionCarWall(Car& car, Wall& wall, glm::mat4 carMatrix) {
    //can't collide if they are too far apart
    if (!collisionCircleCircle(car.getCenter(), carRadius, wall.getCenter(), wall.getLength()/2 + 1)) { //not very wide, and too lazy to do more percise math
        return false;
    }
    
    glm::mat4 wallMatrix = wall.getMatrix();
    
    glm::vec4 carUR = carMatrix * glm::vec4(0.5,1.0,0.0,1.0);
    glm::vec4 carLR = carMatrix * glm::vec4(0.5,-1.0,0.0,1.0);
    glm::vec4 carLL = carMatrix * glm::vec4(-0.5,-1.0,0.0,1.0);
    glm::vec4 carUL = carMatrix * glm::vec4(-0.5,1.0,0.0,1.0);
    
    glm::vec4 wallUR = wallMatrix * glm::vec4(1.0,0.2,0.0,1.0);
    glm::vec4 wallLR = wallMatrix * glm::vec4(1.0,-0.2,0.0,1.0);
    glm::vec4 wallLL = wallMatrix * glm::vec4(-1.0,-0.2,0.0,1.0);
    glm::vec4 wallUL = wallMatrix * glm::vec4(-1.0,0.2,0.0,1.0);
    
    return collisionRectSAT(carUR, carLR, carLL, carUL,
       wallUR, wallLR, wallLL, wallUL);

}
开发者ID:ewilden2017,项目名称:CarSimulator,代码行数:22,代码来源:collision.cpp


示例20:

bool Wall::operator!=(const Wall & c)
{	
	/*
	* This function allows us to check if our first wall
	* is already equal to our RandWall. If they are already
	* equal then we won't perform the = operator.
	*/
	if (getY() == c.getY())
	{
		return false;
	}
	return true;
}
开发者ID:Hagglesmith,项目名称:tunnelproject-1,代码行数:13,代码来源:Wall.cpp



注:本文中的Wall类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ WallClockTimer类代码示例发布时间:2022-05-31
下一篇:
C++ WaitSet_var类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap