views:

81

answers:

2

I want to use a hardware cursor for a computer game I am making, AWT allows me to do so, and specify an image to use, however it only accepts 2 colours and transparency, which is fairly limiting.

I'm fairly certain that it's possible to use a greater colour depth on most current systems, is there any way to achieve that in AWT? What about other ways?

A: 

My memory of AWT is somewhat spotty, but I don't think it necessarily lets you change the hardware cursor. Rather, it lets you define a custom cursor, and it is up to the specific toolkit implementation (subtype of java.awt.Toolkit) to decide how to change the cursor.

Similarly, while multicolor cursors are supported at the API level, they may not be supported using your specific toolkit, you may want to get the toolkit object for your system and call getMaximumCursorColors(). If the number is not high enough, I am no sure that there is a way to bypass it via Java.

Uri
A: 

If you call Toolkit.getMaximumCursorColors and that returns a maximum of 2 - then that's all that AWT's going to use to render the cursor. To get around this, you can make a completely transparent image and set that as the cursor. Then, add a MouseListener to whatever component you're using to paint the game and just draw or paint whatever cursor image you want at the current mouse coordinates.

Nate
Thanks, that's probably as close as I'm going to get to a solution
Travis Dixon