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

Author Topic: Mouse cursor not visible in sf::Style::Fullscreen or sf::Style::None  (Read 3293 times)

0 Members and 1 Guest are viewing this topic.

skaught

  • Newbie
  • *
  • Posts: 3
    • View Profile
Hello,

I recently started using SFML 2.0 for our software's windowing, unfortunately I've run into a bit of an issue.

When setting the window style to Fullscreen or None, the mouse cursor dissapears when I move the mouse over the window. I've tried calling window.setMouseCursorVisible(true); but that has no effect.

Running Windows 7 64 bit, aero enabled.
ATI Radeon HD5800 with latest drivers.
It's a dev machine and has 3 monitors.

« Last Edit: March 27, 2013, 07:00:20 pm by skaught »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Mouse cursor not visible in sf::Style::Fullscreen or sf::Style::None
« Reply #1 on: March 27, 2013, 11:43:29 pm »
Do you make sure to call setMouseCursorVisible after you've created the window?

#include <SFML/Graphics.hpp>

int main()
{
        sf::Window window(sf::VideoMode(800, 600), "Y U NO PROVIDE MINIMAL EXAMPLE?!", sf::Style::None);
        //sf::Window window(sf::VideoMode(1024, 768), "Y U NO PROVIDE MINIMAL EXAMPLE?!", sf::Style::Fullscreen);
        window.setFramerateLimit(60);

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

                window.display();
        }
}

Works without problems for me...
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

skaught

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Mouse cursor not visible in sf::Style::Fullscreen or sf::Style::None
« Reply #2 on: March 28, 2013, 12:21:15 am »
Yes, I call it after creating the window.

Sorry, here's an excerpt from my code, I've pulled some stuff out.

I guess I should note that in this particular case _owner->getX() and _owner->getY() return 1, so the window size is the desktop size, 1920x1200.

void WindowThread::operator ()()
{
        sf::ContextSettings settings;
        settings.depthBits = 16;
        settings.stencilBits = 8;
        sf::Window window(sf::VideoMode(width, height, desktop.bitsPerPixel), _owner->getName(),sf::Style::None,settings);
        window.setMouseCursorVisible(true);
        int x = static_cast<int>(desktop.width * _owner->getX());
        int y = static_cast<int>(desktop.height * _owner->getY());
        window.setPosition(sf::Vector2i(x, y));
        window.setActive(false);
        _owner->resize(width, height);
        utility::refct_ptr<RenderThread> renderThread(new RenderThread(_owner, &window));
        _owner->setRenderThread(renderThread);
        renderThread->run();
        sf::Event event;
        sf::Keyboard::Key lastKey = sf::Keyboard::Unknown;
        utility::Rect<int> mouseInfo(0,0,(int)width,(int)height);
        while(wait(1000) != EWAIT_TERMINATE) {
                //handle events
        }
}

void RenderThread::operator ()()
{      
        while(wait(10000000) != EWAIT_TERMINATE) {
                _window->setActive(true);
                while(!_eventQueue.empty()) {
                        _eventQueue.front()();
                        _eventQueue.pop();
                }
                _owner->draw();
                _window->display();
        }
}
 
« Last Edit: March 28, 2013, 12:24:03 am by skaught »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Mouse cursor not visible in sf::Style::Fullscreen or sf::Style::None
« Reply #3 on: March 28, 2013, 12:54:23 am »
Sorry, here's an excerpt from my code, I've pulled some stuff out.
Well that's neither a minimal nor a complete example.. ::)

Does the one I posted also hide the cursor?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

skaught

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Mouse cursor not visible in sf::Style::Fullscreen or sf::Style::None
« Reply #4 on: March 28, 2013, 01:42:04 am »
Ok, I see what you were asking now.

I tried out your code, as it currently is, the cursor shows over the window.

However, if I change the window size to be 1920x1200, my current screen resolution. It actually kind of acts like it went to fullscreen mode instead of windowed without decorations.

Also the mouse now dissapears when I move it over the window.

The mouse also dissapears in Fullscreen.
« Last Edit: March 28, 2013, 01:47:24 am by skaught »

 

anything