Skip to content
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

XCB setMouseCursor #784

Closed
wants to merge 1 commit into from
Closed

XCB setMouseCursor #784

wants to merge 1 commit into from

Conversation

fundies
Copy link

@fundies fundies commented Jan 21, 2015

Adds setMouseCursor() function for linux as per issue #269. Please tell me what to put for doxygen comments and anything else to change.

#include <SFML/Graphics.hpp>

int main()
{
    sf::RenderWindow window(sf::VideoMode(800, 600), "My window");
    window.setMouseCursor(142); 

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

    return 0;
}

@eXpl0it3r
Copy link
Member

Can you please squash you two commits into one and use a proper commit message?

The discussion on this PR or the feature itself can be found on the forum.

@fundies
Copy link
Author

fundies commented Jan 21, 2015

No idea how to do either of those things.

@eXpl0it3r
Copy link
Member

@Mischa-Alff
Copy link
Contributor

Your implementation uses the built-in cursor font instead of the themed font. You should look into how to use the themed font, or simply use xcb-cursor.

Also, what does 142 mean? You should have an enum or something with the common cursor types.

@fundies
Copy link
Author

fundies commented Jan 22, 2015

I updated it to use xcb-cursor. Also I implemented setting cursor to image

xcb-cursor takes strings so new syntax is:

window.setMouseCursor(sf::CursorWait);

For images:

 sf::Image cursor;
    if (cursor.loadFromFile("pencil_1.png"))
        window.setMouseCursor(cursor.getSize().x, cursor.getSize().y, cursor.getPixelsPtr());

bool m_isExternal; ///< Tell whether the window has been created externally or by SFML
Atom m_atomClose; ///< Atom used to identify the close event
int m_oldVideoMode; ///< Video mode in use before we switch to fullscreen
bool m_cursorVisible; ///< Is the cursor visible

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still got some tabs here, but other than that they all seem to be gone.

@fundies
Copy link
Author

fundies commented Jan 25, 2015

Windows and Linux now work. I'm having trouble figuring out os x...

@binary1248
Copy link
Member

Superseded by #827.

@binary1248 binary1248 closed this Mar 15, 2015
@eXpl0it3r eXpl0it3r added this to the 2.5 milestone Jul 18, 2017
@eXpl0it3r eXpl0it3r moved this from Ready to Merged in SFML 2.5.0 Jul 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
SFML 2.5.0
  
Merged / Superseded
Development

Successfully merging this pull request may close these issues.

None yet

5 participants