本文整理汇总了C++中Sound::LoadSound方法的典型用法代码示例。如果您正苦于以下问题:C++ Sound::LoadSound方法的具体用法?C++ Sound::LoadSound怎么用?C++ Sound::LoadSound使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sound
的用法示例。
在下文中一共展示了Sound::LoadSound方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}