Skip to content

Instantly share code, notes, and snippets.

@ngscheurich
Created July 14, 2012 21:06
Show Gist options
  • Save ngscheurich/3113356 to your computer and use it in GitHub Desktop.
Save ngscheurich/3113356 to your computer and use it in GitHub Desktop.
Detect mouse position using SFML
// @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