Slick Forums

Discuss the Slick 2D Library
It is currently Mon May 20, 2013 6:15 am

All times are UTC




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Fri Mar 02, 2012 10:20 am 
Offline

Joined: Fri Mar 02, 2012 9:37 am
Posts: 4
Hi guys, I'm using slick for about 2 years for my hobby project but not constantly.

I have a problem with correct setup of mouse cursor with TWL+Slick2D.
I have defined cursor in my theme:
Code:
<images file="cursor.png">
  <cursor name="cursor1" hotSpotX="0" hotSpotY="0" xywh="*" imageRef="none"/>
</images>

Then i set it as default cursor to my "-defaults" theme, which is base for all other themes:
Code:
<param name="mouseCursor">
  <cursor>cursor1</cursor>
</param>

But this has no effect. I'm using approach described in TWL wiki.

Furthermore I've tried to setup cursor using slick api:
Code:
container.setMouseCursor("cursor.png",0,0);

Depending on where i place that code i get different results:
in init() method - cursor appears for about half a second, then default system cursor takes place.
in render() method - cursor switching between my cursor and system cursor.
in update() method - cursor stays default.

cursor.png and theme.xml are located in same folder. My skinned button works well, so it's not pathing problem, something with TWL not properly setting cursor from widget or something i guess.


Top
 Profile  
 
PostPosted: Fri Mar 02, 2012 5:43 pm 
Offline
Slick Zombie

Joined: Fri Jan 29, 2010 7:02 pm
Posts: 1171
You should not specify imageRef="none" - as the presence of this attribute alone will create a SW cursor using the specified image ("none" ==> invisible SW cursor).

As for how Slicks cursor setting works (or how it interacts with TWL's) I have no idea.

_________________
TWL - The Themable Widget Library


Top
 Profile  
 
PostPosted: Fri Mar 02, 2012 6:33 pm 
Offline

Joined: Fri Mar 02, 2012 9:37 am
Posts: 4
MatthiasM, That's how theme editor generates markup with default settings. I've manually removed imageRef and now it works! Thanks a lot.

For Slick and twl integration about cursor - Slick api sets up cursor using OpenGL setNativeCursor method, but I bet it's overriden by TWL gui.setCursor() in postUpdateState method. So that's why I was getting results mentioned above. Thanks again for quick and clean response.


Top
 Profile  
 
PostPosted: Sat Mar 03, 2012 12:22 am 
Offline
Slick Zombie

Joined: Fri Jan 29, 2010 7:02 pm
Posts: 1171
Ok, I fixed the cursor editor. You can now enable/disable the imageRef property on a cursor.

_________________
TWL - The Themable Widget Library


Top
 Profile  
 
PostPosted: Sat Mar 03, 2012 2:22 pm 
Offline

Joined: Fri Mar 02, 2012 9:37 am
Posts: 4
That's good to hear and thanks for quick fix :)
Also, isn't it a bug then when I set imageRef property to "none" system cursor is still displayed? Shouldn't it disappear?


Top
 Profile  
 
PostPosted: Sat Mar 03, 2012 6:57 pm 
Offline
Slick Zombie

Joined: Fri Jan 29, 2010 7:02 pm
Posts: 1171
It should hide the system cursor - I think it somehow interacts with Slick.

_________________
TWL - The Themable Widget Library


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