sábado, 28 de marzo de 2015

Evento MouseMoved en SFML


#include <SFML\Graphics.hpp>
#include <iostream>

using namespace std;

int main()
{
 //Creo mi ventana
 sf::RenderWindow window(sf::VideoMode(800, 600), "Evento MouseMoved SFML");
 window.setFramerateLimit(60);

 //creo mi gameloop
 while (window.isOpen())
 {
  //limpio la ventana
  window.clear(sf::Color::White);

  //mostrar en pantalla
  window.display();

  sf::Event event;

  while (window.pollEvent(event))
  {
   //evento  movimiento del raton
   if (event.type == sf::Event:: MouseMoved)
   {
    cout << "posicion x: " << event.mouseMove.x << " - posicion y: " << event.mouseMove.y << endl;
   }
   

   //Evento Cerrar
   if (event.type == sf::Event::Closed)
    window.close();
  }
 }

 return 0;
}

No hay comentarios:

Publicar un comentario