domingo, 29 de marzo de 2015

Evento JoystickButtonPressed en SFML


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

using namespace std;

int main()
{
 //Creo mi ventana
 sf::RenderWindow window(sf::VideoMode(800, 600), "Evento JoystickButtonPressed 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  joystick boton presionado
   if (event.type == sf::Event:: JoystickButtonPressed )
   {
    cout << "Boton Joystick presionado" << endl;
    cout << "ID joystick: " << event.joystickButton.joystickId << endl;
    cout << "boton: " << event.joystickButton.button << endl;
   }
   

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

 return 0;
}

No hay comentarios:

Publicar un comentario