SFML community forums

Help => Window => Topic started by: netrick on February 10, 2013, 03:40:27 pm

Title: Changing the cursor look?
Post by: netrick on February 10, 2013, 03:40:27 pm
For my little top down shooter I need to change the cursor look when inside the window. However I dont' see a way to do it. Should I disable the cursor and render the texture at mouse position on my own or there is some handful function for it in sfml?
Title: Re: Changing the cursor look?
Post by: eXpl0it3r on February 10, 2013, 03:41:58 pm
Should I disable the cursor and render the texture at mouse position on my own
Yes, you should. :)

or there is some handful function for it in sfml?
No, there isn't.
Title: Re: Changing the cursor look?
Post by: Weeve on February 15, 2013, 05:56:32 am
It would be a good idea to multi-thread for displaying a mouse, as any amount of lag will be noticeable, because of the delay in the frame-rate, if you set it onto a different thread, and looped it infinitely, and stalled until a signal received, you would have much better results than having to deal with game pausing, lagging, and then having to set up states (pause menu can't stall if your using a main loop to move the mouse)

because of the difficulty in multi-threading, why doesn't Sfml create such a feature? I wouldn't mind writing code for it, it can't be more than 10 line-adds/60 line-edits versus user implementation of it being much more messy?
Title: Re: Changing the cursor look?
Post by: G. on February 15, 2013, 07:09:55 am
And you would have two .display(), one in each thread?
If yes, sounds weird.
If no, what's the point.

Seriously bad idea imo. :P
Title: Re: Changing the cursor look?
Post by: eXpl0it3r on February 16, 2013, 12:01:36 am
Although I do get your concerns, you didn't think far enough. If you're game is rendering at 60fps and your screen refresh rate is also 60fps, you'll never be able to see the mouse pointer at a different location as it really is, so there won't be any lag.
Besides that, the only game I can really think of, where any kind of lag would matter is an FPS, which anyways works with mouse deltas and doesn't have a pointer, thus the whole discussion is a bit useless. And if you get to program an actual FPS you'll have more important problems than few microseconds delay. :D

Another thing that you didn't consider, is the fact that additional threads always add an overhead, dangers to race conditions or similar and provide ask the question about correct synchronization. In this case you'd probably introduce more possibilities to produce lag as you'd have in the first place.
Title: Re: Changing the cursor look?
Post by: Laurent on February 16, 2013, 09:00:36 am
The perfect solution to this problem is to replace the OS cursor directly, so that it is completely independant from what your application does. This feature will soon be available in SFML (see the task tracker).