示例#1
0
sge::input::mouse::button
sge::x11input::mouse::button(
	sge::x11input::device::window_event const &_event,
	sge::input::mouse::button_info_container const &_info
)
{
	int const detail(
		_event.get().detail
	);

	FCPPT_ASSERT_PRE(
		detail > 0
	);

	sge::input::mouse::button_id const id(
		static_cast<
			sge::input::mouse::button_id::value_type
		>(
			detail - 1 // TODO: why?
		)
	);

	FCPPT_ASSERT_PRE(
		id < _info.size()
	);

	return
		sge::input::mouse::button(
			_info[
				id
			].code(),
			id
		);
}
示例#2
0
sanguis::creator::rect
sanguis::creator::tile_rect(
	sanguis::creator::tile const _tile
)
{
	FCPPT_ASSERT_PRE(
		sanguis::creator::tile_is_solid(
			_tile
		)
	);

	switch(
		_tile
	)
	{
	case sanguis::creator::tile::nothing:
		break;
	default:
		return
			sanguis::creator::rect(
				fcppt::math::vector::null<
					sanguis::creator::rect::vector
				>(),
				fcppt::math::dim::fill<
					sanguis::creator::rect::dim
				>(
					sanguis::creator::tile_size::value
				)
			);
	}

	FCPPT_ASSERT_UNREACHABLE;
}
示例#3
0
sanguis::server::ai::speed_factor
sanguis::server::ai::behavior::attack_health::speed_factor() const
{
	FCPPT_ASSERT_PRE(
		this->me().max_health()
		>
		fcppt::literal<
			sanguis::server::health
		>(
			0.f
		)
	);

	return
		speed_factor_
		+
		fcppt::strong_typedef_construct_cast<
			sanguis::server::ai::speed_factor,
			fcppt::cast::size_fun
		>(
			(
				fcppt::literal<
					sanguis::server::health
				>(
					1.0f
				)
				-
				this->me().current_health()
				/
				this->me().max_health()
			).get()
		);
}
示例#4
0
sge::opengl::context::base &
sge::opengl::context::object::insert(
	sge::opengl::context::id const _id,
	sge::opengl::context::base_unique_ptr &&_ptr
)
{
	optional_base_unique_ptr &dest(
		elements_[
			_id.get()
		]
	);

	FCPPT_ASSERT_PRE(
		!dest.has_value()
	);

	sge::opengl::context::base &result(
		*_ptr
	);

	dest =
		optional_base_unique_ptr(
			std::move(
				_ptr
			)
		);

	return
		result;
}
示例#5
0
sge::camera::tracking::object::object(
	sge::camera::optional_projection_matrix const &_projection_matrix,
	sge::camera::tracking::keyframe_sequence const &_keyframes,
	sge::camera::tracking::is_looping const _is_looping,
	sge::camera::is_active const _is_active)
