sábado, 28 de marzo de 2015

Evento MouseWheelMoved en SFML


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

using namespace std;

int main()
{
 //Creo mi ventana
 sf::RenderWindow window(sf::VideoMode(800, 600), "Evento MouseWheelMoved 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 mover la ruedita del mouse
   if (event.type == sf::Event:: MouseWheelMoved )
   {
    cout << "Mover raton: " << event.mouseWheel.delta << endl;
    cout << "posicion x: " << event.mouseWheel.x << " - posicion y: " << event.mouseWheel.y << endl;
   }
   

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

 return 0;
}

No hay comentarios:

Publicar un comentario