本文整理汇总了C++中saveGame函数的典型用法代码示例。如果您正苦于以下问题:C++ saveGame函数的具体用法?C++ saveGame怎么用?C++ saveGame使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了saveGame函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: glk_fileref_create_by_prompt
void Processor::z_save() {
bool success = false;
if (zargc != 0) {
// Open auxilary file
frefid_t ref = glk_fileref_create_by_prompt(fileusage_Data | fileusage_BinaryMode,
filemode_Write, 0);
if (ref != nullptr) {
// Write data
strid_t f = glk_stream_open_file(ref, filemode_Write);
glk_put_buffer_stream(f, (const char *)zmp + zargs[0], zargs[1]);
glk_stream_close(f);
success = true;
}
} else {
success = saveGame().getCode() == Common::kNoError;
}
if (h_version <= V3)
branch(success);
else
store(success);
}
示例2: floor
void GameStatePlay::checkSaveEvent() {
if (mapr->save_game) {
mapr->respawn_point = floor(pc->stats.pos);
saveGame();
mapr->save_game = false;
}
}
示例3: switch
void Game::handleKeys(SDL_Keycode key) {
switch (key) {
case SDLK_s: {
if (stage < 10) {
stage++;
lastStageUp = 0;
}
break;
}
case SDLK_F3:
saveGame();
break;
case SDLK_l:
case SDLK_F4:
loadGame();
break;
case SDLK_p:
pause = !pause;
break;
case SDLK_DOWN:
tempSpeedUp = true;
break;
case SDLK_UP:
case SDLK_SPACE:
brick->toRotate = true;
break;
case SDLK_LEFT:
lastPressedKey = LEFT;
break;
case SDLK_RIGHT:
lastPressedKey = RIGHT;
break;
}
}
示例4: saveAs
bool MainWindow::save()
{
if (m_currentFile.isEmpty())
return saveAs();
return saveGame(m_currentFile);
}
示例5: _
bool StarTrekEngine::showSaveMenu() {
GUI::SaveLoadChooser *dialog;
Common::String desc;
int slot;
dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"), true);
slot = dialog->runModalWithCurrentTarget();
desc = dialog->getResultString();
if (desc.empty()) {
// create our own description for the saved game, the user didnt enter it
desc = dialog->createDefaultSaveDescription(slot);
}
if (desc.size() > 28)
desc = Common::String(desc.c_str(), 28);
delete dialog;
if (slot < 0)
return true;
return saveGame(slot, desc);
}
示例6: GameStateCutscene
void GameStatePlay::checkCutscene() {
if (!mapr->cutscene)
return;
GameStateCutscene *cutscene = new GameStateCutscene(NULL);
if (!cutscene->load(mapr->cutscene_file)) {
delete cutscene;
mapr->cutscene = false;
return;
}
// handle respawn point and set game play game_slot
cutscene->game_slot = game_slot;
if (mapr->teleportation) {
if (mapr->teleport_mapname != "")
mapr->respawn_map = mapr->teleport_mapname;
mapr->respawn_point = mapr->teleport_destination;
}
else {
mapr->respawn_point = floor(pc->stats.pos);
}
if (SAVE_ONLOAD)
saveGame();
delete requestedGameState;
requestedGameState = cutscene;
}
示例7: QMainWindow
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow),
currentColor(QColor("#000")),
game(new GameWidget(this))
{
ui->setupUi(this);
QPixmap icon(16, 16);
icon.fill(currentColor);
ui->colorButton->setIcon( QIcon(icon) );
connect(ui->startButton, SIGNAL(clicked()), game,SLOT(startGame()));
connect(ui->stopButton, SIGNAL(clicked()), game,SLOT(stopGame()));
connect(ui->clearButton, SIGNAL(clicked()), game,SLOT(clear()));
connect(ui->iterInterval, SIGNAL(valueChanged(int)), game, SLOT(setInterval(int)));
connect(ui->cellsControl, SIGNAL(valueChanged(int)), game, SLOT(setCellNumber(int)));
connect(ui->colorButton, SIGNAL(clicked()), this, SLOT(selectMasterColor()));
connect(ui->saveButton, SIGNAL(clicked()), this, SLOT(saveGame()));
connect(ui->loadButton, SIGNAL(clicked()), this, SLOT(loadGame()));
ui->mainLayout->setStretchFactor(ui->gameLayout, 8);
ui->mainLayout->setStretchFactor(ui->setLayout, 2);
ui->gameLayout->addWidget(game);
}
示例8: if
void GameStatePlay::checkStash() {
if (mapr->stash) {
// If triggered, open the stash and inventory menus
menu->closeAll();
menu->inv->visible = true;
menu->stash->visible = true;
mapr->stash = false;
}
else if (menu->stash->visible) {
// Close stash if inventory is closed
if (!menu->inv->visible) {
menu->resetDrag();
menu->stash->visible = false;
}
// If the player walks away from the stash, close its menu
float interact_distance = calcDist(pc->stats.pos, mapr->stash_pos);
if (interact_distance > INTERACT_RANGE || !pc->stats.alive) {
menu->resetDrag();
menu->stash->visible = false;
}
}
// If the stash has been updated, save the game
if (menu->stash->updated) {
menu->stash->updated = false;
saveGame();
}
}
示例9: getSavegameFilename
Common::Error AgiEngine::saveGameState(int slot, const Common::String &desc) {
Common::String saveLoadSlot = getSavegameFilename(slot);
if (saveGame(saveLoadSlot, desc) == errOK)
return Common::kNoError;
else
return Common::kUnknownError;
}
示例10: saveMenu
saveMenu() {
int input;
printf("*********** PIMP QUEST ***************\n");
printf("1. New Game\n");
printf("2. Load Previous Game\n");
printf("3. Save Game\n");
printf("Selection: ");
scanf("%d", &input);
switch (input) {
case 1:
system("cls");
newGame();
break;
case 2:
system("cls");
loadgame();
break;
case 3:
system("cls");
saveGame();
break;
default:
system("cls");
printf("Something happened that wasn't supposed to..exiting.");
break;
}
}
示例11: QAction
void GameScreen::createActions()
{
quit = new QAction("Main Menu", this);
connect(quit, SIGNAL(triggered()), this, SLOT(returnToMenu()));
save = new QAction("Save and Quit", this);
connect(save, SIGNAL(triggered()), dynamic_cast<startup*>(this->parent()), SLOT(saveGame()));
}
示例12: saveOrLoad
bool LabEngine::saveRestoreGame() {
bool isOK = false;
// The original had one screen for saving/loading. We have two.
// Ask the user which screen to use.
GUI::MessageDialog saveOrLoad(_("Would you like to save or restore a game?"), _("Save"), _("Restore"));
int choice = saveOrLoad.runModal();
if (choice == GUI::kMessageOK) {
// Save
GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"), true);
int slot = dialog->runModalWithCurrentTarget();
if (slot >= 0) {
Common::String desc = dialog->getResultString();
if (desc.empty()) {
// create our own description for the saved game, the user didn't enter it
desc = dialog->createDefaultSaveDescription(slot);
}
isOK = saveGame(slot, desc);
}
delete dialog;
} else {
// Restore
GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Restore game:"), _("Restore"), false);
int slot = dialog->runModalWithCurrentTarget();
if (slot >= 0) {
isOK = loadGame(slot);
}
delete dialog;
}
return isOK;
}
示例13: while
void game_hub::hubMenu()
{
bool hubMenu = true;
while (hubMenu)
{
printf("Hub Menu\n");
printf("----------------------\n");
int menu_sel = getSel("1. Open Party Menu", "2. Manage Characters",
"3. Save Game", "4. Cancel");
switch (menu_sel)
{
case 1://Open party menu
{
Team->partyMenu();
break;
}
case 2://Manage Characters
{
Team->managePlayers();
break;
}
case 3://Save Game
{
saveGame();
break;
}
case 4://Cancel
{
printf("Cancelling action...\n");
hubMenu = false;
break;
}
}
}
}
示例14: saveGame
Client::~Client() {
if(gameInProgress) {
saveGame(false);
clearGameKeys();
}
close(sd);
}
示例15: saveGame
/**
* Saves the selected save.
* @param action Pointer to an action.
*/
void ListSaveState::btnSaveGameClick(Action *)
{
if (_selectedRow != -1)
{
saveGame();
}
}