Slick Forums

Discuss the Slick 2D Library
It is currently Thu May 23, 2013 2:44 am

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Fri Nov 20, 2009 2:54 pm 
Offline
Site Admin

Joined: Mon Dec 08, 2008 2:17 pm
Posts: 140
I would like to get the absolute mouse position from the Input class, because once I translate the input I can no longer get the absolute position of the mouse.

Code:
   /**
    * Get the absolute x position of the mouse cursor within the container
    *
    * @return The absolute x position of the mouse cursor
    */
   public int getAbsoluteMouseX() {
      return (int) Mouse.getX();
   }
   
   /**
    * Get the absolute y position of the mouse cursor within the container
    *
    * @return The absolute y position of the mouse cursor
    */
   public int getAbsoluteMouseY() {
      return (int) height-Mouse.getY();
   }


I'm not sure if scaling needs to be added?
I would of used Mouse.getY() but then noticed that the height was needed too..


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 23, 2009 8:40 pm 
Offline
Site Admin
User avatar

Joined: Thu Jan 01, 1970 12:00 am
Posts: 3143
In SVN.

Kev


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group