Created
July 14, 2012 21:06
-
-
Save ngscheurich/3113356 to your computer and use it in GitHub Desktop.
Detect mouse position using SFML
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @library SFML 2.0 RC | |
while (window.isOpen()) { | |
sf::Event event; | |
while (window.pollEvent(event)) { | |
switch (event.type) { | |
case sf::Event::MouseButtonPressed: | |
cout << "Button " << event.mouseButton.button << " @ " | |
<< sf::Mouse::getPosition(window).x << ", " | |
<< sf::Mouse::getPosition(window).y << "\n"; | |
break; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment