Advertisement
Guest User

Untitled

a guest
Apr 20th, 2020
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.78 KB | None | 0 0
  1. bool Button::clicked(sf::Vector2f cursor)
  2. {
  3.     if (cursor.x >= button.getPosition().x - (button.getTexture()->getSize().x / 2) && cursor.x <= button.getPosition().x + (button.getTexture()->getSize().x / 2)&& cursor.y <= button.getPosition().y + (button.getTexture()->getSize().y / 2) && cursor.y >= button.getPosition().y - (button.getTexture()->getSize().y / 2))
  4.     {
  5.         if (generalStuff::getIsClick())
  6.         {
  7.             tButton = AssetManager::manageTexture(name + "_pressed" + ".png");
  8.             button.setTexture(*tButton);
  9.             return true;
  10.         }
  11.         else
  12.         {
  13.             tButton = AssetManager::manageTexture(name + "_hovered" + ".png");
  14.             button.setTexture(*tButton);
  15.             return false;
  16.         }
  17.     }
  18.     else
  19.     {
  20.         tButton = AssetManager::manageTexture(name + ".png");
  21.         button.setTexture(*tButton);
  22.         return false;
  23.     }
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement