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

Author Topic: Set hardware cursor for Window  (Read 3824 times)

0 Members and 1 Guest are viewing this topic.

dialer

  • Newbie
  • *
  • Posts: 7
    • View Profile
Set hardware cursor for Window
« on: November 30, 2013, 09:52:50 pm »
(This has been requested before, but the forum apparently discourages thread necromancy)

Even though Laurent has stated multiple times that you can just implement a software cursor using a sprite, I think nowadays this is simply bad practice, and even terribly annoying in certain genres. There is an absolutely noticable difference even at 60 fps, especially when playing RTS or MOBA games (there is a good reason why all the top titles like SC2 or LoL use harware cursors). The delay introduced by software cursors makes it simply feel sluggish and unresponsive.

The recent version of SDL (SDL2) supports setting the hardware cursor to a Surface (an image resource, which could for example be loaded from a PNG (also supports transparency)) using the SDL_CreateColorCursor function. While the code behind it is kind of non-trivial for both Windows and Linux (I haven't examined the Mac OS code), it certainly is manageable and cross-platform. Although SDL's API cannot create animated hardware cursors, having the ability to set the hardware cursor is a nice enough advantage in my opinion. Furthermore, having the concept of a cursor available without the necessity to program any additional rendering should be a good thing either way.

I'd be happy to implement this functionality in SFML by myself (if it is not underway already), but I have no idea how you handle user contributions. Since I'm most likely going to implement it for my project anyway, it would be nice to know if I can make it available to others as well.
« Last Edit: November 30, 2013, 10:54:20 pm by dialer »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Set hardware cursor for Window
« Reply #1 on: November 30, 2013, 10:40:48 pm »
Quote
the forum apparently discourages thread necromancy
No. If it makes sense (and posting in a thread which is exactly about what you want to discuss makes a lot of sense), then it's allowed ;)

I understand your point, and it seems valid. However such a feature would be really low on the todo list.

The best way to contribute and share your work with others, is to fork the SFML repository, implement your modification, and submit a pull request on github.
Laurent Gomila - SFML developer

Daddi

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
    • http://foxdev.de/
    • Email
Re: Set hardware cursor for Window
« Reply #2 on: January 03, 2014, 01:24:25 pm »
I really like the request as I dislike the current version with software cursors. If you would submit a pull request, that would be great :)

amir ramezani

  • Jr. Member
  • **
  • Posts: 81
  • i'm a programmer who can't see well
    • View Profile
    • download useful software!
    • Email
Re: Set hardware cursor for Window
« Reply #3 on: January 03, 2014, 03:22:17 pm »
you can do it using OpenGL functions
and in my idea, if it added to SFML, it maybe a good thing
if you can't see well, you can't test your applications and operating system well
my game engine:
allegro game creator
my operating system:
AmirOS

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
Re: Set hardware cursor for Window
« Reply #4 on: January 03, 2014, 06:18:50 pm »
you can do it using OpenGL functions
No, you cannot, hardware cursors are independent of OpenGL. As dialer stated: "While the code behind it is kind of non-trivial for both Windows and Linux"... It requires operating system APIs.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

amir ramezani

  • Jr. Member
  • **
  • Posts: 81
  • i'm a programmer who can't see well
    • View Profile
    • download useful software!
    • Email
Re: Set hardware cursor for Window
« Reply #5 on: January 04, 2014, 05:39:55 am »
actually, I don't know OpenGL
and I don't worked with it
using GDI, you can do it
in windows, you have to use gdiplus or gdi32
if you can't see well, you can't test your applications and operating system well
my game engine:
allegro game creator
my operating system:
AmirOS