| 
    cpp-sdl2
    
   C++ header-only SDL2 wrapper 
   | 
 
#include <joystick.hpp>
Public Member Functions | |
| Joystick () | |
| Default ctor, create a non-valid (empty) joystick object.  More... | |
| Joystick (int device_index) | |
| Create a joystick by opening a joystick device.  More... | |
| Joystick (SDL_Joystick *joystick) | |
| Create a joystick from an SDL joystick.  More... | |
| Joystick (Joystick const &)=delete | |
| Joystick & | operator= (Joystick const &)=delete | 
| Joystick (Joystick &&other) noexcept | |
| move ctor  More... | |
| Joystick & | operator= (Joystick &&other) noexcept | 
| move assign operator  More... | |
| ~Joystick () | |
| Will automatically close the joystick when going out of scope if this object owns the pointer.  More... | |
| Haptic | open_haptic () const | 
| Open haptics for this device.  More... | |
| SDL_JoystickPowerLevel | power_level () const | 
| Get the power level of the joystick. Will throw if unknown.  More... | |
| bool | attached () const | 
| Return true if device is currently attached.  More... | |
| int16_t | get_axis (int axis) const | 
| Get the current immediate value of the given axis.  More... | |
| sdl::Vec2i | get_ball (int ball) const | 
| Get the current immediate value of the given trackball.  More... | |
| uint8_t | get_button (int button) const | 
| Get the current immediate value of the given button.  More... | |
| uint8_t | get_hat (int hat) const | 
| Get the current immediate value of the given hat.  More... | |
| std::string | name () const | 
| Get the name of the joystick.  More... | |
| int | num_hats () const | 
| Get how many hats.  More... | |
| int | num_buttons () const | 
| Get how many buttons.  More... | |
| int | num_balls () const | 
| Get how many balls.  More... | |
| int | num_axes () const | 
| Get how many axes.  More... | |
| SDL_JoystickID | instance_id () const | 
| Get this joystick instance id.  More... | |
| bool | operator== (Joystick const &other) const | 
| bool | operator== (SDL_Joystick *other) const | 
| bool | operator== (SDL_JoystickID other) const | 
Static Public Member Functions | |
| static Joystick | non_owning (SDL_Joystick *stick) | 
| construct a non-owning wrapper around this joystick  More... | |
| static Joystick | non_joystick (SDL_JoystickID joyid) | 
| construct a non-owning wrapper around this joystick id  More... | |
Private Member Functions | |
| Joystick (SDL_Joystick *stick, bool owning_state) | |
| Construct a non-owning joystick object.  More... | |
Private Attributes | |
| SDL_Joystick * | joystick_ = nullptr | 
| const bool | owner_ = true | 
Definition at line 11 of file joystick.hpp.
      
  | 
  inlineprivate | 
Construct a non-owning joystick object.
Definition at line 17 of file joystick.hpp.
      
  | 
  inline | 
Default ctor, create a non-valid (empty) joystick object.
Definition at line 24 of file joystick.hpp.
Referenced by Joystick(), and non_joystick().
      
  | 
  inline | 
Create a joystick by opening a joystick device.
Definition at line 27 of file joystick.hpp.
      
  | 
  inline | 
Create a joystick from an SDL joystick.
Definition at line 33 of file joystick.hpp.
References Joystick(), and operator=().
      
  | 
  delete | 
      
  | 
  inlinenoexcept | 
move ctor
Definition at line 39 of file joystick.hpp.
      
  | 
  inline | 
Will automatically close the joystick when going out of scope if this object owns the pointer.
Definition at line 59 of file joystick.hpp.
      
  | 
  inline | 
Return true if device is currently attached.
Definition at line 78 of file joystick.hpp.
      
  | 
  inline | 
Get the current immediate value of the given axis.
Definition at line 81 of file joystick.hpp.
      
  | 
  inline | 
Get the current immediate value of the given trackball.
Definition at line 84 of file joystick.hpp.
      
  | 
  inline | 
Get the current immediate value of the given button.
Definition at line 95 of file joystick.hpp.
      
  | 
  inline | 
Get the current immediate value of the given hat.
Definition at line 98 of file joystick.hpp.
      
  | 
  inline | 
Get this joystick instance id.
Definition at line 144 of file joystick.hpp.
Referenced by operator==().
      
  | 
  inline | 
Get the name of the joystick.
Definition at line 101 of file joystick.hpp.
      
  | 
  inlinestatic | 
construct a non-owning wrapper around this joystick id
Definition at line 157 of file joystick.hpp.
References Joystick().
      
  | 
  inlinestatic | 
construct a non-owning wrapper around this joystick
Definition at line 154 of file joystick.hpp.
      
  | 
  inline | 
Get how many axes.
Definition at line 134 of file joystick.hpp.
      
  | 
  inline | 
Get how many balls.
Definition at line 124 of file joystick.hpp.
      
  | 
  inline | 
Get how many buttons.
Definition at line 114 of file joystick.hpp.
      
  | 
  inline | 
Get how many hats.
Definition at line 104 of file joystick.hpp.
      
  | 
  inline | 
Open haptics for this device.
Definition at line 65 of file joystick.hpp.
Referenced by Joystick().
      
  | 
  inline | 
Definition at line 166 of file joystick.hpp.
References joystick_.
      
  | 
  inline | 
Definition at line 168 of file joystick.hpp.
      
  | 
  inline | 
Definition at line 170 of file joystick.hpp.
References instance_id().
      
  | 
  inline | 
Get the power level of the joystick. Will throw if unknown.
Definition at line 68 of file joystick.hpp.
      
  | 
  private | 
Definition at line 13 of file joystick.hpp.
Referenced by operator=(), and operator==().
      
  | 
  private | 
Definition at line 14 of file joystick.hpp.
Referenced by operator=().