本文整理汇总了C++中HUD::Update方法的典型用法代码示例。如果您正苦于以下问题:C++ HUD::Update方法的具体用法?C++ HUD::Update怎么用?C++ HUD::Update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HUD
的用法示例。
在下文中一共展示了HUD::Update方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Run
//.........这里部分代码省略.........
{
if(object->HasCollidedWithObject(player, &win) == -1)
{
player.MoveLeft(&win);
}
else
{
player.SetPosition(player.GetSprite().GetPosition().x + 10, player.GetSprite().GetPosition().y);
}
}
if(win.GetInput().IsKeyDown(Key::Right)&& !win.GetInput().IsKeyDown(Key::Up) && !win.GetInput().IsKeyDown(Key::Down)&& !win.GetInput().IsKeyDown(Key::Left))
{
if(object->HasCollidedWithObject(player, &win) == -1)
{
player.MoveRight(&win);
}
else
{
player.SetPosition(player.GetSprite().GetPosition().x - 10, player.GetSprite().GetPosition().y);
}
}
}
if(win.GetInput().IsKeyDown(Key::A))
{
}
if(object->HasCollidedWithObject(player, &win) == noncollectible)
{
if(player.m_up) player.SetPosition(player.GetSprite().GetPosition().x , player.GetSprite().GetPosition().y + 10);
if(player.m_down) player.SetPosition(player.GetSprite().GetPosition().x , player.GetSprite().GetPosition().y - 10);
if(player.m_right) player.SetPosition(player.GetSprite().GetPosition().x - 10, player.GetSprite().GetPosition().y);
if(player.m_left) player.SetPosition(player.GetSprite().GetPosition().x + 10, player.GetSprite().GetPosition().y);
}
hud.Update(&player);
object->Update(player);
if(!object->IsBattling())
{
win.Clear();
if(change)
{
if(!map.LoadMap(vMode, &win, level))
{
win.Close();
}
if(!object->LoadObjects(vMode, &win, levelObject, &player, luaState))
{
win.Close();
}
change = false;
}
map.RenderMap(vMode, &win);
player.Draw(vMode, &win);
if(object->RenderObjects(vMode, &win, &player, luaState) == false) return 0;
hud.Draw(&win);
}
else
{
win.Clear();
NPC* npc;
npc = object->GetCollidedNPC();
battle.Initialize((player.GetView().GetCenter().x-player.GetView().GetHalfSize().x),(player.GetView().GetCenter().y-player.GetView().GetHalfSize().y));
if(battle.Run(vMode, win, &enemy, player) == "Exits")
{
object->StopBattle();
}
else if(battle.Run(vMode, win, &enemy, player) == "Player Win")
{
object->StopBattle();
object->RemoveNPC(object->GetCollidingIndex(), &win, &player);
}
else if(battle.Run(vMode, win, &enemy, player) == "Enemy Win")
{
object->StopBattle();
object->NotDisabled();
player.Default();
enemy.Default();
if(!map.LoadMap(vMode, &win, "..\\data\\Levels\\Map1.txt"))
{
win.Close();
}
if(!object->LoadObjects(vMode, &win, "..\\data\\Levels\\Object1.txt", &player, luaState))
{
win.Close();
}
}
player.SetView(400,300);
}
object->DrawCommentSystem();
win.SetView(player.GetView());
win.Display();
}
lua_close(luaState);
return -1;
}