本文整理汇总了C++中ship::show方法的典型用法代码示例。如果您正苦于以下问题:C++ ship::show方法的具体用法?C++ ship::show怎么用?C++ ship::show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ship
的用法示例。
在下文中一共展示了ship::show方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
while(SDL_PollEvent(&event)) {
//ship controls
myship.handleInput();
//other controls
if(event.type==SDL_KEYDOWN) {
switch(event.key.keysym.sym) {
case SDLK_ESCAPE:
quitGame=true;
quitOver=true;
quitAll=true;
break;
case SDLK_x:
if(useBomb()==false) return 1;
break;
default:
;
}
}
//if the window gets X'd
if(event.type == SDL_QUIT) {
quitGame = true;
quitOver=true;
quitAll=true;
}
}
//update screen data
myship.move(tmDelta.getTicks()); //update ship's position
tmDelta.start(); //restart change of time timer
printb(0,0,sfBG,sfScreen); //print background
myship.show(); //print position to screen
if(diedRecently==true) printb(120,0,sfDeathOverlay,sfScreen,NULL);
if(bombedRecently==true) printb(120,0,sfBombFlash,sfScreen,NULL);
if(waveZero==true) { //reset bullets to original when looping game
printb(0,0,sfHowTo,sfScreen,NULL);
iMaxBul=-1;
}
for(i=0; i<=iMaxBul; i++) {
//player has died: do all relevant tracking
if(isCol(myship.hitbox,b[i].hitbox)) {
iLife--;
iBomb=3;
iScore-=50;
if(iLife==0) quitGame=true;
diedRecently=true;
b[i].hitbox.x=rand()%420-120;
b[i].hitbox.y=0;
tmDeathOverlay.start();
tmTimeAlive.start();
if(Mix_PlayChannel(-1,chDeath,0)==-1) return 1;
}
if(b[i].hitbox.x>515) b[i].hitbox.x=120;
if(b[i].hitbox.x<120) b[i].hitbox.x=515; //compensate for bullet width
if(b[i].hitbox.y>480) { //because collision is counted from sScore of the picture
b[i].hitbox.y=0; //so bulletwidth had to be subtracted
b[i].xVel=rand()%5-2; //bullet can travel left or right
b[i].yVel=rand()%4+1; //can only travel down
}
b[i].hitbox.y+=b[i].yVel;
b[i].hitbox.x+=b[i].xVel;
printb(b[i].hitbox.x,b[i].hitbox.y,sfBullet,sfScreen,NULL);