Slick Forums

Discuss the Slick 2D Library
It is currently Thu May 23, 2013 11:23 pm

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Sat Feb 13, 2010 3:11 am 
Offline

Joined: Sat Feb 13, 2010 3:06 am
Posts: 1
Hey guys,

The getCenterOfRotationX() and getCenterOfRotationY() in the image class might return an incorrect value of 0 even when it is otherwise.

This is the current code:

Code:
   /**
    * Get the x component of the center of rotation of this image
    *
    * @return The x component of the center of rotation
    */
   public float getCenterOfRotationX() {
      return centerX;
   }
   
   /**
    * Get the y component of the center of rotation of this image
    *
    * @return The y component of the center of rotation
    */
   public float getCenterOfRotationY() {
      return centerY;
   }


I believe it would be fine if you just added a call to the init() method, just like you do in getWidth and getHeight, like so:

Code:
   /**
    * Get the x component of the center of rotation of this image
    *
    * @return The x component of the center of rotation
    */
   public float getCenterOfRotationX() {
      init();
      return centerX;
   }
   
   /**
    * Get the y component of the center of rotation of this image
    *
    * @return The y component of the center of rotation
    */
   public float getCenterOfRotationY() {
      init();
      return centerY;
   }


If you do not want the performance hit due to the method call, I guess the next best solution would just be to place the call to init() in the constructors.

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 04, 2010 4:58 pm 
Offline
Site Admin
User avatar

Joined: Thu Jan 01, 1970 12:00 am
Posts: 3143
Fixed in SVN. Thanks for the detail.

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 1 guest


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