Slick Forums

Discuss the Slick 2D Library
It is currently Sun May 19, 2013 12:45 am

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Sat Aug 22, 2009 1:46 pm 
Offline
Game Developer
User avatar

Joined: Sun Nov 12, 2006 8:40 pm
Posts: 574
It would be nice if slick exposed a way to use animated cursors, at the moment you can sort of do animated cursors but it involves manually changing container.setCursor(image, x, y) every so often or directly accessing org.slick.opengl.CursorLoader classes getAnimatedCursor method.

Something like container.setCursor(Image[] image, int delay, x, y) or container.setCursor(Animation animation, x, y) or container.setCursor(SpriteSheet spritesheet, delay, x, y) would be really useful.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 22, 2009 2:24 pm 
Offline
User avatar

Joined: Wed Mar 11, 2009 7:37 pm
Posts: 52
Location: Germany
You can work around this by using something like this:

Code:
   public AnimatedCursor cursor;
   
   public void init(GameContainer gc) {
      gc.setCursor("dummy.png"); // An Transparent Dummy Image
     
      Image imgs[] = new Image[3];
      imgs[0] = new Image("mouse1.png");
      imgs[1] = new Image("mouse2.png");
      imgs[2] = new Image("mouse3.png");
     
      cursor = new AnimatedCursor(imgs, 0 , 0); // Images, offsetx, offsety
   }
   
   public void update(GameContainer gc, int delta) {
      Input input = gc.getInput();
     
      cursor.setPosition(input.getMouseX(), input.getMouseY());
      cursor.update(delta);
   }
   
   public void render(Graphics g) {
      cursor.render(g);
   }


but a "container.setCursor(Animation animation, x, y)" funktion would of course be nice.

_________________
Srsly, DaRealSheep

- There will never be a problem that could defeat sunrise or hope. -


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 15, 2009 7:05 pm 
Offline
Site Admin
User avatar

Joined: Thu Jan 01, 1970 12:00 am
Posts: 3143
Added a setAnimatedMouseCursor which take a reference to a sprite sheet image. Not quite sure what more you needed.

In SVN.

Kev


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 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