Mouse Cursors

Discussion among members of the development team.

Moderator: Forum Moderators

Post Reply
Dave
Founding Developer
Posts: 7071
Joined: August 17th, 2003, 5:07 am
Location: Seattle
Contact:

Mouse Cursors

Post by Dave »

Zas has sent me a patch that allows custom mouse cursors to be set in the game. I think it'd be cool if the mouse cursor changes sensitive to the context - an hourglass when waiting for the AI to move, a sword if moused over an enemy and clicking will attack, etc.

Would anyone like to volunteer to draw some cursors? Unfortunately they will have to be in black & white.

David
fmunoz
Founding Artist
Posts: 1469
Joined: August 17th, 2003, 10:04 am
Location: Spain
Contact:

Post by fmunoz »

Black, White& alpha?
What sizes?
Dave
Founding Developer
Posts: 7071
Joined: August 17th, 2003, 5:07 am
Location: Seattle
Contact:

Post by Dave »

I think it can be any size, but the width must be a multiple of 8.

Zas has done one cursor in a patch he sent me which implements it: http://wesnoth.whitevine.net/files/game.cursor.patch

Yes, you can have black, white, and alpha (and inverse of the colour on screen, but I think that'd just look horrible).

You should also specify the 'hot point' (i.e. the tip of the cursor) for each cursor

It is kind of a shame that we can't do colour cursors, but I guess they just wouldn't be portable.

David
zas
Posts: 54
Joined: August 25th, 2003, 9:58 pm
Location: France

Colors can be added

Post by zas »

By improving init_system_cursor()
i think we can have more colors.
zas
Posts: 54
Joined: August 25th, 2003, 9:58 pm
Location: France

Errata.

Post by zas »

No, sorry, the limit comes from SDL_CreateCursor(3).
Slainte
Posts: 90
Joined: September 22nd, 2003, 9:29 am
Location: Barcelona - Spain
Contact:

Post by Slainte »

Hi, I am new here... I have been addressed here from pixelation pixel-art board...

Well I'd suggest using a custom sprite to follow the mouse... keep the hardware cursor off with SDL_ShowCursor and keep track of mouse events to update a custom sprite to follow mouse position... it is quite easy to do and removes all limitations of 1 bit masked hardware cursors (we are doing it this way in Fenix Project, a general purpose 2D game scripting engine worked over SDL)
Dave
Founding Developer
Posts: 7071
Joined: August 17th, 2003, 5:07 am
Location: Seattle
Contact:

Post by Dave »

Slainte wrote:Hi, I am new here... I have been addressed here from pixelation pixel-art board...

Well I'd suggest using a custom sprite to follow the mouse... keep the hardware cursor off with SDL_ShowCursor and keep track of mouse events to update a custom sprite to follow mouse position... it is quite easy to do and removes all limitations of 1 bit masked hardware cursors (we are doing it this way in Fenix Project, a general purpose 2D game scripting engine worked over SDL)
Thanks for your comments.

I have thought of this, however my main concern is that it'd likely be slower than the hardware mouse cursor. In particular, if the game is blocking due to the AI thinking etc, the mouse cursor wouldn't update.

This could be solved perhaps using threading, but I don't think it's worth adding threading for such a simple feature.

I may try this though, to see how it works out.

David
Post Reply