Skip to main content
gamedev.net
🔒 Locked

[Java] Getting mouse coordinates

Started by Tankyroo 0 replies 1k views
Original Post
Tankyroo
Tankyroo
Hey guys, I was wondering, what is the best way to get the coordinates of the mouse?

When I use Mouse.getX() and Mouse.getY(), the Y coordinate is wrong, it shows that 0 is at the bottom, instead of the top. How do I fix this? Or what is the best way to get the coordinates?
Bacterius
Bacterius
If that's the only problem why not just substract the returned height from the screen's total height (minus 1) and take that as a Y coordinate?
“If I understand the standard right it is legal and safe to do this but the resulting value could be anything.”

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.