当前位置: 首页>>代码示例>>C++>>正文


C++ saveGame函数代码示例

本文整理汇总了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);
}
开发者ID:Templier,项目名称:scummvm,代码行数:25,代码来源:processor_streams.cpp

示例2: floor

void GameStatePlay::checkSaveEvent() {
	if (mapr->save_game) {
		mapr->respawn_point = floor(pc->stats.pos);
		saveGame();
		mapr->save_game = false;
	}
}
开发者ID:fkeet,项目名称:flare-engine,代码行数:7,代码来源:GameStatePlay.cpp

示例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;
	}
}
开发者ID:Argeath,项目名称:Tetris,代码行数:34,代码来源:Game.cpp

示例4: saveAs

bool MainWindow::save()
{
	if (m_currentFile.isEmpty())
		return saveAs();

	return saveGame(m_currentFile);
}
开发者ID:thesmartwon,项目名称:OpenChess,代码行数:7,代码来源:mainwindow.cpp

示例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);
}
开发者ID:BenCastricum,项目名称:scummvm,代码行数:25,代码来源:saveload.cpp

示例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;
}
开发者ID:fkeet,项目名称:flare-engine,代码行数:33,代码来源:GameStatePlay.cpp

示例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);
}
开发者ID:ArtChecnokov,项目名称:conway,代码行数:26,代码来源:mainwindow.cpp

示例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();
	}
}
开发者ID:fkeet,项目名称:flare-engine,代码行数:30,代码来源:GameStatePlay.cpp

示例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;
}
开发者ID:AdamRi,项目名称:scummvm-pink,代码行数:7,代码来源:saveload.cpp

示例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;
                     }
                     
}
开发者ID:tpaveyjr,项目名称:pimpquest,代码行数:30,代码来源:save.c

示例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()));
}
开发者ID:zoness32,项目名称:BrickBreak,代码行数:7,代码来源:gamescreen.cpp

示例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;
}
开发者ID:vladimir-zahradnik,项目名称:scummvm,代码行数:35,代码来源:savegame.cpp

示例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;
			}
		}
	}
}
开发者ID:Jamal-Ra-Davis,项目名称:RPG-Game,代码行数:35,代码来源:game_hub.cpp

示例14: saveGame

Client::~Client() {
	if(gameInProgress) {
		saveGame(false);
		clearGameKeys();
	}
	close(sd);
}
开发者ID:fourks,项目名称:Openspy-Core,代码行数:7,代码来源:Client.cpp

示例15: saveGame

/**
 * Saves the selected save.
 * @param action Pointer to an action.
 */
void ListSaveState::btnSaveGameClick(Action *)
{
	if (_selectedRow != -1)
	{
		saveGame();
	}
}
开发者ID:AMDmi3,项目名称:OpenXcom,代码行数:11,代码来源:ListSaveState.cpp


注:本文中的saveGame函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。