当前位置: 首页>>代码示例>>C++>>正文


C++ Wall::read方法代码示例

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


在下文中一共展示了Wall::read方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: init

/////////////////////////
//初期化
/////////////////////////
void Play::init()
{
	//タイム---------------------------------------------------------------------------------
	time = new Time();

	//BGM再生-------------------------------------------------------------------------------------
	sound->playMusic(SOUND::PLAY_BGM);

	//フィールド-----------------------------------------------------------------------------
	glBindTexture(GL_TEXTURE_2D, textures[TEXTURE_ID::FIELD]);
	field = new Field();
	field->setup("field.bmp");

	//壁---------------------------------------------------------------------------------------
	const float fieldToDistance = 120;

	glBindTexture(GL_TEXTURE_2D, textures[TEXTURE_ID::WALL]);

	Wall *northWall = new Wall(glm::vec3(field->center.x, 0, field->center.z + fieldToDistance), 0);	//z+120の壁
	Wall *southWall = new Wall(glm::vec3(field->center.x, 0, field->center.z - fieldToDistance), 0);	//z-120の壁
	Wall *eastWall = new Wall(glm::vec3(field->center.x + fieldToDistance, 0, field->center.z), 90);	//x+120の壁
	Wall *westWall = new Wall(glm::vec3(field->center.x - fieldToDistance, 0, field->center.z), 90);	//z-120の壁

	northWall->read("wall.bmp");	//壁テクスチャ読み込み

	wall.push_back(northWall);
	wall.push_back(southWall);
	wall.push_back(eastWall);
	wall.push_back(westWall);

	//スモークテクスチャ-------------------------------------------------
	glBindTexture(GL_TEXTURE_2D, textures[TEXTURE_ID::SMOKEEFFECT]);
	smokeTex = new Texture();
	smokeTex->read_alpha("smoke.bmp");

	//ポール--------------------------------------------------------------------------------
	const char poleNum = 3;	//poleの数(pole * pole)
	const char polePos = 60;//中心位置からの距離
	unsigned char type;		//0:中立 1:プレイヤー 2:エネミー

	for (int y = 0; y < poleNum; y++)
	{
		if (y == 0)
		{//プレイヤー側
			type = TYPE::BLUE;
		}
		else if (y == 1)
		{//真ん中
			type = TYPE::NEUTRAL;
		}
		else
		{//エネミー	側
			type = TYPE::RED;
		}
		for (int x = 0; x < poleNum; x++)
		{
			Pole *subPole = new Pole(glm::vec3(field->center.x + (polePos * x - polePos), 0, field->center.z + (polePos * y - polePos)), type);
			pole.push_back(subPole);
		}
	}

	//ブルーチーム----------------------------------------------------------------
	//プレイヤー
	glm::vec3 centerToPlayer(45, 4, -100);		//フィールド中心からの位置
	float playerSize = 0.5f;					//プレイヤーの大きさ
	player = new Player(field->center + centerToPlayer, playerSize, 0, TYPE::BLUE);
	
	//コントローラー
	glBindTexture(GL_TEXTURE_2D, textures[TEXTURE_ID::CONTROLLER]);
	controller = new Texture();
	controller->read_alpha("controller.bmp");

	//サポーター
	auto supporterNum = 3;			//サポーターの数
	auto supporterSize = 0.5f;		//サポーターの大きさ

	for (int i = 0; i < supporterNum; i++)
	{
		glm::vec3 centerToSupporter((i * 30) - 45, 4, -100);	//フィールド中心からの位置	
		NPC* subSuppoter = new NPC(field->center + centerToSupporter, supporterSize, 0, TYPE::BLUE);
		supporter.push_back(subSuppoter);
	}

	//レッドチーム----------------------------------------------------------------
	auto enemyNum = 4;				//エネミーの数
	auto enemySize = 0.5f;			//エネミーの大きさ

	for (int i = 0; i < enemyNum; i++)
	{
		glm::vec3 centerToEnemy((i * 30) - 45, 4, 100);			//フィールド中心からの位置
		NPC* subEnemy = new NPC(field->center + centerToEnemy, enemySize, 180, TYPE::RED);
		enemy.push_back(subEnemy);
	}

	//カメラ------------------------------------------------------------------------------
	camera = new Camera();
	const float posHeight = 2.0f;	//カメラ高さ
//.........这里部分代码省略.........
开发者ID:toshifumi1989,项目名称:conquest,代码行数:101,代码来源:play.cpp


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