本文整理汇总了C++中Display::Render方法的典型用法代码示例。如果您正苦于以下问题:C++ Display::Render方法的具体用法?C++ Display::Render怎么用?C++ Display::Render使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Display
的用法示例。
在下文中一共展示了Display::Render方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: render
void render(){
display.Clear();
drawGhost();
drawBlock(CODE);
drawMap();
drawBorders();
drawNextBlock();
sprintf(TEXT,"Score: %i",score);
display.DrawString(TEXT, ((WIDTH))*BLOCKPIXSIZE, (0)*BLOCKPIXSIZE,0,0x00FF00);
sprintf(TEXT,"Highscore: %i",hscore);
display.DrawString(TEXT, ((WIDTH))*BLOCKPIXSIZE, (1)*BLOCKPIXSIZE,0,0x00FF00);
sprintf(TEXT,"Next:");
display.DrawString(TEXT, ((WIDTH))*BLOCKPIXSIZE, (4)*BLOCKPIXSIZE,0,0x00FF00);
display.Render();
}
示例2: lostGame
void lostGame(){
display.Clear(); drawMap(); display.Render();
//====================Highscore if(score < hscore)
if(score < hscore){
//sprintf (DEBUGMSG2, "You lose nub.\nScore: %i\nHighscore: %i",score,hscore);
//MessageBox (0, DEBUGMSG2, "You Lost!", MB_ICONINFORMATION);
}
else{
hscore = score;
saveHighscore(&score);
// sprintf (DEBUGMSG2, "You just achieved a highscore\nHighscore: %i",hscore);
//MessageBox (0, DEBUGMSG2, "Nice!!!", MB_ICONINFORMATION);
}
resetGame();
}
示例3: resetGame
void resetGame(){
//==========================START MSG Prints Highscore
while(!keyboard.s){
display.Clear();
drawMap();
drawBorders();
sprintf(TEXT,"Press 's' to start");
display.DrawString(TEXT, 0, (HEIGHT/2)*BLOCKPIXSIZE,0,0x00FF00);
display.Render();
keyboard.Poll();
SDL_Delay(50);
}
for(int i=0;i < WIDTH;i++){
for(int ii=0;ii < HEIGHT;ii++){
map[i][ii] = 0;
}
}
score = 0;
newBlock();
}
示例4: main
int main (int argc, char *argv[])
{
srand ( time(NULL) );
sound.LoadSound("blockHit","hit.wav");
sound.LoadSound("horizontal","horizon2.wav");
sound.LoadSound("rotate","rotate.wav");
loadHighscore(&hscore);
resetGame();
while (keyboard.Quit == false)
{
if(keyboard.r){
keyboard.Clear();
resetGame();
}
if(keyboard.p){
SDL_Delay(100);
keyboard.Poll();
keyboard.Clear();
while(!keyboard.p){
keyboard.Poll();
display.Clear();
drawBorders();
sprintf(TEXT,"Game is paused.");
display.DrawString(TEXT, 0, (HEIGHT/2)*BLOCKPIXSIZE,0,0x00FF00);
display.Render();
SDL_Delay(50);
}
}
int speed = 0;
speed = score/2400;
if(speed > 40){speed = 40;}
if(!(cycle% (60-speed)) || keyboard.Down){fallBlock(); HorizontalStrip(); if(keyboard.Down)keyboard.Clear(); }
keyboard.Poll();
if(keyboard.Left && InvasiveCheckPass(blockx-1,blocky,blockt,blockr)){ --blockx; keyboard.Clear();}
if(keyboard.Right && InvasiveCheckPass(blockx+1,blocky,blockt,blockr)){++blockx; keyboard.Clear();}
if(keyboard.Up && InvasiveCheckPass(blockx,blocky,blockt,blockr+1)){
blockr = (++blockr > 3) ? 0 : blockr; updateBlockBoundaries();
sound.PlaySound("rotate",80,0);
keyboard.Clear();
}
if(keyboard.Space){
while(InvasiveCheckPass(blockx,blocky+1,blockt,blockr)){fallBlock(); HorizontalStrip();}
gridLockBlock();
keyboard.Clear();
SDL_Delay(80);
}
blockx = (blockx< -minxcord) ? -minxcord : ((blockx > (WIDTH-1)-maxxcord) ? (WIDTH-1)-maxxcord : blockx);
render();
char TXT[128];
if(speed > 30){sprintf(TXT,"EXTREME PENTRIX: %i",hscore);}
else{sprintf(TXT,"Pentrix Highscore: %i",hscore);}
display.Caption(TXT);
SDL_Delay (4); cycle = (++cycle > 239) ? 1 : cycle;
}
return 0;
}