New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sf::Mouse::getPosition(relativeToWindow) in fullscreen always returns (0, 0) #782

Closed
mantognini opened this Issue Jan 14, 2015 · 1 comment

Comments

Projects
None yet
1 participant
@mantognini
Member

mantognini commented Jan 14, 2015

SSCCE:

#include <SFML/Graphics.hpp>
#include "ResourcePath.hpp"

int main(int, char const**)
{
    sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window", sf::Style::Fullscreen);

    sf::Font font;
    if (!font.loadFromFile(resourcePath() + "sansation.ttf")) {
        return EXIT_FAILURE;
    }

    sf::Text text("toto", font, 50);
    text.setColor(sf::Color::White);
    text.setPosition(50, 100);

    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed) {
                window.close();
            }
            if (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Escape) {
                window.close();
            }
        }

        auto pos = sf::Mouse::getPosition(window);
        auto str = std::to_string(pos.x) + " - " + std::to_string(pos.y);
        text.setString(str);

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

    return EXIT_SUCCESS;
}

Result:

0 - 0 is displayed, always, and the stdout is spammed with The content view is not a valid SFOpenGLView.

Expected:

actual cursor position should be displayed instead.

@mantognini mantognini self-assigned this Jan 14, 2015

MoustacheFarmer pushed a commit to MoustacheFarmer/SFML that referenced this issue Feb 3, 2015

Thom Robinson (Macbook Pro) Thom Robinson (Macbook Pro)
Fixed an issue in InputImpl::getSFOpenGLViewFromSFMLWindow failing to…
… retrieve the SFOpenGLView from the contentview's subview when using fullscreen (see issue SFML#782).

@mantognini mantognini added this to the 2.3 milestone Feb 4, 2015

@mantognini

This comment has been minimized.

Show comment
Hide comment
@mantognini

mantognini Feb 4, 2015

Member

Superseded by #792

Member

mantognini commented Feb 4, 2015

Superseded by #792

@mantognini mantognini closed this Feb 4, 2015

eXpl0it3r added a commit that referenced this issue Feb 23, 2015

Fixed an issue in InputImpl::getSFOpenGLViewFromSFMLWindow failing to…
… retrieve the SFOpenGLView from the contentview's subview when using fullscreen (see issue #782).

MoustacheFarmer pushed a commit to MoustacheFarmer/SFML that referenced this issue Mar 5, 2015

Thom Robinson (Macbook Pro) Thom Robinson (Macbook Pro)
Fixed an issue in InputImpl::getSFOpenGLViewFromSFMLWindow failing to…
… retrieve the SFOpenGLView from the contentview's subview when using fullscreen (see issue SFML#782).

@mantognini mantognini removed their assignment Apr 30, 2015

@mantognini mantognini self-assigned this Feb 7, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment