Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a function to change the mouse cursor #269

Closed
LaurentGomila opened this issue Aug 9, 2012 · 6 comments
Closed

Add a function to change the mouse cursor #269

LaurentGomila opened this issue Aug 9, 2012 · 6 comments

Comments

@LaurentGomila
Copy link
Member

enum Cursor
{
    None,
    Arrow,
    Link,
    ...
};

class Window
{
    void setMouseCursor(Cursor cursor);
    void setMouseCursor(const Uint8* pixels, unsigned int width, unsigned int height);
}

setCursor(None) would replace the current setMouseCursorVisible(false) (so this new feature won't add overhead to the API).

Users have already provided implementations for this function on the forum and wiki.

@ghost ghost assigned LaurentGomila Aug 9, 2012
@retep998
Copy link

retep998 commented Aug 9, 2012

Would custom cursors be an actual hardware accelerated cursor and not just an image drawn on top of everything?

@LaurentGomila
Copy link
Member Author

What is a "hardware accelerated" cursor, and how would a cursor not be "an image drawn on top of everything"?

Well, although I don't understand your question, I can answer: the setMouseCursor(pixels) overload will create a true OS cursor and will behave the same as standard cursors. It's just that its image will be a custom bitmap instead of a predefined one. It won't be a texture drawn at mouse position by SFML, if that's what you asked.

@retep998
Copy link

retep998 commented Aug 9, 2012

Yes, that's basically what I was asking, and thanks for answering it even with my shoddy explanation.
If I may ask another question, would the custom cursor only be in effect when the mouse cursor is hovering over the SFML window, or would it affect the cursor so long as the SFML window is focused?

@LaurentGomila
Copy link
Member Author

I think it is in effect only over the SFML window.

@Qix-
Copy link

Qix- commented Dec 28, 2012

Please please please please please implement this! :]

@LaurentGomila LaurentGomila removed their assignment May 19, 2014
@eXpl0it3r eXpl0it3r removed this from the 2.x milestone Nov 13, 2014
@LaurentGomila LaurentGomila removed this from the 2.x milestone Nov 13, 2014
@binary1248 binary1248 added this to the 2.4 milestone Mar 29, 2015
@mantognini
Copy link
Member

Since most of the discussion is happening in #827, I'm marking this issue as superseded.

@eXpl0it3r eXpl0it3r modified the milestones: 2.5, 2.4 Jul 18, 2017
@eXpl0it3r eXpl0it3r added this to Ready in SFML 2.5.0 Jul 18, 2017
@eXpl0it3r eXpl0it3r moved this from Ready to Merged in SFML 2.5.0 Jul 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
SFML 2.5.0
  
Merged / Superseded
Development

No branches or pull requests

6 participants