Exemple #1
0
				SPROUT_CONSTEXPR result_type
				operator()(Unit const& u, Unit const& v) const {
					return calc(
						(u - offset_u_ + scale_ / 2) / scale_ * texture_.get().width(),
						(-(v - offset_v_) + scale_ / 2) / scale_ * texture_.get().height()
						);
				}
Exemple #2
0
				SPROUT_CONSTEXPR result_type
				get_color(unit_type const& x, unit_type const& y) const {
					return is_tile()
						? texture_.get()(
							x < 0
								? texture_.get().width() - 1 - static_cast<std::size_t>(-x) % texture_.get().width()
								: static_cast<std::size_t>(x) % texture_.get().width()
								,
							y < 0
								? texture_.get().height() - 1 - static_cast<std::size_t>(-y) % texture_.get().height()
								: static_cast<std::size_t>(y) % texture_.get().height()
							)
						: x < 0 || x >= texture_.get().width()
							|| y < 0 || y >= texture_.get().height()
							? default_color_
							: texture_.get()(static_cast<std::size_t>(x), static_cast<std::size_t>(y))
						;
				}
Exemple #3
0
	inline SPROUT_CONSTEXPR std::size_t
	hash_value(sprout::value_holder<T&> const& v) {
		return v.is_initialized() ? sprout::to_hash(*v)
			: 0
			;
	}
Exemple #4
0
 SPROUT_CONSTEXPR reference operator*() const {
     return count_ != 0
            ? holder_.get()
            : (throw std::out_of_range("value_iterator<>: dereference at out of range"), holder_.get())
            ;
 }
Exemple #5
0
 operator value_iterator<const_type>() const {
     return value_iterator<const_type>(holder_.get(), count_);
 }
Exemple #6
0
 SPROUT_CONSTEXPR reference operator[](difference_type n) const {
     return holder_.get();
 }
Exemple #7
0
 SPROUT_CONSTEXPR pointer operator->() const {
     return count_ != 0
            ? holder_.get_pointer()
            : throw std::out_of_range("value_iterator<>: dereference at out of range")
            ;
 }