:
	sge::camera::base(),
	projection_matrix_(
		_projection_matrix),
	keyframes_(
		_keyframes),
	is_looping_(
		_is_looping),
	current_keyframe_{
		keyframes_.begin(),
		cyclic_iterator::boundary{
			keyframes_.begin(),
			keyframes_.end()
		}
	},
	current_time_point_(
		0.0f),
	is_active_(
		_is_active),
	coordinate_system_(
		keyframes_.begin()->coordinate_system()),
	finished_(
		false)
{
	FCPPT_ASSERT_PRE(
		!keyframes_.empty());
}
示例#6
0
文件: context.cpp 项目: amoylel/fcppt
void
fcppt::log::context::remove(
	fcppt::log::detail::context_tree &_tree
)
{
	fcppt::log::detail::context_tree::optional_ref node(
		_tree.parent()
	);

	FCPPT_ASSERT_PRE(
		node.has_value()
	);

	node.get_unsafe().erase(
		_tree.child_position()
	);

	while(
		node.get_unsafe().parent().has_value()
		&&
		node.get_unsafe().empty()
	)
	{
		fcppt::log::detail::context_tree::optional_ref const parent(
			node.get_unsafe().parent()
		);

		parent.get_unsafe().erase(
			node.get_unsafe().child_position()
		);

		node = parent;
	}
}
示例#7
0
awl::main::exit_code const
flake::tests::solipsistic::run()
{
	unsigned const iteration_count =
		sge::parse::json::find_and_convert_member<unsigned>(
			json_configuration_,
			sge::parse::json::string_to_path(
				FCPPT_TEXT("tests/solipsistic/iterations")));

	FCPPT_ASSERT_PRE(
		iteration_count > 0);

	std::cout << "Doing " << iteration_count << "+1 iterations...\n";

	for(
		unsigned i = 0;
		i <= iteration_count;
		++i)
	{
		std::cout << '\r';
		std::cout << "|";
		std::cout << std::string(static_cast<std::string::size_type>(static_cast<double>(i)/static_cast<double>(iteration_count) * 80.0),'-');
		std::cout << std::string(static_cast<std::string::size_type>(static_cast<double>(iteration_count-i)/static_cast<double>(iteration_count) * 80.0),' ');
		std::cout << "|";

		this->run_once();
	}

	std::cout << "\nDone\n";

	return
		awl::main::exit_success();
}
示例#8
0
void
fruitapp::fruit::rendering::sort_fruits(
	fruitapp::fruit::object_sequence const &_fruits,
	fruitapp::fruit::rendering::fruit_pointer_sequence &_fruit_pointers)
{
	FCPPT_ASSERT_PRE(
		_fruit_pointers.empty());

	// TODO: map
	_fruit_pointers.reserve(
		_fruits.size());

	for(
		auto const &fruit
		:
		_fruits
	)
		_fruit_pointers.push_back(
			fruit.get_pointer());

	std::sort(
		_fruit_pointers.begin(),
		_fruit_pointers.end(),
		&sort_functor);
}
示例#9
0
    static
    result_type
    execute(
        T const _value
    )
    {
        FCPPT_ASSERT_PRE(
            _value
            >
            fcppt::literal<
            T
            >(
                0
            )
        );

        return
            result_type(
                _value
                -
                fcppt::literal<
                T
                >(
                    1
                )
            );
    }
sge::opencl::memory_object::scoped_objects::scoped_objects(
	sge::opencl::command_queue::object &_queue,
	sge::opencl::memory_object::base_ref_sequence const &_objects)
