Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


sf::Mouse::isButtonPressed issues


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 Crusable   Members   -  Reputation: 594

Like
0Likes
Like

Posted 18 April 2013 - 11:07 PM

Hello, I am working on a menu for my game and the buttons only activate when clicking in specific areas such as the middle bottom and the middle left side.

 

 

 
bool Aliens::Button::HandleEvents(sf::Event Event){
 
float MouseX = Event.mouseMove.x;
float MouseY = Event.mouseMove.y;
 
if(Event.type == sf::Event::MouseMoved){
 
if((MouseX >= mButtonSprite.getPosition().x) && (MouseX <= mButtonSprite.getPosition().x + mButtonBox.x) &&
(MouseY >= mButtonSprite.getPosition().y) && (MouseY <= mButtonSprite.getPosition().y + mButtonBox.y)){
 
mButtonSprite.setTexture(mMouseOverTexture);
 
if(sf::Mouse::isButtonPressed(sf::Mouse::Left)) return true;
}
 
else mButtonSprite.setTexture(mNormalTexture);
}
 
return false;
}

 

 

Thanks for any help.


Edited by Crusable, 18 April 2013 - 11:09 PM.


Sponsor:

#2 Crusable   Members   -  Reputation: 594

Like
0Likes
Like

Posted 18 April 2013 - 11:25 PM

Never mind, I am a dumbass. I fixed it, sorry for wasting your time.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS