void sfml2_renderer::draw(const rect& box, const color& fill) { set_primitive_type(sf::Triangles); disable_texture(); auto color = col(fill); add_vertex(box.top_left(), color); add_vertex(box.bottom_right(), color); add_vertex(box.top_right(), color); add_vertex(box.top_left(), color); add_vertex(box.bottom_right(), color); add_vertex(box.bottom_left(), color); }
void sfml2_renderer::draw(const rect& box, const texture& fill) { auto& sftext = dynamic_cast<const sfml2_texture&>(*fill); set_primitive_type(sf::Triangles); set_texture(sftext.sf_texture()); add_vertex(box.top_left(), sf::Vector2f{0, 0}); add_vertex(box.top_right(), sf::Vector2f{1, 0}); add_vertex(box.bottom_right(), sf::Vector2f{1, 1}); add_vertex(box.top_left(), sf::Vector2f{0, 0}); add_vertex(box.bottom_right(), sf::Vector2f{1, 1}); add_vertex(box.bottom_left(), sf::Vector2f{0, 1}); }
constexpr bool operator==( rect< PositionType, SizeType > const& lhs, rect< PositionType, SizeType > const& rhs ){ return lhs.top_left() == rhs.top_left() && lhs.size() == rhs.size(); }