コード例 #1
0
editor_controller::editor_controller(const config &game_config, CVideo& video, hero_map& heros, int mode)
	: controller_base(SDL_GetTicks(), game_config, video)
	, heros_(heros)
	, mode_(mode)
	, mouse_handler_base()
	, rng_(NULL)
	, rng_setter_(NULL)
	, map_contexts_()
	, current_context_index_(0)
	, gui_(NULL)
	, map_generators_()
	, tods_()
	, palette_()
	, floating_label_manager_(NULL)
	, do_quit_(false)
	, quit_mode_(EXIT_ERROR)
	, brushes_()
	, brush_(NULL)
	, mouse_actions_()
	, mouse_action_hints_()
	, mouse_action_(NULL)
	, toolbar_dirty_(true)
	, foreground_terrain_(t_translation::MOUNTAIN)
	, background_terrain_(t_translation::GRASS_LAND)
	, clipboard_()
	, auto_update_transitions_(preferences::editor::auto_update_transitions())
	, use_mdi_(preferences::editor::use_mdi())
	, default_dir_(preferences::editor::default_dir())
{
	create_default_context();

	if (default_dir_.empty()) {
		default_dir_ = get_dir(get_dir(get_user_data_dir() + "/editor") + "/maps");
	}
	init_gui(video);
	init_brushes(game_config);
	init_mouse_actions(game_config);
	init_map_generators(game_config);
	init_tods(game_config);
	init_sidebar(game_config);
	init_music(game_config);
	hotkey_set_mouse_action(gui2::teditor_theme::HOTKEY_EDITOR_TOOL_PAINT);
	rng_.reset(new rand_rng::rng());
	rng_setter_.reset(new rand_rng::set_random_generator(rng_.get()));
	get_map_context().set_starting_position_labels(gui());
	cursor::set(cursor::NORMAL);
	image::set_color_adjustment(preferences::editor::tod_r(), preferences::editor::tod_g(), preferences::editor::tod_b());
	refresh_all();
	events::raise_draw_event();

	map_type = tmap_type();
	if (mode_ != NONE) {
		BOOST_FOREACH (const config& type, game_config.child_range("map_type")) {
			const std::string& id = type["id"];
			if (mode == SIEGE && id == "siege") {
				map_type = tmap_type(*gui_, type);
			}
		}
	}
コード例 #2
0
ファイル: editor_toolkit.cpp プロジェクト: aquileia/wesnoth
editor_toolkit::editor_toolkit(editor_display& gui, const CKey& key,
		const config& game_config, context_manager& c_manager)
	: gui_(gui)
	, key_(key)
	, palette_manager_()
	, mouse_action_(nullptr)  // Will be set before this constructor ends.
	, mouse_actions_()
	, brush_(nullptr)
	, brushes_()
{
	init_brushes(game_config);
	init_sidebar(game_config);
	init_mouse_actions(c_manager);
}