本文整理汇总了C++中Hud::GetScore方法的典型用法代码示例。如果您正苦于以下问题:C++ Hud::GetScore方法的具体用法?C++ Hud::GetScore怎么用?C++ Hud::GetScore使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hud
的用法示例。
在下文中一共展示了Hud::GetScore方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char* args[])
{
enum {MENU, RUNNING, GAMEOVER, END};
int state = MENU;
int score = 0;
int deaths = 0;
//Holds all game objects vectors
vector<Net *> nets;
vector<Coral *> corals;
vector<School *> schools;
vector<SceneryFish *> sceneryFish;
vector<GobblerFish *> gobblerFish;
//back buffer || bit messy can clean up
System system("Fishy Game", false, 640, 480, 32, 60);
if (!system.Setup())
{
MessageBox(NULL, "SDL DID NOT INITIALISE PROPERLY", NULL, MB_OK);
return -1;
}
SDL_Surface* buffer = system.GetBuffer();
Timer timer;
Timer delta;
Camera camera(640, 480);
Level level;
Menu menu;
Hud hud;
School* school;
Net* net = NULL;
Coral* coral = NULL;
Mix_Music *music = NULL;
Fish fish("Sprites/Player_Spritesheet.bmp", 64, 64, 0, 0, 200, 200);
level.LoadLevel(fish, corals, nets, sceneryFish, gobblerFish);
music = Mix_LoadMUS( "Sounds/DST-Aethereal.wav" );
delta.Start();
while(!system.Done())
{
srand(time(NULL));
if(Mix_PlayingMusic () == 0)
{
Mix_PlayMusic(music, -1);
}
switch(state)
{
case MENU:
state = (menu.Update( delta, system.GetEvent()));
menu.Draw(buffer, camera);
break;
case RUNNING:
hud.Update(score, deaths );
//update
fish.Update( delta.GetTicks() );
for( int c = 0; c < corals.size(); c++)
{
corals[c]->Update(delta.GetTicks());
}
for( int i = 0; i < schools.size(); i++)
{
schools[i]->Update( delta.GetTicks(), fish, corals);
for(int j = 0; j < 3; j++)
{
if(schools[i]->GetFish(j)->GetEaten()
&& (!schools[i]->GetFish(j)->GetScored()))
{
deaths += 1;
schools[i]->GetFish(j)->SetScored(true);
}
if(schools[i]->GetFish(j)->GetSaved()
&& (!schools[i]->GetFish(j)->GetScored()))
{
score += 10;
schools[i]->GetFish(j)->SetScored(true);
}
}
}
for( int g = 0; g < gobblerFish.size(); g++)
{
gobblerFish[g]->Update(delta.GetTicks(), schools);
}
for( int i = 0; i < nets.size(); i++)
//.........这里部分代码省略.........