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


C++ Background::Draw方法代码示例

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


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

示例1:

void
MyWindow::Render()
{
	m_bg->Draw();

	for (int i = 0; i < NUM_ICONS; i++)
		m_icons[i]->Draw();
}
开发者ID:faith0x7dc,项目名称:weston-sample,代码行数:8,代码来源:HomeScreen.cpp

示例2: DisplayFunc

//Called to update the display
void DisplayFunc()
{
	float current_time = float(glutGet(GLUT_ELAPSED_TIME)) / 1000.0f;

	glEnable(GL_CULL_FACE);
	glEnable(GL_NORMALIZE);
	glClearColor(0.1f, 0.1f, 0.1f, 1.0f);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glViewport(0, 0, window.size.x, window.size.y);
	background.Draw(window.size);
	Window::time = (window.paused ? window.time_last_pause_began : current_time) - window.total_time_paused;

	//Draw the current scene!
	switch(Window::currentScene){
	case 0:
		scene1.Draw(Window::time);
		break;
	
	case 1:
		scene2.Draw(Window::time);
		break;

	case 2:
		scene3.Draw(Window::scene3rotation, Window::time);
		break;

	case 3:
		scene4.Draw(Window::time);
		break;

	case 4:
		scene5.Draw(Window::time);
		break;

	case 5:
		scene6.Draw(Window::time);
		break;

	case 6:
		scene7.Draw(Window::time);
		break;
	case 7:
		scene8.Draw(Window::time);
		break;
	}

	glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
	DisplayInstructions();
	glFlush();
}
开发者ID:jmklonowski,项目名称:559P2,代码行数:51,代码来源:main.cpp

示例3: render

/********************************************************
	render() called in main as: glutDisplayFunc(render);												
	The render function is used to draw objects
	to the screen.
********************************************************/
void render() {

	switch (Current_Game_Scene_Enum)
	{
	case _scene_start_menu:

		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);				//Clear the screen of previous drawn data
		
		//if player hits ENTER_KEY, change CURRENT_GAME_SCENE_ENUM == _scene_new_game_intro
		//glutTimerFunc(ms, startMenuKeypress, 0);

		glLoadIdentity();

		//camara
		gluLookAt(0, -1, 5, 0, 0, 0, 0, 1, 0);

		//draw BKGRND glQuad to the screen
		background.DrawStartMenuBackground();

		loadTitle();

		//swap buffers to clear and redraw
		glutSwapBuffers();

		break;

	case _scene_new_game_intro:
		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);				//Clear the screen of previous drawn data

		glutTimerFunc(ms, timeTick, 0);									//update at 60 frames per second

		glLoadIdentity();

		gluLookAt(0.0, 30.0, 90.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);

		renderIntroText();

		background.DrawNewGameIntroBackground();

		if (fadeStarted && !(gameActive)) {
			decrementCount = sceneTransition.FadeOut(decrementCount);
			//check shrinking count for fadeout finished = 0
			if (decrementCount <= 0) {
				//change scene for render scene switch
				Current_Game_Scene_Enum = _scene_level_one;
				//reset some variables
				customScrollingCount = 0;
				decrementCount = 0;
				//firstPassTimer = true;
				fadeStarted = false;
				gameActive = true;
				level++;
				}
		}
		
		glutSwapBuffers();

		break;

	case _scene_level_one:
		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);				//Clear the screen of previous drawn data

		glutTimerFunc(ms, update, 0);									//update at 60 frames per second

		glLoadIdentity();
		
		displayLevelTitle();
		//Camera
		gluLookAt(0, -1, 5, 0, 0, 0, 0, 1, 0);
		displayLevelTitle();	
		displayLevelText();
		loadPlayerTitle();
		lifeTitle();
		lifeCountNumber();
		background.Draw();

		//Draw player
		player[0]->setColor(1.0f, 0.0f, 0.0f);
		player[0]->Draw();

		//Draw the enemies
		for (unsigned int i = 0; i < enemies.size(); i++) {
			enemies[i]->Draw();
			enemyModel.Position(enemies[i]->getX(), enemies[i]->getY() - 0.5f, enemies[i]->getZ());
			enemyModel.drawObject();
		}

		enemySpawn();

		//after update checks for correct kill count, being fadeOut
		if (fadeStarted) {
			cleanUp();
			//init and update the decrement-count
			if (firstPassTimerL1) {
				decrementCount = sceneTransition.FadeOut(70.0f);
//.........这里部分代码省略.........
开发者ID:rogueflynn,项目名称:openglgame,代码行数:101,代码来源:main.cpp


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