本文整理汇总了C++中TCODZip::loadFromFile方法的典型用法代码示例。如果您正苦于以下问题:C++ TCODZip::loadFromFile方法的具体用法?C++ TCODZip::loadFromFile怎么用?C++ TCODZip::loadFromFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TCODZip
的用法示例。
在下文中一共展示了TCODZip::loadFromFile方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: load
void Engine::load()
{
TCODZip zip;
zip.loadFromFile("game.sav");
//load the map
int width=zip.getInt();
int height=zip.getInt();
map = new Map(width,height);
map->load(zip);
//then the player
player=new Actor(0,0,0,NULL,TCODColor::white);
player->load(zip);
map->actors.push(player);
// the stairs
stairs=new Actor(0,0,0,NULL,TCODColor::white);
stairs->load(zip);
map->actors.push(stairs);
map->sendToBack(stairs);
//then all other actors
int nbActors=zip.getInt();
while (nbActors > 0)
{
Actor *actor = new Actor(0,0,0,NULL,TCODColor::white);
actor->load(zip);
map->actors.push(actor);
map->sendToBack(actor);
nbActors--;
}
//finally the message log
topGui->load(zip);
}
示例2: Load
void Engine::Load(void)
{
engine.gui_->menu_.Clear();
engine.gui_->menu_.AddItem(Menu::NEW_GAME, "New game");
if (TCODSystem::fileExists("game.sav")) {
engine.gui_->menu_.AddItem(Menu::CONTINUE, "Continue");
}
engine.gui_->menu_.AddItem(Menu::EXIT, "Exit");
Menu::MenuItemCode menuItem = engine.gui_->menu_.Pick();
if ((menuItem == Menu::EXIT) || (menuItem == Menu::NONE )) {
// Exit or window closed
exit(0);
} else if (menuItem == Menu::NEW_GAME) {
// New game
engine.Term();
engine.Init();
} else {
TCODZip zip;
// continue a saved game
engine.Term();
zip.loadFromFile("game.sav");
// load the map
int32_t width = zip.getInt();
int32_t height = zip.getInt();
map_ = new Map(width, height);
map_->Load(zip);
// then the player
player_ = new Actor(0, 0, 0, NULL, TCODColor::white);
actors_.push(player_);
player_->Load(zip);
// then all other actors
int32_t nbActors = zip.getInt();
while (nbActors > 0) {
Actor *actor = new Actor(0, 0, 0, NULL, TCODColor::white);
actor->Load(zip);
actors_.push(actor);
nbActors--;
}
// finally the message log
gui_->Load(zip);
// to force FOV recomputation
gameStatus = STARTUP;
}
}
示例3: if
void
Engine::Load(bool pause) {
bool shouldLeave = false;
TCODZip zip;
while(!shouldLeave) {
TCODConsole::root->clear();
TCODConsole::setFade(255, TCODColor::black);
e->gui->menu.Clear();
e->gui->menu.AddItem(Menu::MIC_NEW_GAME, "New Game");
if(TCODSystem::fileExists("game.sav")) {
zip.loadFromFile("game.sav");
int version = zip.getInt();
if(version == SAVEGAME_VERSION) {
e->gui->menu.AddItem(Menu::MIC_CONTINUE, "Continue");
}
}
e->gui->menu.AddItem(Menu::MIC_EXIT, "Exit");
Menu::menu_item_code menuItem = e->gui->menu.Pick(true, 2, 2);
if(menuItem == Menu::MIC_EXIT || menuItem == Menu::MIC_NONE) {
e->leaveGame = true;
shouldLeave = true;
}
else if(menuItem == Menu::MIC_NEW_GAME) {
shouldLeave = true;
}
else if(menuItem == Menu::MIC_CONTINUE) {
shouldLeave = true;
e->Close();
int width = zip.getInt();
int height = zip.getInt();
map = new Map(width, height);
map->Load(zip);
player = new Actor(0, 0);
e->AddActorToArena(player);
player->Load(zip);
int numberOfallActors = zip.getInt();
while(numberOfallActors > 0) {
Actor* actor = new Actor(0, 0);
actor->Load(zip);
e->AddActorToWorld(actor);
numberOfallActors--;
}
gui->Load(zip);
gameStatus = GAME_STATUS_MAIN;
}
}
}