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

Author Topic: [SFML 1.6, OSX] sf::RenderWindow::ShowMouseCursor not working  (Read 2457 times)

0 Members and 1 Guest are viewing this topic.

acheron761

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
[SFML 1.6, OSX] sf::RenderWindow::ShowMouseCursor not working
« on: November 18, 2012, 07:29:30 pm »
Hi,

Just recently trying out SFML, but unfortunately have run into an early problem:

When calling ShowMouseCursor(false), the cursor immediately reappears once the mouse is moved. Currently, I am using the C++ 1.6 OSX 32+64 bit binaries provided from the official downloads (haven't tried re-building the library from scratch) running on OS X 10.7.

For me, at least, the following basic program (taken pretty much verbatim from tutorial) is able to reproduce the issue:

int main(int argc, char *argv[])
{
      sf::RenderWindow window(sf::VideoMode(800, 600, 32), "And so on");

      // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      // Why must I fail at every attempt at masonry?!
      window.ShowMouseCursor(false);
      // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

      while (window.IsOpened())
      {
            sf::Event event;
            while (window.GetEvent(event))
            {
                if (event.Type == sf::Event::Closed)
                    window.Close();
            }
            window.Clear();
            window.Display();
     }
     return 0;
}
 

Given this, the cursor starts off hidden, but as soon as the mouse moves, regardless of the intervening amount of time or other events, it immediately re-appears.
Some maybe helpful information:

- Subsequent calls to ShowMouseCursor(false) have no effect unless preceded by a call to ShowMouseCursor(true), but this is not a viable strategy, since it causes noticable flickering of the mouse, even if only implemented within some event handler for sf::Event::MouseMoved. As a hack I tried just calling ShowMouseCursor(false) at various points while handling events, or before and after other sf::RenderWindow calls, but this never makes any difference.

- Appears to be independent of the window creation settings. I've experimented with different VideoModes and styles, but problem always manifests. I haven't tried using different WindowSettings (I've just been using the defaults), though I suspect this would have no bearing.

- Recreating the window, either through Create() or simply by deleting the window object and allocating a new one (in either case, calling ShowMouseCursor(false) on the new window) does not solve the problem: at best, the cursor again is invisible only until the next time the mouse is moved.

- Have tried Quartz calls to try to hide the mouse in lieu of using ShowMouseCursor. While I was able to hide the cursor, the same problem manifest none the less. As a disclaimer, I'm not intimately familiar with Carbon APIs, however.

Ultimately, I'd like simply to disable the cursor entirely, so that I can simply render my own in the window (ie. as a sprite or other objects) if and when necessary. Whether the cursor shows while outside the window area, I'm indifferent: while within the bounds of the window, however, it must not be visible.

Am I missing some step, or using this method incorrectly?

Please let me know if there is additional information which may be useful or necessary.

Thanks in advance for any suggestions or help you can give.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: [SFML 1.6, OSX] sf::RenderWindow::ShowMouseCursor not working
« Reply #1 on: November 18, 2012, 07:33:24 pm »
SFML 1.6 is unmaintained (especially the OS X port), use SFML 2 to solve your problem.
Laurent Gomila - SFML developer

acheron761

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Re: [SFML 1.6, OSX] sf::RenderWindow::ShowMouseCursor not working
« Reply #2 on: November 19, 2012, 12:04:43 am »
Thanks very much for the swift reply, Laurent!

SFML 2 does appear to've largely fixed the issue: the cursor still reappears on the first move event, but the behavior is correct after subsequent mouse-entered events.

Is there any workaround for the initial cursor reappearence?

 

anything