SFML community forums

General => Feature requests => Topic started by: JayArby on November 17, 2011, 05:36:47 pm

Title: Cursor icon
Post by: JayArby on November 17, 2011, 05:36:47 pm
It would be really nice if I could change the mouse icon the same way as the window icon. So far the only way I know to do it is to hide the mouse and draw the cursor myself each frame, which is a pain. Might such a feature be added in the future? (Or if it is already available, did I miss it somehow?)
Title: Cursor icon
Post by: Laurent on November 17, 2011, 06:19:31 pm
Quote
which is a pain

Really? I think it's pretty easy to implement.
Title: Cursor icon
Post by: JayArby on November 17, 2011, 07:00:08 pm
It's not difficult to implement, but it is nice to have the cursor overlaid by the OS so that it is rendered independently of my graphics. It's not absolutely essential, but it would certainly be nice. Why not provide it?
Title: Cursor icon
Post by: Neomex on December 28, 2011, 11:33:26 pm
Well, it is easy enought to make by yourself and you can make extra effects this way, so what's the point?
Title: Cursor icon
Post by: Mario on December 30, 2011, 11:25:01 am
Don't really think this is that unimportant or pointless. Using the hardware/system cursor can be an advantage, e.g. when you've got UI elements on your borders and you'd like the cursor to overlap the actual window or when you'd like the user being able to move the cursor while your main UI thread is busy or locked due to whatever reason. It could as well allow you easier access to the system cursors to provide the user with a consistent UI experience (esp. for non-game related programs).
Title: Re: Cursor icon
Post by: L01man on May 01, 2012, 02:53:59 pm
You can draw your cursor on the top using Group as layers (https://github.com/SFML/SFML/wiki/TutorialDrawableGroup).
I'm more concerned about speed: on my computers, the Sprite cursor is actually following the OS cursor but they don't move in sync: the Sprite is slower. I don't know how OS handle cursors, but when I occasionnaly get lags, the only thing that moves as usual is the cursor.
There is another problem, surely related to the previous one: when you move the cursor quickly out of the window, the sprite cursor doesn't disappear of sight, it remains near the side of the window.
Title: Re: Cursor icon
Post by: eXpl0it3r on May 01, 2012, 02:57:32 pm
Why not provide it?

Why not use the search function just to find out that this question has been raised a numerous times... ;)
Title: Re: Cursor icon
Post by: L01man on May 01, 2012, 09:10:12 pm
Unfortunatelly, search does give me subjets but no answers :(. Here (http://en.sfml-dev.org/forums/index.php?topic=6826.msg45069#msg45069), Mario said something interesting but got no response. There is also this weird problem (http://en.sfml-dev.org/forums/index.php?topic=394.msg2339#msg2339). I searched this (http://en.sfml-dev.org/forums/index.php?action=search2). Please, if you have the link to the answer, could you post it here?
Title: Re: Cursor icon
Post by: JayArby on May 01, 2012, 11:22:46 pm
Yeah, I still think this is a very important feature that should be included. But I guess Laurent doesn't think so.
Title: Re: Cursor icon
Post by: Cornstalks on May 02, 2012, 04:33:18 am
It's not really quite that simple though, because then you get into the issue of whether or not cursors should be animated, and how you should handle multiple cursor images (for example, changing the image based on what the mouse is hovering over), etc. Each game seems to use the cursor differently, and I don't think there's a clean way to solve all these problems, and just implementing a naive solution is just a waste of time as users of SFML can easily implement it in just a few lines of code.
Title: Re: Cursor icon
Post by: L01man on May 02, 2012, 12:12:31 pm
Cornstalks is right, but only when we want complex cursors.
Title: Re: Cursor icon
Post by: Lo-X on May 02, 2012, 03:24:25 pm
Cornstalks is right, but onyl when we want complex cursors.

It's sooo simple to implement a simple cursor (a bit more complicated for a complex one, but nothing impossible).
It's just an image or a vertex array following the (invisible) real mouse.