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


C++ window::video方法代码示例

本文整理汇总了C++中window::video方法的典型用法代码示例。如果您正苦于以下问题:C++ window::video方法的具体用法?C++ window::video怎么用?C++ window::video使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在window的用法示例。


在下文中一共展示了window::video方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: post_build

void lobby_main::post_build(window& win)
{
	/** @todo Should become a global hotkey after 1.8, then remove it here. */
	win.register_hotkey(hotkey::HOTKEY_FULLSCREEN, std::bind(fullscreen, std::ref(win.video())));

	/*** Local hotkeys. ***/
	win.register_hotkey(hotkey::HOTKEY_PREFERENCES, [this](event::dispatcher& w, hotkey::HOTKEY_COMMAND)->bool {
		show_preferences_button_callback(dynamic_cast<window&>(w));
		return true;
	});
}
开发者ID:doofus-01,项目名称:wesnoth,代码行数:11,代码来源:lobby.cpp

示例2: select_leader_callback

void mp_staging::select_leader_callback(window& window, ng::side_engine_ptr side, grid& row_grid)
{
	gui2::dialogs::faction_select dlg(side->flg(), std::to_string(side->color() + 1), side->index() + 1);
	dlg.show(window.video());

	if(dlg.get_retval() == window::OK) {
		update_leader_display(side, row_grid);

		set_state_changed();
	}
}
开发者ID:doofus-01,项目名称:wesnoth,代码行数:11,代码来源:mp_staging.cpp

示例3: debug_tooltip

/*
 * This function is used to test the tooltip placement algorithms as
 * described in the »Tooltip placement« section in the GUI2 design
 * document.
 *
 * Use a 1024 x 768 screen size, set the maximum loop iteration to:
 * - 0   to test with a normal tooltip placement.
 * - 30  to test with a larger normal tooltip placement.
 * - 60  to test with a huge tooltip placement.
 * - 150 to test with a borderline to insanely huge tooltip placement.
 * - 180 to test with an insanely huge tooltip placement.
 */
static void debug_tooltip(window& window, bool& handled, const point& coordinate)
{
	std::string message = "Hello world.";

	for(int i = 0; i < 0; ++i) {
		message += " More greetings.";
	}

	gui2::tip::remove();
	gui2::tip::show(window.video(), "tooltip", message, coordinate);

	handled = true;
}
开发者ID:,项目名称:,代码行数:25,代码来源:

示例4: pre_show

