bool Clicked(sf::Event event, bool tap, int x, int y, sf::Vector2i window)
{
if(!tap)
if((sf::Mouse::getPosition().x-window.x > x)
&& (sf::Mouse::getPosition().y-window.y > y)
&& (sf::Mouse::getPosition().x-window.x < x+119)
&& (sf::Mouse::getPosition().y-window.y < y+166)
&& (event.mouseButton.button == sf::Mouse::Left))
return true;
else if(tap)
if((sf::Mouse::getPosition().x-window.x > x)
&& (sf::Mouse::getPosition().y-window.y > y)
&& (sf::Mouse::getPosition().x-window.x < x+166)
&& (sf::Mouse::getPosition().y-window.y < y+119)
&& (event.mouseButton.button == sf::Mouse::Left))
return true;
return false;
}
...
switch(EventH.type)
{
case sf::Event::MouseButtonPressed:
for(int i=0;i<Deck.Size();i++)
if(Clicked(EventH, false, 35+(i*140), 35, HandWin.getPosition()))
{
...
}
else break;
so i wanna click any of i cards but above code doesnt work
Last edited on