本文整理汇总了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();
}
示例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();
}
示例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);
//.........这里部分代码省略.........