Skip to content
Snippets Groups Projects
Select Git revision
  • 8f498f9f14e3a1fd22b927112f873a6b5ce176af
  • master default
  • cgnsUnstructured
  • partitioning
  • poppler
  • HighOrderBLCurving
  • gmsh_3_0_4
  • gmsh_3_0_3
  • gmsh_3_0_2
  • gmsh_3_0_1
  • gmsh_3_0_0
  • gmsh_2_16_0
  • gmsh_2_15_0
  • gmsh_2_14_1
  • gmsh_2_14_0
  • gmsh_2_13_2
  • gmsh_2_13_1
  • gmsh_2_12_0
  • gmsh_2_11_0
  • gmsh_2_10_1
  • gmsh_2_10_0
  • gmsh_2_9_3
  • gmsh_2_9_2
  • gmsh_2_9_1
  • gmsh_2_9_0
  • gmsh_2_8_6
26 results

GamePad.h

Blame
  • Forked from gmsh / gmsh
    Source project has a limited visibility.
    GamePad.h 1.19 KiB
    // Gmsh - Copyright (C) 1997-2017 C. Geuzaine, J.-F. Remacle
    //
    // See the LICENSE.txt file for license information. Please report all
    // bugs and problems to the public mailing list <gmsh@onelab.info>.
    //
    // Contributed by Gilles Marckmann <gilles.marckmann@ec-nantes.fr>
    
    #ifndef _GAMEPAD_H_
    #define _GAMEPAD_H_
    
    #define GP_RANGE 1.0
    #define GP_DEV 16
    #define GP_BUTTONS 32
    #define GP_AXES 6
    
    #include "GmshConfig.h"
    
    #if defined(WIN32)
    #include <windows.h>
    #include <mmsystem.h>
    #elif defined(HAVE_LINUX_JOYSTICK)
    #include <linux/joystick.h>
    #include <fcntl.h>
    #define GAMEPAD_DEV "/dev/input/js0"
    #endif
    
    class GamePad {
     public:
      bool active;
      bool toggle_status[GP_BUTTONS];
      bool event_read;
      double frequency;
      GamePad();
      ~GamePad();
      double axe[GP_AXES];
      bool button[GP_BUTTONS];
      bool toggle(const int _nbut);
      int read_event();
      void affiche();
      int button_map[10];
      int axe_map[8];
     private:
      char name[256];
    #if defined(WIN32)
      int gamepad_fd;
      JOYCAPS caps;
      JOYINFOEX infoex;
      JOYINFO info;
      int axes;
      int buttons;
    #elif defined(HAVE_LINUX_JOYSTICK)
      int gamepad_fd;
      js_event event;
      __u32 version;
      __u8 axes;
      __u8 buttons;
    #else
      int axes;
      int buttons;
    #endif
    };
    
    #endif