DrHaximus
|
  |
| Joined: 22 Nov 2011 |
| Total Posts: 8410 |
|
|
| 21 Jan 2013 02:10 PM |
Alright, so I have a textbox image that is positioned in the middle of the screen:
login_textbox_username.setPosition(window.getSize().x/2login_textbox_username.getLocalBounds().width/2,window.getSize().y/2-login_textbox_username.getLocalBounds().height/2);
.. then I want to be able to detect when the mouse is within the bounds of the image ..
if(sf::Mouse::getPosition().x>(elements[i].getPosition().x-(elements[i].getLocalBounds().width/2))&&sf::Mouse::getPosition().x<(elements[i].getPosition().x+(elements[i].getLocalBounds().width/2))&&sf::Mouse::getPosition().y>(elements[i].getPosition().y-(elements[i].getLocalBounds().height/2))&&sf::Mouse::getPosition().y<(elements[i].getPosition().y+(elements[i].getLocalBounds().height/2))){
(elements is an array of images)
It's not working :( |
|
|
| Report Abuse |
|
|
DrHaximus
|
  |
| Joined: 22 Nov 2011 |
| Total Posts: 8410 |
|
| |
|
DrHaximus
|
  |
| Joined: 22 Nov 2011 |
| Total Posts: 8410 |
|
| |
|
DrHaximus
|
  |
| Joined: 22 Nov 2011 |
| Total Posts: 8410 |
|
| |
|
oseday
|
  |
| Joined: 27 Aug 2008 |
| Total Posts: 1308 |
|
|
| 21 Jan 2013 02:31 PM |
Ehh, take a look at the wiki.
http://wiki.roblox.com/index.php/Frame
Check MouseEnter event. |
|
|
| Report Abuse |
|
|
DrHaximus
|
  |
| Joined: 22 Nov 2011 |
| Total Posts: 8410 |
|
|
| 21 Jan 2013 02:31 PM |
@oseday
I'm not using Roblox...GUI=Graphical User Interface |
|
|
| Report Abuse |
|
|
oseday
|
  |
| Joined: 27 Aug 2008 |
| Total Posts: 1308 |
|
|
| 21 Jan 2013 02:39 PM |
| Omg, that's Js. Mmk. I'll look at the script nowand see if I can help in any mathematical way. |
|
|
| Report Abuse |
|
|
DrHaximus
|
  |
| Joined: 22 Nov 2011 |
| Total Posts: 8410 |
|
| |
|
DrHaximus
|
  |
| Joined: 22 Nov 2011 |
| Total Posts: 8410 |
|
| |
|
DrHaximus
|
  |
| Joined: 22 Nov 2011 |
| Total Posts: 8410 |
|
|
| 21 Jan 2013 03:17 PM |
-UPDATE- I found out that on default the images are positioned by their top left corner rather than their centre. |
|
|
| Report Abuse |
|
|