Search
 
SCRIPT & CODE EXAMPLE
 

CPP

sfml mouse click

if (sf::Mouse::isButtonPressed(sf::Mouse::Left))
{
    // left click...
}
// get global mouse position
sf::Vector2i position = sf::Mouse::getPosition();
// set mouse position relative to a window
sf::Mouse::setPosition(sf::Vector2i(100, 200), window);
Comment

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;
    }
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: 3d array in c++ 
Cpp :: how to load from files C++ 
Cpp :: C++ sqlite open file in other directory 
Cpp :: screen record ios simulator 
Cpp :: random in c++ 
Cpp :: xmake run with arg 
Cpp :: fast input and output c++ 
Cpp :: cpp code for euclids GCD 
Cpp :: c++ chrono 
Cpp :: regex for phone number c++ 
Cpp :: c++ compare strings ignore case 
Cpp :: c++ read file to char buffer 
Cpp :: initialize all elements of vector to 0 c++ 
Cpp :: size of 2d array in c++ 
Cpp :: oncomponentbeginoverlap ue4 c++ 
Cpp :: how to display a variable in c++ 
Cpp :: macro c++ 
Cpp :: format c++ discord 
Cpp :: clang cpp compile command 
Cpp :: loop through char in string c++ 
Cpp :: C++ generate a random letter 
Cpp :: C++ Multi-line comments 
Cpp :: c++ get time 
Cpp :: how to find length of character array in c++ 
Cpp :: c++ for in 
Cpp :: c++ sort vector 
Cpp :: slice std::array cpp 
Cpp :: if vector is empty c++ 
Cpp :: memset in c++ 
Cpp :: c++ 
ADD CONTENT
Topic
Content
Source link
Name
7+2 =