Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

sfml mouse button pressed

if (event.type == sf::Event::MouseButtonPressed)
{
    if (event.mouseButton.button == sf::Mouse::Right)
    {
        std::cout << "the right button was pressed" << std::endl;
        std::cout << "mouse x: " << event.mouseButton.x << std::endl;
        std::cout << "mouse y: " << event.mouseButton.y << std::endl;
    }
}
Source by www.sfml-dev.org #
 
PREVIOUS NEXT
Tagged: #sfml #mouse #button #pressed
ADD COMMENT
Topic
Name
9+2 =