void campaign_selection::pre_show(window& window)
{
	/***** Setup campaign tree. *****/
	tree_view& tree = find_widget<tree_view>(&window, "campaign_tree", false);

	tree.set_selection_change_callback(
		std::bind(&campaign_selection::campaign_selected, this, std::ref(window)));

	window.keyboard_capture(&tree);

	/***** Setup campaign details. *****/
	multi_page& pages = find_widget<multi_page>(&window, "campaign_details", false);

	unsigned id = 0;
	for(const auto & level : engine_.get_levels_by_type_unfiltered(ng::level::TYPE::SP_CAMPAIGN)) {
		const config& campaign = level->data();

		/*** Add tree item ***/
		std::map<std::string, string_map> data;
		string_map item;

		item["label"] = campaign["icon"];
		data.emplace("icon", item);

		item["label"] = campaign["name"];
		data.emplace("name", item);

		item["label"] = campaign["completed"].to_bool() ? "misc/laurel.png" : "misc/blank-hex.png";
		data.emplace("victory", item);

		tree.add_node("campaign", data).set_id(std::to_string(id++));

		/*** Add detail item ***/
		item.clear();
		data.clear();

		item["label"] = campaign["description"];
		item["use_markup"] = "true";

		if(!campaign["description_alignment"].empty()) {
			item["text_alignment"] = campaign["description_alignment"];
		}

		data.emplace("description", item);

		item["label"] = campaign["image"];
		data.emplace("image", item);

		pages.add_page(data);
	}

	if(!engine_.get_const_extras_by_type(ng::create_engine::MOD).empty()) {
		std::map<std::string, string_map> data;
		string_map item;

		item["label"] = "Modifications";
		data.emplace("tree_view_node_label", item);

		tree_view_node& mods_node = tree.add_node("campaign_group", data);
		std::vector<std::string> enabled = engine_.active_mods();

		id = 0;
		for(const auto& mod : engine_.get_const_extras_by_type(ng::create_engine::MOD)) {
			data.clear();
			item.clear();

			bool active = std::find(enabled.begin(), enabled.end(), mod->id) != enabled.end();

			/*** Add tree item ***/
			item["label"] = mod->name;
			data.emplace("checkb", item);

			tree_view_node& node = mods_node.add_child("modification", data);

			toggle_button* checkbox = dynamic_cast<toggle_button*>(node.find("checkb", true));
			VALIDATE(checkbox, missing_widget("checkb"));

			checkbox->set_value(active);
			checkbox->set_label(mod->name);
			checkbox->set_callback_state_change(std::bind(&campaign_selection::mod_toggled, this, id, _1));

			++id;
		}
	}

	campaign_selected(window);

	/***** Setup advanced settings button *****/
	button* advanced_settings_button =
			find_widget<button>(&window, "advanced_settings", false, false);
	if(advanced_settings_button) {
		advanced_settings_button->connect_click_handler(
			std::bind(&campaign_selection::show_settings, this, std::ref(window.video())));
	}
}
开发者ID:doofus-01,项目名称:wesnoth,代码行数:95,代码来源:campaign_selection.cpp

示例5: pre_show

