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

Author Topic: Custom cursor not working in title bar  (Read 2763 times)

0 Members and 1 Guest are viewing this topic.

smurf

  • Newbie
  • *
  • Posts: 36
    • View Profile
Custom cursor not working in title bar
« on: August 07, 2024, 03:41:38 am »
Working on polishing my app and one thing I never got working is the custom cursor in the title bar.
You know the bar at the top of the window with the app title and the minimize, maximize, close buttons? My custom cursor does not render when its in that area so you have to for example click close without seeing your cursor, just basically guessing where it is.

My custom cursor is simply a sprite that I move around every frame by setting it to the mouse location.

On program startup I call this

window.SetMouseCursorVisible(false);

Because I'm going to draw the custom one.

Whats the best practice here? Should I only call that if the cursor is NOT on the title bar? Seems kind of hacky but its the only thing I can think of.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Custom cursor not working in title bar
« Reply #1 on: August 07, 2024, 08:49:26 am »
You could use sf::Cursor which was introduced in SFML 2.6, that should replace the cursor also outside of the window.

Otherwise, you'll need to handle the MouseEntered/MouseLeft events to disable/enable the mouse visibility.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/