コード例 #1
0
ファイル: wince-sdl.cpp プロジェクト: 0xf1sh/scummvm
void OSystem_WINCE3::check_mappings() {
	CEActionsPocket *instance;

	Common::String gameid(ConfMan.get("gameid"));

	if (gameid.empty() || GUI_Actions::Instance()->initialized())
		return;

	GUI_Actions::Instance()->initInstanceGame();
	instance = (CEActionsPocket *)GUI_Actions::Instance();

	// Some games need to map the right click button, signal it here if it wasn't done
	if (instance->needsRightClickMapping()) {
		GUI::KeysDialog *keysDialog = new GUI::KeysDialog(_("Map right click action"));
		while (!instance->getMapping(POCKET_ACTION_RIGHTCLICK)) {
			keysDialog->runModal();
			if (!instance->getMapping(POCKET_ACTION_RIGHTCLICK)) {
				GUI::MessageDialog alert(_("You must map a key to the 'Right Click' action to play this game"));
				alert.runModal();
			}
		}
		delete keysDialog;
	}

	// Map the "hide toolbar" action if needed
	if (instance->needsHideToolbarMapping()) {
		GUI::KeysDialog *keysDialog = new GUI::KeysDialog(_("Map hide toolbar action"));
		while (!instance->getMapping(POCKET_ACTION_HIDE)) {
			keysDialog->runModal();
			if (!instance->getMapping(POCKET_ACTION_HIDE)) {
				GUI::MessageDialog alert(_("You must map a key to the 'Hide toolbar' action to play this game"));
				alert.runModal();
			}
		}
		delete keysDialog;
	}

	// Map the "zoom" actions if needed
	if (instance->needsZoomMapping()) {
		GUI::KeysDialog *keysDialog = new GUI::KeysDialog(_("Map Zoom Up action (optional)"));
		keysDialog->runModal();
		delete keysDialog;
		keysDialog = new GUI::KeysDialog(_("Map Zoom Down action (optional)"));
		keysDialog->runModal();
		delete keysDialog;
	}

	// Extra warning for Zak Mc Kracken
	if (strncmp(gameid.c_str(), "zak", 3) == 0 &&
	        !GUI_Actions::Instance()->getMapping(POCKET_ACTION_HIDE)) {
		GUI::MessageDialog alert(_("Don't forget to map a key to 'Hide Toolbar' action to see the whole inventory"));
		alert.runModal();
	}

}
コード例 #2
0
bool CEActionsPocket::perform(GUI::ActionType action, bool pushed) {
	static bool keydialogrunning = false, quitdialog = false;

	if (!pushed) {
		switch(action) {
		case POCKET_ACTION_RIGHTCLICK:
			_CESystem->add_right_click(false);
			return true;
		case POCKET_ACTION_LEFTCLICK:
			_CESystem->add_left_click(false);
			return true;
		case POCKET_ACTION_PAUSE:
		case POCKET_ACTION_SAVE:
		case POCKET_ACTION_SKIP:
		case POCKET_ACTION_MULTI:
			EventsBuffer::simulateKey(&_key_action[action], false);
			return true;

		}
		return false;
	}

	switch (action) {
		case POCKET_ACTION_PAUSE:
		case POCKET_ACTION_SAVE:
		case POCKET_ACTION_SKIP:
		case POCKET_ACTION_MULTI:
			if (action == POCKET_ACTION_SAVE && ConfMan.get("gameid") == "parallaction") {
				// FIXME: This is a temporary solution. The engine should handle its own menus.
				// Note that the user can accomplish this via the virtual keyboard as well, this is just for convenience
				GUI::MessageDialog alert("Do you want to load or save the game?", "Load", "Save");
				if (alert.runModal() == GUI::kMessageOK)
					_key_action[action].setKey(SDLK_l);
				else
					_key_action[action].setKey(SDLK_s);
			}
			EventsBuffer::simulateKey(&_key_action[action], true);
			return true;
		case POCKET_ACTION_KEYBOARD:
			_CESystem->swap_panel();
			return true;
		case POCKET_ACTION_HIDE:
			_CESystem->swap_panel_visibility();
			return true;
		case POCKET_ACTION_SOUND:
			_CESystem->swap_sound_master();
			return true;
		case POCKET_ACTION_RIGHTCLICK:
			_CESystem->add_right_click(true);
			return true;
		case POCKET_ACTION_CURSOR:
			_CESystem->swap_mouse_visibility();
			return true;
		case POCKET_ACTION_FREELOOK:
			_CESystem->swap_freeLook();
			return true;
		case POCKET_ACTION_ZOOM_UP:
			_CESystem->swap_zoom_up();
			return true;
		case POCKET_ACTION_ZOOM_DOWN:
			_CESystem->swap_zoom_down();
			return true;
		case POCKET_ACTION_LEFTCLICK:
			_CESystem->add_left_click(true);
			return true;
		case POCKET_ACTION_UP:
			_CESystem->move_cursor_up();
			return true;
		case POCKET_ACTION_DOWN:
			_CESystem->move_cursor_down();
			return true;
		case POCKET_ACTION_LEFT:
			_CESystem->move_cursor_left();
			return true;
		case POCKET_ACTION_RIGHT:
			_CESystem->move_cursor_right();
			return true;
		case POCKET_ACTION_QUIT:
			if (!quitdialog) {
				quitdialog = true;
				GUI::MessageDialog alert("   Are you sure you want to quit ?   ", "Yes", "No");
				if (alert.runModal() == GUI::kMessageOK)
					_mainSystem->quit();
				quitdialog = false;
			}
			return true;
		case POCKET_ACTION_BINDKEYS:
			if (!keydialogrunning) {
				keydialogrunning = true;
				GUI::KeysDialog *keysDialog = new GUI::KeysDialog();
				keysDialog->runModal();
				delete keysDialog;
				keydialogrunning = false;
			}
			return true;
	}
	return false;
}
コード例 #3
0
bool CEActionsSmartphone::perform(GUI::ActionType action, bool pushed) {
	static bool keydialogrunning = false, quitdialog = false;

	if (!pushed) {
		switch (action) {
		case SMARTPHONE_ACTION_RIGHTCLICK:
			//_CESystem->add_right_click(false);
			((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->add_right_click(false);
			return true;
		case SMARTPHONE_ACTION_LEFTCLICK:
			//_CESystem->add_left_click(false);
			((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->add_left_click(false);
			return true;
		case SMARTPHONE_ACTION_SAVE:
		case SMARTPHONE_ACTION_SKIP:
		case SMARTPHONE_ACTION_MULTI:
			EventsBuffer::simulateKey(&_key_action[action], false);
			return true;
		}
		return false;
	}

	switch (action) {
	case SMARTPHONE_ACTION_SAVE:
	case SMARTPHONE_ACTION_SKIP:
	case SMARTPHONE_ACTION_MULTI:
		if (action == SMARTPHONE_ACTION_SAVE && ConfMan.get("gameid") == "parallaction") {
			// FIXME: This is a temporary solution. The engine should handle its own menus.
			// Note that the user can accomplish this via the virtual keyboard as well, this is just for convenience
			GUI::MessageDialog alert(_("Do you want to load or save the game?"), _("Load"), _("Save"));
			if (alert.runModal() == GUI::kMessageOK)
				_key_action[action].setKey(SDLK_l);
			else
				_key_action[action].setKey(SDLK_s);
		}
		EventsBuffer::simulateKey(&_key_action[action], true);
		return true;
	case SMARTPHONE_ACTION_RIGHTCLICK:
		//_CESystem->add_right_click(true);
		((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->add_right_click(true);
		return true;
	case SMARTPHONE_ACTION_LEFTCLICK:
		//_CESystem->add_left_click(true);
		((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->add_left_click(true);
		return true;
	case SMARTPHONE_ACTION_UP:
		//_CESystem->move_cursor_up();
		((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->move_cursor_up();
		return true;
	case SMARTPHONE_ACTION_DOWN:
		//_CESystem->move_cursor_down();
		((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->move_cursor_down();
		return true;
	case SMARTPHONE_ACTION_LEFT:
		//_CESystem->move_cursor_left();
		((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->move_cursor_left();
		return true;
	case SMARTPHONE_ACTION_RIGHT:
		//_CESystem->move_cursor_right();
		((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->move_cursor_right();
		return true;
	case SMARTPHONE_ACTION_ZONE:
		//_CESystem->switch_zone();
		((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->switch_zone();
		return true;
	case SMARTPHONE_ACTION_BINDKEYS:
		if (!keydialogrunning) {
			keydialogrunning = true;
			GUI::KeysDialog *keysDialog = new GUI::KeysDialog();
			keysDialog->runModal();
			delete keysDialog;
			keydialogrunning = false;
		}
		return true;
	case SMARTPHONE_ACTION_KEYBOARD:
		//_CESystem->swap_smartphone_keyboard();
		((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->swap_smartphone_keyboard();
		return true;
	case SMARTPHONE_ACTION_ROTATE:
		//_CESystem->smartphone_rotate_display();
		((WINCESdlGraphicsManager *)((OSystem_SDL *)g_system)->getGraphicsManager())->smartphone_rotate_display();
		return true;
	case SMARTPHONE_ACTION_QUIT:
		if (!quitdialog) {
			quitdialog = true;
			GUI::MessageDialog alert(_("   Are you sure you want to quit ?   "), _("Yes"), _("No"));
			if (alert.runModal() == GUI::kMessageOK)
				_mainSystem->quit();
			quitdialog = false;
		}
		return true;
	}

	return false;
}