switch (event.type)
{
case sf::Event::JoystickButtonPressed:
- std::cout << event.joystickButton.button << std::endl;
switch (event.joystickButton.button)
{
case 0: // A
{
switch (event.type)
{
+ case sf::Event::JoystickButtonPressed:
+ switch (event.joystickButton.button)
+ {
+ case 0: // A
+ if(menu_index == 1)
+ {
+ resume_game = true;
+ menu_index = 1;
+ }
+
+ else if(menu_index == 2)
+ {
+ menu = true;
+ menu_index = 1;
+ }
+
+ else if(menu_index == 3)
+ {
+ exit_game = true;
+ menu_index = 1;
+ }
+ break;
+ default:
+
+ break;
+ }
+
+ break;
+ case sf::Event::JoystickMoved:
+ switch(event.joystickMove.axis)
+ {
+ case sf::Joystick::Y:
+ case sf::Joystick::PovY:
+ if (event.joystickMove.position <= -50)
+ {
+ if(menu_index == 1)
+ {
+ break;
+ }
+
+ else
+ {
+ menu_index -= 1;
+ }
+ break;
+ }
+ else if (event.joystickMove.position >= 50)
+ {
+ if(menu_index == 3)
+ {
+ break;
+ }
+
+ else
+ {
+ menu_index += 1;
+ }
+ break;
+ }
+ break;
+ }
+ break;
case sf::Event::KeyPressed:
switch(event.key.code)
{