Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Changing the cursor look?  (Read 2605 times)

0 Members and 1 Guest are viewing this topic.

netrick

  • Full Member
  • ***
  • Posts: 174
    • View Profile
Changing the cursor look?
« 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?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Changing the cursor look?
« Reply #1 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.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Weeve

  • Jr. Member
  • **
  • Posts: 87
  • C++ Programmer (Intermediate), 3D Artist (Skilled)
    • View Profile
    • Email
Re: Changing the cursor look?
« Reply #2 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?
Long live rapid project development! -- Kestrel3D Game-Engine nearing completion

G.

  • Hero Member
  • *****
  • Posts: 1593
    • View Profile
Re: Changing the cursor look?
« Reply #3 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

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Changing the cursor look?
« Reply #4 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.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Changing the cursor look?
« Reply #5 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).
Laurent Gomila - SFML developer