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


C++ TextureManager::DrawTextured方法代码示例

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


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

示例1: Ship

//=======================================================================
// Ship
//=======================================================================
void Ship(int locX, int fPosY, float rotation)
{
	glLoadIdentity();

	glTranslatef(WIDTH/2, HEIGHT/2, 0);
	glRotatef(rotation, 0, 0, 1);
	
	if(!GameOver)
	{
		if(DEBUG)
			DebugShip(locX, fPosY);
		else		
			texManager.DrawTextured(0, 0, 64, 64, Player_Ship_Texture);
	}
	else
	{
		texManager.DrawTextured(0, 0, 512, 512, explosionTex);
		GameState = GAMEOVER;
	}
}
开发者ID:MohamedIsmailHafez,项目名称:Space-Shooter,代码行数:23,代码来源:main_Old.cpp

示例2: Render

	void Render(float dt)
	{
		for(unsigned int i=0; i<entities.size(); i++)
		{
			glLoadIdentity();

			Entity* e = entities[i];
			
			switch(e->type)
			{
				case BULLET:
				{
					e->position += e->direction * Speed/10 * e->type * dt;

					glBegin(GL_POINTS);
					glVertex2f(e->position.x, e->position.y);
					glEnd();
				}
				break;

				case ENEMY:
				{
					Enemy* enemy = static_cast<Enemy*>(e);

					enemy->position += enemy->direction * enemySpeed/10 * dt;

					//Debug
					//cout << enemy->position.x << " , " << enemy->position.y << endl;

					if(enemy->dying)
					{
						texManager.DrawTextured(enemy->position.x, enemy->position.y, 60.0f, 60.0f, explosionTex);
					}
					else
					{
						glTranslatef(enemy->position.x, enemy->position.y, 0);
						glRotatef(enemy->dirAngle, 0 ,0, 1);
						if(enemy->level == 1)
						glScalef(.5,.5,0);
						

						if(DEBUG)
						{
							glColor3f(1,0,0);
							DebugShip(0, 0);
						}
						else
						{
							if(enemy->level == 1)
								texManager.DrawTextured(0, 0, 60.0f, 60.0f, enemyTexI);
							else
								texManager.DrawTextured(0, 0, 60.0f, 60.0f, enemyTexII);
						}
					}
				}
				break;

			}

		}
	}
开发者ID:MohamedIsmailHafez,项目名称:Space-Shooter,代码行数:61,代码来源:main_Old.cpp


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