Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool Button::clicked(sf::Vector2f cursor)
- {
- 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))
- {
- if (generalStuff::getIsClick())
- {
- tButton = AssetManager::manageTexture(name + "_pressed" + ".png");
- button.setTexture(*tButton);
- return true;
- }
- else
- {
- tButton = AssetManager::manageTexture(name + "_hovered" + ".png");
- button.setTexture(*tButton);
- return false;
- }
- }
- else
- {
- tButton = AssetManager::manageTexture(name + ".png");
- button.setTexture(*tButton);
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement