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 :: error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": 
Cpp :: fork c 
Cpp :: c++ main function 
Cpp :: extends c++ 
Cpp :: map defualt value c++ 
Cpp :: c++ rule of five 
Cpp :: how to make a c++ program which takes two integers and calculate average 
Cpp :: dynamically generating 2d array in cpp 
Cpp :: c++ lcm 
Cpp :: push front vector cpp 
Cpp :: Could not load the Visual C++ component "VCBuild.exe". To fix this, 1) install the .NET Framework 2.0 SDK, 2) install Microsoft Visual Studio 2005 or 3) add the location of the component to the system path if it is installed elsewhere. 
Cpp :: pow in c++ 
Cpp :: count word accurances in a string c++ 
Cpp :: how to copy one vector to another 
Cpp :: prints out the elements in the array c++ 
Cpp :: appending int to string in cpp 
Cpp :: take pieces of a string in c++ 
Cpp :: how to make calculaor in c++ 
Cpp :: rand c++ 
Cpp :: c++ 2d vector assign value 
Cpp :: how to pass function as a parameter in c++ 
Cpp :: segmented sieve cpp 
Cpp :: What is the story of c++ 
Cpp :: print 2d array c++ 
Cpp :: check if char in string c++ 
Cpp :: size of array 
Cpp :: indexing strings in c++ 
Cpp :: c++ output 
Cpp :: c++ thread incide class 
Cpp :: comparator in sort c++ 
ADD CONTENT
Topic
Content
Source link
Name
5+5 =