Пример #1
0
bool WorldObjects::Intersects(const sf::Shape& shape)
{
	for (int i = 0; i < Count(); ++i)
	{
		if (shape.getGlobalBounds().intersects(objects[i]->getGlobalBounds()))
			return true;
	}
	return false;
}
Пример #2
0
void Renderer::draw(sf::Shape const& shape, ZIndex_t zindex, sf::RenderStates const& states)
{
    auto bounds = shape.getGlobalBounds();
    if(isInScreen(bounds))
    {
        m_drawCallbacks.push_back({
            zindex,
            [&shape, states] (sf::RenderTarget& renderer)
            {
                renderer.draw(shape, states);
            }
        });
    }
}
Пример #3
0
void TEALShow::AABB( sf::Shape &s, sf::Color col)
{
	Box( s.getGlobalBounds(), col);
}
Пример #4
0
sf::Vector2f center(const sf::Shape& s)
{
    auto bb = s.getGlobalBounds();
    return {bb.left + 0.5f * bb.width, bb.top + 0.5f * bb.height};
}
	bool collide(sf::Shape& obj) {
		sf::FloatRect head(snake[snake.size()-1],sf::Vector2f(30,30));
		return head.intersects(obj.getGlobalBounds());
	};