• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ saveGame函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中saveGame函数的典型用法代码示例。如果您正苦于以下问题:C++ saveGame函数的具体用法?C++ saveGame怎么用?C++ saveGame使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了saveGame函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: saveGameInSlot

static void saveGameInSlot()
{
	saveGame(menu.index - 1);

	freeMessageQueue();

	setInfoBoxMessage(60, 255, 255, 255, _("Game Saved"));

	pauseGame();
}
开发者ID:polluks,项目名称:edgar,代码行数:10,代码来源:io_menu.c


示例17: saveGameByCommand

/*
 * Main function for handling the "save" command, for saving a game during the game stage.
 *
 * @return: -9 if an error occured during the saving of the file or if the specified name does not end with ".xml"
 *			 0 otherwise
 */
int saveGameByCommand(char* command){
	char path[1024];
	if (sscanf(command, "save %1023s", path) != 1){
		return -1;
	}
	if (!strstr(path, ".xml")){
		return -9;
	}
	return saveGame(path);
}
开发者ID:eternalStudent,项目名称:Chess-C-Project,代码行数:16,代码来源:Chess.c


示例18: QLatin1String

void FastQSPWindow::saveGameDialog() {
  QString filename = QFileDialog::getSaveFileName(
      this, "Save Game", saveDir.absolutePath(), "QSP save-game (*.sav)");
  if (!filename.isEmpty() &&
      !filename.endsWith(QLatin1String(".sav"), Qt::CaseInsensitive))
    filename += QLatin1String(".sav");
// New save system
//  qspJack->saveGameStatus(filename);
  saveGame(filename);
}
开发者ID:ItalianSunglassMovie,项目名称:FastQSP,代码行数:10,代码来源:fastqspwindow.cpp


示例19: saveGame

Common::Error Sword2Engine::saveGameState(int slot, const char *desc) {
	uint32 saveVal = saveGame(slot, (const byte *)desc);

	if (saveVal == SR_OK)
		return Common::kNoError;
	else if (saveVal == SR_ERR_WRITEFAIL || saveVal == SR_ERR_FILEOPEN)
		return Common::kWritingFailed;
	else
		return Common::kUnknownError;
}
开发者ID:jweinberg,项目名称:scummvm,代码行数:10,代码来源:sword2.cpp


示例20: exitFunc

void exitFunc(int value) {
    muteSND();
    if (!autoSavingEnabled && numRamBanks && !gbsMode) {
        printMenuMessage("Saving SRAM...");
        saveGame();
    }
    printMessage[0] = '\0';
    closeMenu();
    selectRom();
}
开发者ID:xdpirate,项目名称:GameYob,代码行数:10,代码来源:console.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ saveGeometry函数代码示例发布时间:2022-05-30
下一篇:
C++ saveFile函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap