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

Author Topic: Cursor does not change when hovering over resizeable portion of RenderWindow  (Read 2597 times)

0 Members and 2 Guests are viewing this topic.

Weeve

  • Jr. Member
  • **
  • Posts: 87
  • C++ Programmer (Intermediate), 3D Artist (Skilled)
    • View Profile
    • Email
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  :-\
Long live rapid project development! -- Kestrel3D Game-Engine nearing completion

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
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;
}
 
Laurent Gomila - SFML developer

Weeve

  • Jr. Member
  • **
  • Posts: 87
  • C++ Programmer (Intermediate), 3D Artist (Skilled)
    • View Profile
    • Email
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 :-)

Long live rapid project development! -- Kestrel3D Game-Engine nearing completion

Weeve

  • Jr. Member
  • **
  • Posts: 87
  • C++ Programmer (Intermediate), 3D Artist (Skilled)
    • View Profile
    • Email
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;
}
 
Long live rapid project development! -- Kestrel3D Game-Engine nearing completion

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
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 ;)
Laurent Gomila - SFML developer

 

anything