1
Graphics / Just to be sure. Does SFML use OpenGL for render shapes?
« on: September 03, 2011, 07:45:05 pm »
Yes you can
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
bool isSpriteClicked ( sf::Sprite *spr, sf::RenderWindow *render )
{
const sf::Input& Input = render->GetInput();
if( Input.GetMouseX() > spr->GetPosition().x
&& Input.GetMouseX() < spr->GetPosition().x + spr->GetSize().x
&& Input.GetMouseY() > spr->GetPosition().y && Input.GetMouseY() < spr->GetPosition().y + spr->GetSize().y
&& Input.IsMouseButtonDown(sf::Mouse::Left)
)
{
return true;
}
else
{
return false;
}
}
if(isSpriteClicked( &YOUR_SPRITE, &Window ))
{
// Example:
Window.Close();
}