SFML community forums

Help => Window => Topic started by: Weeve on February 17, 2013, 12:57:31 am

Title: Cursor does not change when hovering over resizeable portion of RenderWindow
Post by: Weeve on February 17, 2013, 12:57:31 am
When I hover my mouse over the resize-able area of the window (bottom and right edge) the cursor doesn't change as it should to the double arrow cursor

What triggers the error:
sf::RenderWindow.setMouseCursorVisible(true);

I am using:
default Window styles,
Sfml 2.0,
OS: Windows XP Professional, Sp.3,
Compiler: Qt Creator (Mingw internal)

My project isn't halted by this, its just annoying  :-\
Title: Re: Cursor does not change when hovering over resizeable portion of RenderWindow
Post by: Laurent on February 17, 2013, 09:26:36 am
I can't reproduce your problem with this minimal code.

#include <SFML/Graphics.hpp>

int main()
{
    sf::RenderWindow window(sf::VideoMode(512, 256), "Particles");
    window.setMouseCursorVisible(true);

    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if(event.type == sf::Event::Closed)
                window.close();
        }

        window.clear();
        window.display();
    }

    return 0;
}
 
Title: Re: Cursor does not change when hovering over resizeable portion of RenderWindow
Post by: Weeve on February 21, 2013, 04:26:08 am
Hold on, been away a few days, ill go carve down my project to find exactly what is needed to make it act like this :-)

Title: Re: Cursor does not change when hovering over resizeable portion of RenderWindow
Post by: Weeve on February 21, 2013, 04:35:23 am
Triggered when setMouseCursorVisible was placed withing game loop (causing mouse image to be set to plain mouse?)

Possible fix: check if cursor is already visible before applying changes

#include <SFML/Graphics.hpp>

int main(){
        sf::RenderWindow window(sf::VideoMode(512, 256), "Cursor-Test");

        while (window.isOpen()){
                sf::Event event;
                while (window.pollEvent(event)){
                        if(event.type == sf::Event::Closed){
                                window.close();
                        }
                }
                // I had set cursor visible in my game loop, which seems to be the trigger
                window.setMouseCursorVisible(true);
                window.display();
        }

        return 0;
}
 
Title: Re: Cursor does not change when hovering over resizeable portion of RenderWindow
Post by: Laurent on February 21, 2013, 07:57:25 am
Ok. This function is not supposed to be called 60 times per second anyway, so... the fix is probably to use it properly: avoid calling it in the main loop ;)