:
	queue_(
		_queue
	),
	objects_(
		_objects
	)
{
	FCPPT_ASSERT_PRE(
		!_objects.empty());

	glFinish();

	typedef
	std::vector<
		cl_mem
	>
	mem_vector;

	mem_vector const impls(
		fcppt::algorithm::map<
			mem_vector
		>(
			_objects,
			[](
				fcppt::reference<
					sge::opencl::memory_object::base
				> const _ref
			)
			{
				return
					_ref.get().impl();
			}
		)
	);

	cl_int const error_code{
		clEnqueueAcquireGLObjects(
			_queue.impl(),
			fcppt::cast::size<
				cl_uint
			>(
				impls.size()
			),
			impls.data(),
			0,
			nullptr,
			nullptr
		)
	};

	sge::opencl::impl::handle_error(
		error_code,
		FCPPT_TEXT("clEnqueueAcquireGLObjects")
	);
}
示例#11
0
void
sge::parse::json::config::modify_user_value(
    sge::parse::json::object const &structure_json,
    sge::parse::json::object &user_json,
    json::path const &input_path,
    sge::parse::json::value const &new_value)
{
    FCPPT_ASSERT_PRE(
        !input_path.empty());

    sge::parse::json::value const &old_value =
        sge::parse::json::find_and_convert_member<sge::parse::json::value>(
            structure_json,
            input_path);

    if(old_value.type_index() != new_value.type_index())
        throw
        sge::parse::exception(
            FCPPT_TEXT("Error trying to update the user configuration node \"")+
            json::path_to_string(
                input_path)+
            FCPPT_TEXT("\", the types of the old and new value didn't match. The old type was \"")+
            fcppt::type_name_from_info(
                fcppt::variant::type_info(
                    old_value))+
            FCPPT_TEXT("\", the new type was \"")+
            fcppt::type_name_from_info(
                fcppt::variant::type_info(
                    new_value)));

    sge::parse::json::object &target =
        // 0 is not permitted, 1 would mean: just take a value from
        // user_json, > 1 means: recursively make a path in the user_json
        (std::distance(
             input_path.begin(),
             input_path.end()) > 1)
        ?
        json::make_recursive_objects(
            user_json,
            json::path(
                input_path.begin(),
                std::prev(input_path.end())))
        :
        user_json;

    sge::parse::json::member_map::iterator const it =
        target.members.find(
            input_path.back());

    if(it == target.members.end())
        target.members.insert(
            json::member(
                input_path.back(),
                new_value));
    else
        it->second = new_value;
}
示例#12
0
文件: context.cpp 项目: amoylel/fcppt
fcppt::log::context::~context()
{
	if(
		!std::uncaught_exception()
	)
		FCPPT_ASSERT_PRE(
			tree_.empty()
		);
}
示例#13
0
sanguis::collision::world::body_enter_container
sanguis::server::collision::body::transfer(
	sanguis::collision::log const &_log,
	sanguis::collision::world::object &_world,
	sanguis::collision::world::created const _created,
	sanguis::server::center const _center,
	sanguis::server::speed const _speed,
	sanguis::collision::world::body_group const _collision_group
)
{
	FCPPT_ASSERT_PRE(
		!body_.has_value()
	);

	sanguis::collision::world::body_unique_ptr const &new_body(
		fcppt::optional::assign(
			body_,
			_world.create_body(
				sanguis::collision::world::body_parameters(
					_log,
					sanguis::server::collision::to_center(
						_center
					),
					sanguis::server::collision::to_speed(
						_speed
					),
					sanguis::server::collision::to_radius(
						radius_
					),
					fcppt::optional::map(
						mass_,
						[](
							sanguis::server::mass const _mass
						)
						{
							return
								sanguis::server::collision::to_mass(
									_mass
								);
						}
					),
					_collision_group,
					body_base_
				)
			)
		)
	);

	return
		_world.activate_body(
			*new_body,
			_created
		);
}
示例#14
0
fruitapp::gui::ce::slider::range::range(
	fruitapp::gui::ce::slider::scalar const _min,
	fruitapp::gui::ce::slider::scalar const _max)
:
	min_(
		_min),
	max_(
		_max)
{
	FCPPT_ASSERT_PRE(
		_max > _min);
}
示例#15
0
bool
sanguis::client::draw2d::entities::buffs::base::decrement()
{
	FCPPT_ASSERT_PRE(
		counter_ != 0u
	);

	return
		--counter_
		==
		0u;
}
示例#16
0
void
sanguis::server::entities::with_ghosts::init_ghosts(
	sanguis::server::collision::ghost_container &&_ghosts
)
{
	FCPPT_ASSERT_PRE(
		ghosts_.empty()
	);

	ghosts_ =
		std::move(
			_ghosts
		);
}
示例#17
0
void
fruitlib::pp::system::toggle_filter(
	fcppt::string const &name)
{
	if (name_to_vertex_.find(name) == name_to_vertex_.end())
	{
		fcppt::io::cerr() << FCPPT_TEXT("Warning: filter \"") << name << FCPPT_TEXT(" doesn't exist!\n");
		return;
	}

	FCPPT_ASSERT_PRE(
		vertex_to_filter_.find(name_to_vertex_[name]) != vertex_to_filter_.end());

	filter::wrapper &current_filter =
		vertex_to_filter_[name_to_vertex_[name]];
	current_filter.active(
		!current_filter.active());
}
示例#18
0
void
alda::net::client::detail::object_impl::receive_data()
{
	FCPPT_ASSERT_PRE(
		!receive_buffer_.next_receive_part().empty()
	);

	socket_.async_receive(
		alda::net::buffer::circular_receive::for_asio(
			receive_buffer_.next_receive_part()
		),
		std::bind(
			&object_impl::read_handler,
			this,
			std::placeholders::_1,
			std::placeholders::_2
		)
	);
}
示例#19
0
T
clamp(
	T const &_value,
	T const &_vmin,
	T const &_vmax
)
{
	FCPPT_ASSERT_PRE(
		_vmin <= _vmax
	);

	return
		std::max(
			std::min(
				_value,
				_vmax
			),
			_vmin
		);
}
示例#20
0
void
flakelib::utility::mix_buffers::add_from_to(
	buffer::linear_view<cl_float> const &_from_buffer,
	buffer::linear_view<cl_float> const &_to_buffer)
{
	FCPPT_ASSERT_PRE(
		_from_buffer.size() == _to_buffer.size());

	add_kernel_->buffer_argument(
		"from",
		_from_buffer.buffer());

	add_kernel_->buffer_argument(
		"to",
		_to_buffer.buffer());

	add_kernel_->enqueue_automatic(
		sge::opencl::command_queue::global_dim1(
			_from_buffer.size()));
}
示例#21
0
void
fcppt::container::raw_vector<
	T,
	A