void title_screen::pre_show(window& win)
{
	win.set_click_dismiss(false);
	win.set_enter_disabled(true);
	win.set_escape_disabled(true);

	// Each time the dialog shows, we set this to false
	redraw_background_ = false;

#ifdef DEBUG_TOOLTIP
	win.connect_signal<event::SDL_MOUSE_MOTION>(
			std::bind(debug_tooltip, std::ref(win), _3, _5),
			event::dispatcher::front_child);
#endif

	win.connect_signal<event::SDL_VIDEO_RESIZE>(std::bind(&title_screen::on_resize, this, std::ref(win)));

	//
	// General hotkeys
	//
	win.register_hotkey(hotkey::TITLE_SCREEN__RELOAD_WML, [](event::dispatcher& w, hotkey::HOTKEY_COMMAND) {
		dynamic_cast<window&>(w).set_retval(RELOAD_GAME_DATA);
		return true;
	});

	win.register_hotkey(hotkey::HOTKEY_FULLSCREEN, std::bind(fullscreen, std::ref(win.video())));
	win.register_hotkey(hotkey::LUA_CONSOLE, std::bind(&launch_lua_console, std::ref(win)));

	//
	// Background and logo images
	//
	if(game_config::images::game_title.empty()) {
		ERR_CF << "No title image defined" << std::endl;
	} 

	win.get_canvas()[0].set_variable("title_image", variant(game_config::images::game_title));

	if(game_config::images::game_title_background.empty()) {
		ERR_CF << "No title background image defined" << std::endl;
	}

	win.get_canvas()[0].set_variable("background_image", variant(game_config::images::game_title_background));

	find_widget<image>(&win, "logo-bg", false).set_image(game_config::images::game_logo_background);
	find_widget<image>(&win, "logo", false).set_image(game_config::images::game_logo);

	//
	// Version string
	//
	const std::string version_string = formatter() << ("Version") << " " << game_config::revision;

	if(label* version_label = find_widget<label>(&win, "revision_number", false, false)) {
		version_label->set_label(version_string);
	}

	win.get_canvas()[0].set_variable("revision_number", variant(version_string));

	//
	// Tip-of-the-day browser
	//
	multi_page& tip_pages = find_widget<multi_page>(&win, "tips", false);

	std::vector<game_tip> tips(settings::get_tips());
	if(tips.empty()) {
		WRN_CF << "There are no tips of day available." << std::endl;
	}

	for(const auto& tip : tips)	{
		string_map widget;
		std::map<std::string, string_map> page;

		widget["use_markup"] = "true";

		widget["label"] = tip.text();
		page.emplace("tip", widget);

		widget["label"] = tip.source();
		page.emplace("source", widget);

		tip_pages.add_page(page);
	}

	update_tip(win, true);

	register_button(win, "next_tip", hotkey::TITLE_SCREEN__NEXT_TIP,
		std::bind(&title_screen::update_tip, this, std::ref(win), true));
	register_button(win, "previous_tip", hotkey::TITLE_SCREEN__PREVIOUS_TIP,
		std::bind(&title_screen::update_tip, this, std::ref(win), false));

	//
	// Help
	//
	register_button(win, "help", hotkey::HOTKEY_HELP, [this](window&) {
		help::help_manager help_manager(&game_config_manager::get()->game_config());
		help::show_help(game_.video());
	});

	//
	// About
	//
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例6: show_help

void unit_recall::show_help(window& window)
{
	help::show_help(window.video(), "recruit_and_recall");
}
开发者ID:doofus-01,项目名称:wesnoth,代码行数:4,代码来源:unit_recall.cpp

示例7: dismiss_unit

void unit_recall::dismiss_unit(window& window)
{
	LOG_DP << "Recall list units:\n"; dump_recall_list_to_console(recall_list_);

	listbox& list = find_widget<listbox>(&window, "recall_list", false);
	const int index = list.get_selected_row();

	const unit& u = *recall_list_[index].get();

	// If the unit is of level > 1, or is close to advancing, we warn the player about it
	std::stringstream message;
	if(u.loyal()) {
		message << _("This unit is loyal and requires no upkeep.") << " " << (u.gender() == unit_race::MALE
		         ? _("Do you really want to dismiss him?")
		         : _("Do you really want to dismiss her?"));

	} else if(u.level() > 1) {
		message << _("This unit is an experienced one, having advanced levels.") << " " << (u.gender() == unit_race::MALE
		         ? _("Do you really want to dismiss him?")
		         : _("Do you really want to dismiss her?"));

	} else if(u.experience() > u.max_experience()/2) {
		message << _("This unit is close to advancing a level.") << " " << (u.gender() == unit_race::MALE
		         ? _("Do you really want to dismiss him?")
		         : _("Do you really want to dismiss her?"));
	}

	if(!message.str().empty()) {
		const int res = gui2::show_message(window.video(), _("Dismiss Unit"), message.str(), message::yes_no_buttons);

		if(res != gui2::window::OK) {
			return;
		}
	}

	recall_list_.erase(recall_list_.begin() + index);

	// Remove the entry from the dialog list
	list.remove_row(index);
	list_item_clicked(window);

	// Remove the entry from the filter list
	filter_options_.erase(filter_options_.begin() + index);
	assert(filter_options_.size() == list.get_item_count());

	LOG_DP << "Dismissing a unit, side = " << u.side() << ", id = '" << u.id() << "'\n";
	LOG_DP << "That side's recall list:\n";
	dump_recall_list_to_console(team_.recall_list());

	// Find the unit in the recall list.
	unit_ptr dismissed_unit = team_.recall_list().find_if_matches_id(u.id());
	assert(dismissed_unit);

	// Record the dismissal, then delete the unit.
	synced_context::run_and_throw("disband", replay_helper::get_disband(dismissed_unit->id()));

	// Close the dialog if all units are dismissed
	if(list.get_item_count() == 0) {
		window.set_retval(window::CANCEL);
	}
}
开发者ID:doofus-01,项目名称:wesnoth,代码行数:61,代码来源:unit_recall.cpp


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