generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: GUI math isn't working

Previous Thread :: Next Thread 
DrHaximus is not online. 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 is not online. DrHaximus
Joined: 22 Nov 2011
Total Posts: 8410
21 Jan 2013 02:14 PM
bump plz
Report Abuse
DrHaximus is not online. DrHaximus
Joined: 22 Nov 2011
Total Posts: 8410
21 Jan 2013 02:21 PM
bumpedy bump
Report Abuse
DrHaximus is not online. DrHaximus
Joined: 22 Nov 2011
Total Posts: 8410
21 Jan 2013 02:30 PM
bump of impatience
Report Abuse
oseday is not online. 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 is not online. 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 is not online. 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 is not online. DrHaximus
Joined: 22 Nov 2011
Total Posts: 8410
21 Jan 2013 02:41 PM
bump
Report Abuse
DrHaximus is not online. DrHaximus
Joined: 22 Nov 2011
Total Posts: 8410
21 Jan 2013 02:47 PM
Wow, nobody can help?
Report Abuse
DrHaximus is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image