>::reallocate(
	size_type const _new_cap
)
{
	FCPPT_ASSERT_PRE(
		_new_cap >= this->size()
	);

	size_type const old_size(
		this->size()
	);

	pointer const new_memory(
		impl_.alloc_.allocate(
			_new_cap,
			nullptr
		)
	);

	if(
		!this->empty()
	)
		std::uninitialized_copy(
			this->begin(),
			this->end(),
			new_memory
		);

	this->deallocate();

	this->set_pointers(
		new_memory,
		old_size,
		_new_cap
	);
}
示例#22
0
void
flake::planar::conversion::object::scalar_to_texture(
	flakelib::planar::float_view const &_planar_buffer,
	sge::opencl::memory_object::image::planar &_texture,
	conversion::scaling_factor const &_scaling,
	conversion::constant_addition const &_constant_addition)
{
	FCPPT_ASSERT_PRE(
		_planar_buffer.size() == _texture.size());

	scalar_to_texture_kernel_->buffer_argument(
		"input",
		_planar_buffer.buffer());

	scalar_to_texture_kernel_->buffer_argument(
		"output",
		_texture);

	scalar_to_texture_kernel_->numerical_argument(
		"scaling",
		sge::opencl::kernel::numeric_type(
			_scaling.get()));

	scalar_to_texture_kernel_->numerical_argument(
		"addition",
		sge::opencl::kernel::numeric_type(
			_constant_addition.get()));

	sge::opencl::memory_object::base_ref_sequence mem_objects;
	mem_objects.push_back(
		&_texture);

	sge::opencl::memory_object::scoped_objects scoped_vb(
		command_queue_,
		mem_objects);

	scalar_to_texture_kernel_->enqueue_automatic(
		sge::opencl::command_queue::global_dim2(
			_planar_buffer.size()));
}
示例#23
0
void
sanguis::client::draw2d::entities::buffs::slow::apply(
	sanguis::client::draw2d::entities::model::object &_model
)
{
	FCPPT_ASSERT_PRE(
		!previous_color_.has_value()
	);

	previous_color_ =
		optional_color(
			_model.color()
		);

	_model.color(
		sge::image::color::any::convert<
			sanguis::client::draw2d::sprite::normal::color_format
		>(
			sge::image::color::predef::lightblue()
		)
	);
}
示例#24
0
void
sge::renderer::vf::dynamic::converter::lock(
	sge::renderer::vf::dynamic::locked_part const &_locked_part
)
{
	FCPPT_ASSERT_PRE(
		!locked_part_.has_value()
	);

	if(
		sge::renderer::lock_flags::read(
			_locked_part.lock_flags()
		)
	)
		fcppt::optional::maybe_void(
			converter_,
			[
				&_locked_part,
				this
			](
				converter_unique_ptr const &_converter
			){
				_converter->convert_lock(
					_locked_part.data(),
					_locked_part.pos(),
					written_intervals_,
					sge::renderer::impl::vf::dynamic::locked_part_interval(
						_locked_part
					)
				);
			}
		);

	locked_part_ =
		optional_locked_part(
			_locked_part
		);
}
示例#25
0
文件: context.cpp 项目: amoylel/fcppt
fcppt::log::detail::context_tree &
fcppt::log::context::add(
	fcppt::log::location const &_location,
	fcppt::log::object &_object
)
{
	fcppt::reference_wrapper<
		fcppt::log::detail::context_tree
	> cur(
		tree_
	);

	for(
		fcppt::string const &item
		:
		_location
	)
		cur =
			fcppt::maybe(
				fcppt::log::find_inner_node(
					cur.get(),
					item
				),
				[
					cur,
					&item
				]{
					cur.get().push_back(
						fcppt::log::detail::context_tree_node(
							fcppt::log::detail::context_tree_node_variant{
								fcppt::log::detail::inner_context_node(
									item
								)
							}
						)
					);

					return
						fcppt::make_ref(
							cur.get().back()
						);
				},
				[](
					fcppt::log::detail::context_tree &_node
				)
				{
					return
						fcppt::make_ref(
							_node
						);
				}
			);

	FCPPT_ASSERT_PRE(
		!fcppt::log::find_logger_node(
			cur.get()
		).has_value()
	);

	cur.get().push_back(
		fcppt::log::detail::context_tree_node(
			fcppt::log::detail::context_tree_node_variant{
				fcppt::log::detail::outer_context_node(
					_object
				)
			}
		)
	);

	return
		cur.get().back();
}
示例#26
0
bool
sanguis::server::ai::pathing::can_walk_diagonally(
	sanguis::creator::grid const &_grid,
	sanguis::creator::pos const _pos1,
	sanguis::creator::pos const _pos2,
	sanguis::creator::pos const _pos3
)
{
	FCPPT_ASSERT_PRE(
		sanguis::server::ai::pathing::positions_are_close(
			_pos1,
			_pos2
		)
	);

	FCPPT_ASSERT_PRE(
		sanguis::server::ai::pathing::positions_are_close(
			_pos2,
			_pos3
		)
	);

	sanguis::creator::signed_pos const spos1(
		fcppt::math::vector::to_signed(
			_pos1
		)
	);

	sanguis::creator::signed_pos const spos2(
		fcppt::math::vector::to_signed(
			_pos2
		)
	);

	sanguis::creator::signed_pos const spos3(
		fcppt::math::vector::to_signed(
			_pos3
		)
	);

	sanguis::creator::signed_pos const diff(
		spos1
		-
		spos3
	);

	if(
		fcppt::math::dim::contents(
			fcppt::math::vector::to_dim(
				diff
			)
		)
		==
		0
	)
		return
			true;

	sanguis::creator::signed_pos const spos4(
		(
			spos2
			-
			spos3
		).x()
		!=
		0
		?
			sanguis::creator::signed_pos(
				spos3.x()
				+
				diff.x(),
				spos3.y()
			)
		:
			sanguis::creator::signed_pos(
				spos3.x(),
				spos3.y()
				+
				diff.y()
			)
	);

	return
		fcppt::optional::maybe(
			fcppt::optional::copy_value(
				fcppt::container::grid::at_optional(
					_grid,
					fcppt::math::vector::to_unsigned(
						spos4
					)
				)
			),
			fcppt::const_(
				true
			),
			[](
				sanguis::creator::tile const _tile
			)
			{
				return
					!sanguis::creator::tile_is_solid(
						_tile
					);
			}
		);
}
示例#27
0
void
sge::cegui::toolbox::append_row(
    CEGUI::MultiColumnList &_list,
    sge::cegui::toolbox::row const &_mapper
)
{
    FCPPT_ASSERT_PRE(
        static_cast<
        sge::cegui::toolbox::row::size_type
        >(
            _list.getColumnCount()
        )
        ==
        _mapper.size()
    );

    FCPPT_ASSERT_PRE(
        !_mapper.empty()
    );

    CEGUI::uint const index(
        _list.addRow(
            new CEGUI::ListboxTextItem(
                _mapper[
                    0
                ],
                0,
                nullptr
            ),
            0
        )
    );

    for(
        sge::cegui::toolbox::row::size_type const cur
        :
        fcppt::make_int_range(
            fcppt::literal<
            sge::cegui::toolbox::row::size_type
            >(
                1u
            ),
            _mapper.size()
        )
    )
        _list.setItem(
            new CEGUI::ListboxTextItem(
                _mapper[
                    cur
                ],
                0,
                nullptr
            ),
            static_cast<
            CEGUI::uint
            >(
                cur
            ),
            index
        );
}
示例#28
0
void
rucksack::widget::box::base::relayout_major_axis()
{
	// First order of business: Assign each widget its minimum size on both axes.
	// Also, keep track of how much we've assigned in total on the major axis.
	// This is the basis for the corrections later on.
	rucksack::scalar
		allocated_major_size =
			0;

	for(
		child_information::iterator widget_ptr_information_pair_it =
			children_.begin();
		widget_ptr_information_pair_it != children_.end();
		++widget_ptr_information_pair_it)
	{
		// FIXME: Recognize aspect here!
		widget_ptr_information_pair_it->second.size(
			rucksack::dim(
				axis_ == 0
				?
					widget_ptr_information_pair_it->first->axis_policy()[this->major_axis()].minimum_size()
				:
					widget_ptr_information_pair_it->first->axis_policy()[this->minor_axis()].minimum_size(),
				axis_ == 0
				?
					widget_ptr_information_pair_it->first->axis_policy()[this->minor_axis()].minimum_size()
				:
					widget_ptr_information_pair_it->first->axis_policy()[this->major_axis()].minimum_size()));

		allocated_major_size +=
			widget_ptr_information_pair_it->first->axis_policy()[this->major_axis()].minimum_size();
	}

	// How much space do we have remaining on the major axis?
	rucksack::scalar remaining =
		this->size()[this->major_axis()] - allocated_major_size;

	if(remaining < 0)
	{
//		fcppt::io::clog() << FCPPT_TEXT("The minimum size of all widgets together is ") << remaining << FCPPT_TEXT(" pixels too large!\n");
		return;
	}

	// We need the widgets which have a preferred size on the major axis
	typedef
	std::vector<widget::base *>
	widget_ptr_container;

	widget_ptr_container widgets_with_preferred_size;

	rucksack::scalar additional_pixels =
		0;

	// Here we iterate over all children and memorize two things:
	//
	// 1. The widgets that have a preferred size (and whose preferred size is not
	//    equal to the minimum size).
	// 2. How much more pixels are needed to push each widget to the preferred
	//    size.
	for(
		child_information::const_iterator widget_ptr_information_pair_it =
			children_.begin();
		widget_ptr_information_pair_it != children_.end();
		++widget_ptr_information_pair_it)
	{
		// FIXME: Check if this widget has a preferered size and _CAN_ be resized
		// considering its height and aspect
		if(!widget_ptr_information_pair_it->first->axis_policy()[this->major_axis()].preferred_size())
			continue;

		rucksack::scalar const size_difference =
			(*widget_ptr_information_pair_it->first->axis_policy()[this->major_axis()].preferred_size()) -
			widget_ptr_information_pair_it->first->axis_policy()[this->major_axis()].minimum_size();

		FCPPT_ASSERT_PRE(
			size_difference >= 0);

		if(size_difference == 0)
			continue;

		widgets_with_preferred_size.push_back(
			widget_ptr_information_pair_it->first);

		additional_pixels +=
			size_difference;
	}

	if(!widgets_with_preferred_size.empty())
	{
		// We have enough space left to increase the size of each widget to the preferred size. Great!
		if(remaining >= additional_pixels)
		{
			for(
				widget_ptr_container::const_iterator child_ptr =
					widgets_with_preferred_size.begin();
				child_ptr != widgets_with_preferred_size.end();
				++child_ptr)
			{
				rucksack::dim current_size =
					this->information_for_ptr(*child_ptr).size();

				current_size[axis_] =
					*((*child_ptr)->axis_policy()[this->major_axis()].preferred_size());

				this->information_for_ptr(*child_ptr).size(
					current_size);
			}

			remaining -= additional_pixels;
		}
		else
		{
			// We don't have enough room, so partition the remaining space uniformly
			// among the widgets. Note that here, we _could_ partition according to
			// which widget is farthest away from its preferred size, but that's
			// overkill.
			for(
				widget_ptr_container::const_iterator child_ptr =
					widgets_with_preferred_size.begin();
				child_ptr != widgets_with_preferred_size.end();
				++child_ptr)
			{
				rucksack::dim current_size =
					this->information_for_ptr(*child_ptr).size();

				rucksack::scalar const preferred_size =
					*((*child_ptr)->axis_policy()[this->major_axis()].preferred_size());

				// Don't make it bigger than the preferred size
				current_size[axis_] =
					std::min(
						current_size[axis_] + remaining / static_cast<rucksack::scalar>(widgets_with_preferred_size.size()),
						preferred_size);

				remaining -=
					current_size[axis_] - (*child_ptr)->axis_policy()[this->major_axis()].minimum_size();

				this->information_for_ptr(*child_ptr).size(
					current_size);
			}
		}
	}

	// After that step, we might have some room left
	if(remaining <= 0)
		return;

	// This step is the easiest: If we have space left, distribute it uniformly
	// among all widgets that can expand.
	widget_ptr_container widgets_which_expand;

	for(
		child_information::const_iterator widget_ptr_information_pair_it =
			children_.begin();
		widget_ptr_information_pair_it != children_.end();
		++widget_ptr_information_pair_it)
		// FIXME: Check if this widget has is expandable and _CAN_ be expanded
		// considering its height and aspect
		if(widget_ptr_information_pair_it->first->axis_policy()[this->major_axis()].is_expanding())
			widgets_which_expand.push_back(
				widget_ptr_information_pair_it->first);

	if(!widgets_which_expand.empty())
	{
		for(
			widget_ptr_container::const_iterator child_ptr =
				widgets_which_expand.begin();
			child_ptr != widgets_which_expand.end();
			++child_ptr)
		{
			rucksack::dim current_size =
				this->information_for_ptr(*child_ptr).size();

			current_size[axis_] +=
				remaining / static_cast<rucksack::scalar>(widgets_which_expand.size());

			this->information_for_ptr(*child_ptr).size(
				current_size);
		}
	}
}
示例#29
0
void
sge::d3d9::render_context::object::offscreen_target(
	sge::renderer::target::optional_offscreen_ref const &_new_target
)
{
	fcppt::optional::maybe(
		_new_target,
		[
			this
		]{
			{
				sge::d3d9::target::base &cur_target(
					FCPPT_ASSERT_OPTIONAL_ERROR(
						offscreen_target_
					).get()
				);

				cur_target.active(
					false
				);
			}

			offscreen_target_ =
				sge::d3d9::render_context::object::optional_target_base_ref();

			scoped_target_.target().active(
				true
			);
		},
		[
			this
		](
			fcppt::reference<
				sge::renderer::target::offscreen
			> const _target
		)
		{
			FCPPT_ASSERT_PRE(
				!offscreen_target_.has_value()
			);

			scoped_target_.target().active(
				false
			);

			sge::d3d9::target::base &new_target(
				dynamic_cast<
					sge::d3d9::target::base &
				>(
					_target.get()
				)
			);

			new_target.active(
				true
			);

			offscreen_target_ =
				sge::d3d9::render_context::object::optional_target_base_ref(
					fcppt::make_ref(
						new_target
					)
				);
		}
	);
}