本文整理汇总了C++中Display::getSaveAmount方法的典型用法代码示例。如果您正苦于以下问题:C++ Display::getSaveAmount方法的具体用法?C++ Display::getSaveAmount怎么用?C++ Display::getSaveAmount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Display
的用法示例。
在下文中一共展示了Display::getSaveAmount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: saveMenu
void saveMenu(Display& game)
{
Sleep(500);
UserInterface menu(0, 0, 0, 0);
int worldAmount = game.getSaveAmount();
bool exitFlag = false;
if (worldAmount == 0)
{
menu.addSection("New Save", true, true);
menu.addSection("1.Exit", true, true);
while (exitFlag == false)
{
menu.update();
if (menu.isSectionActivated())
{
switch (menu.getActivatedSection())
{
case 1: game.saveWorld();
case 2: exitFlag = true; break;
}
}
}
}
else
{
for (int i = 1; i <= worldAmount; i++)
{
stringstream filename;
if (i < 10)
{
filename << "World" << "0" << i << ".dat";
}
else
{
filename << "World" << i << ".dat";
}
menu.addSection(filename.str(), true, true);
}
menu.addSection("New Save", true, true);
menu.addSection("Exit", true, true);
}
while (exitFlag == false)
{
menu.update();
if (menu.isSectionActivated())
{
if (menu.getActivatedSection() == worldAmount + 1)
{
exitFlag = true;
game.saveWorld();
continue;
}
if (menu.getActivatedSection() == worldAmount + 2)
{
exitFlag = true;
continue;
}
stringstream filename;
if (menu.getActivatedSection()<10)
{
filename << "Saves\\" << "World" << "0" << menu.getActivatedSection() << ".dat";
game.saveWorld(filename.str());
exitFlag = true;
}
else
{
filename << "Saves\\" << "World" << menu.getActivatedSection() << ".dat";
game.saveWorld(filename.str());
exitFlag = true;
}
}
}
menu.isHidden(true);
Sleep(250);
return;
}
示例2: loadMenu
void loadMenu(Display& game)
{
clearScreenPart(DEFAULT_CLEAR_WIDTH, DEFAULT_CLEAR_HEIGHT);
Sleep(500);
UserInterface menu(0, 0, 0, 0);
int worldAmount = game.getSaveAmount();
bool exitFlag = false;
if (worldAmount == 0)
{
menu.addSection("No Saves...", false, true);
menu.addSection("Exit", true, true);
while (exitFlag == false)
{
menu.update();
if (menu.isSectionActivated())
{
clearScreenPart(DEFAULT_CLEAR_WIDTH, DEFAULT_CLEAR_HEIGHT);
exitFlag = true;
}
}
}
else
{
for (int i = 1; i <= worldAmount; i++)
{
stringstream filename;
if (i < 10)
{
filename << "World" << "0" << i << ".dat";
}
else
{
filename << "World" << i << ".dat";
}
menu.addSection(filename.str(), true, true);
}
menu.addSection("Exit", true, true);
}
while (exitFlag == false)
{
menu.update();
if (menu.isSectionActivated())
{
if (menu.getActivatedSection() == worldAmount + 1)
{
clearScreenPart(DEFAULT_CLEAR_WIDTH, DEFAULT_CLEAR_HEIGHT);
exitFlag = true;
continue;
}
stringstream filename;
if (menu.getActivatedSection()<10)
{
clearScreenPart(DEFAULT_CLEAR_WIDTH, DEFAULT_CLEAR_HEIGHT);
filename << "Saves\\" << "World" << "0" << menu.getActivatedSection() << ".dat";
game.loadWorld(filename.str());
exitFlag = true;
}
else
{
clearScreenPart(DEFAULT_CLEAR_WIDTH, DEFAULT_CLEAR_HEIGHT);
filename << "Saves\\" << "World" << menu.getActivatedSection() << ".dat";
game.loadWorld(filename.str());
exitFlag = true;
}
}
}
menu.isHidden(true);
Sleep(250);
return;
}