Slick Forums

Discuss the Slick 2D Library
It is currently Sat May 25, 2013 3:11 am

All times are UTC




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: Sun Jul 22, 2012 11:24 am 
Offline
Regular

Joined: Sun Oct 30, 2011 4:47 pm
Posts: 184
Location: Mittweida, Saxony, Germany
Hello,

I stumbled into some problems with the org.newdawn.slick.opengl.CursorLoader. There appear to be two different problems. First the image of the cursor is flipped. So the cursor appears upside down. There are some functions with the "flip" parameter. But this does not yield any effect what so ever. Second thing is that the cursor loader appears to have major problems with loading textures that are too small or too big for the native system. Looking over the code, makes it look like the loader does not fix the size of the cursor according to the capabilities of the native system.

I tried using all avaiable functions to load the cursor, yet I was unable to get it done correctly.

Is this bug known/confirmed? If so I would look into a fix.
In any other case: How do I do it correct?

Nitram

_________________
http://illarion.org


Top
 Profile  
 
PostPosted: Mon Jul 23, 2012 9:00 am 
Offline
Regular

Joined: Sun Oct 30, 2011 4:47 pm
Posts: 184
Location: Mittweida, Saxony, Germany
Noone ever had such issues? I am loading ARGB images with 8 bit alpha (this is also likely to fail on some systems). Everything is stored as PNG. What puzzles me is that the CursorLoader sets the "flipped" parameter to true when its loading the ImageData.

But as I said, I tried loading the data myself with and without the flipped parameter set to true. Without any success.

Nitram

_________________
http://illarion.org


Top
 Profile  
 
PostPosted: Mon Jul 23, 2012 4:31 pm 
Offline
Regular

Joined: Sun Oct 30, 2011 4:47 pm
Posts: 184
Location: Mittweida, Saxony, Germany
Okay, now I know why noone has any idea WTF I am talking about.

The cursor loading works fine with the version of Slick downloaded from the homepage. It does not work with the version from the latest source snapshot. The reason is that someone forgot to implement in the PNG image loader the flipping function. No idea who, but I guess this problem raised when the version of the PNG decoder was updated.

In any case the point that the CursorLoader does not fix the images according to the capabilities of the native system is not very slick.

Since this bug is bugging me currently alot, I will go for fixing it myself.

Nitram

_________________
http://illarion.org


Top
 Profile  
 
PostPosted: Tue Jul 24, 2012 12:50 am 
Offline
Game Developer
User avatar

Joined: Thu Mar 03, 2011 6:22 pm
Posts: 534
Just tell me which codelines I need to change and I will do it. Sorry for not replying but I never knew Slick2D had such a class :D

_________________
Current Projects:
Image Mr. Hat I
Image Vegan Vs. Zombies
Projects:
RadicalFish Engine - Build on top of Slick2D, Ideas, Bugs? Open an Issue ticket!


Top
 Profile  
 
PostPosted: Tue Jul 24, 2012 8:33 am 
Offline
Regular

Joined: Sun Oct 30, 2011 4:47 pm
Posts: 184
Location: Mittweida, Saxony, Germany
I located the bug already. Sending a pull request later.

_________________
http://illarion.org


Top
 Profile  
 
PostPosted: Tue Jul 24, 2012 9:50 am 
Offline
Game Developer
User avatar

Joined: Thu Mar 03, 2011 6:22 pm
Posts: 534
Alright :) Nice one!

_________________
Current Projects:
Image Mr. Hat I
Image Vegan Vs. Zombies
Projects:
RadicalFish Engine - Build on top of Slick2D, Ideas, Bugs? Open an Issue ticket!


Top
 Profile  
 
PostPosted: Tue Jul 24, 2012 3:56 pm 
Offline
Regular

Joined: Sun Oct 30, 2011 4:47 pm
Posts: 184
Location: Mittweida, Saxony, Germany
Pull request is send and waiting to be reviewed.

Nitram

_________________
http://illarion.org


Top
 Profile  
 
PostPosted: Fri Jul 27, 2012 7:29 am 
Offline
Regular

Joined: Sun Oct 30, 2011 4:47 pm
Posts: 184
Location: Mittweida, Saxony, Germany
Second part is ready and waiting as pull request.

I now took care for the cursor loader. It is not able to fix loaded images in order to meet the specifications of the underlying host system. So in case you use a very small cursor on a windows 7 computer (minimal cursor size: 32px * 32px the cursor loader will create a texture fitting this specifications and put the cursor in. Also it will fix the hotspot in case the texture is not equal to the image size correctly.

Third thing is the alpha value conversation. Windows currently does not support mouse cursor with 8-bit alpha values. While LWJGL accepts 8-bit alpha only the alpha values 0xFF (fully visible) and not 0xFF (fully invisible) are accepted. These settings for the conversation can lead to strange effects on mouse cursors with slight transparency effects. The new cursor loader support a transparency threshold conversation. It allows you to use and alter a threshold value for the mouse cursor alpha conversation. The default setting is at 80%. So everything with more then 80% of the maximal alpha value becomes fully visible, the rest becomes fully invisible. My tests showed that the conversation is working fine and that Linux is sooo much cooler then Windows as it supports 8bit alpha without problems. The cursor loader will detect this, so in case the host system is able to handle 8bit alpha, the threshold value will not apply.

The changes done visible to the user of the library are 3 additional functions. The remaining functions remain working with unchanged headers. So the changes are fully backwards compatible.

Regards,
Nitram

_________________
http://illarion.org


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