コード例 #1
0
ファイル: GameStateLoad.cpp プロジェクト: ZabinX/concordia
void GameStateLoad::logicLoading() {
	// load an existing game
	GameStatePlay* play = new GameStatePlay();
	play->resetGame();
	play->game_slot = selected_slot + 1;
	play->loadGame();
	requestedGameState = play;
	loaded = true;
	loading = false;
}
コード例 #2
0
ファイル: GameStateLoad.cpp プロジェクト: fcxSanya/flare
void GameStateLoad::logic() {

	frame_ticker++;
	if (frame_ticker == 64) frame_ticker = 0;
	if (frame_ticker < 32)
		current_frame = frame_ticker / 8;
	else
		current_frame = (63 - frame_ticker) / 8;

	if (button_exit->checkClick()) {
		requestedGameState = new GameStateTitle(screen, inp, font);
	}
	
	if (button_action->checkClick()) {
		if (stats[selected_slot].name == "") {
			// create a new game
			GameStateNew* newgame = new GameStateNew(screen, inp, font);
			newgame->game_slot = selected_slot + 1;
			requestedGameState = newgame;
		}
		else {
			// load an existing game
			GameStatePlay* play = new GameStatePlay(screen, inp, font);
			play->resetGame();
			play->game_slot = selected_slot + 1;
			play->loadGame();
			requestedGameState = play;
		}
	}
	
	// check clicking game slot
	if (inp->pressing[MAIN1] && !inp->lock[MAIN1]) {
		for (int i=0; i<GAME_SLOT_MAX; i++) {
			if (isWithin(slot_pos[i], inp->mouse)) {
				selected_slot = i;
				inp->lock[MAIN1] = true;
				loadPortrait(selected_slot);
				
				button_action->enabled = true;
				if (stats[selected_slot].name == "") {
					button_action->label = "New Game";
				}
				else {
					button_action->label = "Load Game";
				}
			}
		}
	}
}
コード例 #3
0
void GameStateCutscene::logic() {

	if (scenes.empty()) {
		if (game_slot != -1) {
			GameStatePlay *gsp = new GameStatePlay();
			gsp->resetGame();
			gsp->game_slot = game_slot;
			gsp->loadGame();

			previous_gamestate = gsp;
		}

		/* return to previous gamestate */
		delete requestedGameState;
		requestedGameState = previous_gamestate;
		return;
	}

	while (!scenes.empty() && !scenes.front().logic(&caption_margins, scale_graphics))
		scenes.pop();
}