2
0
mirror of https://github.com/team2059/Dent synced 2024-12-18 20:52:29 -05:00

Added documentation

This commit is contained in:
Austen Adler 2015-03-23 11:55:22 -04:00
parent 03bcdd5a12
commit 76ffaf25f6

View File

@ -3,14 +3,53 @@
#include "WPILib.h" #include "WPILib.h"
/**
* @brief An xbox or ps3 controller
*/
class GameController{ class GameController{
private: private:
Joystick *stick; Joystick *stick; //<! The controller
std::string type; std::string type; //<! The type of controller. Can be "xbox" or "ps3"
JoystickButton *a, *b, *x, *y, *lb, *rb, *tlb, *trb, *start, *back, *lPress, *rPress, *dUp, *dDown, *dLeft, *dRight; JoystickButton *a, //<! A key for xbox, x for ps3
*b, //<! B key for xbox, circle for ps3
*x, //<! X key for xbox, square for ps3
*y, //<! Y key for xbox, triangle for ps3
*lb, //<! Left button
*rb, //<! Right button
*tlb, //<! Top left Button (ps3 only)
*trb, //<! Top right button (ps3 only)
*start, //<! Start button
*back, //<! Back button
*lPress, //<! Press down on left stick
*rPress, //<! Press down on right stick
*dUp, //<! D-Pad up
*dDown, //<! D-Pad down
*dLeft, //<! D-Pad left
*dRight; //<! D-Pad right
public: public:
/**
* @brief Constructs GameController
*
* @param port The port of the controller
* @param controllerType The type of controller. Can be "xbox" or "ps3"
*/
GameController(int port, std::string controllerType); GameController(int port, std::string controllerType);
/**
* @brief Gets the value of a button
*
* @param button The button to get
*
* @return True only if the button is pressed
*/
bool GetButton(std::string button); bool GetButton(std::string button);
/**
* @brief Gets an axis value
*
* @param position Side of the controller. Can be "left" or "right"
* @param axis The axis to get. Can be "x", "y", or "throttle" for xbox or "x" and "y" for ps3
*
* @return The axis value from (-1.0 to 1.0)
*/
double GetAxis(std::string position, std::string axis); double GetAxis(std::string position, std::string axis);
}; };
#endif #endif