The controller class.
More...
#include <SageController.h>
|
| const bool | ButtonDown (DWORD) const |
| | Check button state.
|
| |
|
|
XINPUT_STATE | m_strState |
| | Current state (polled each frame).
|
| |
|
bool | m_bButtonADown = false |
| | A button is down.
|
| |
|
bool | m_bButtonBDown = false |
| | B button is down.
|
| |
|
bool | m_bButtonXDown = false |
| | X button is down.
|
| |
|
bool | m_bButtonYDown = false |
| | Y button is down.
|
| |
|
bool | m_bButtonLSDown = false |
| | Left shoulder button is down.
|
| |
|
bool | m_bButtonRSDown = false |
| | Right shoulder button is down.
|
| |
Polled controller class providing access to control states and whether buttons have toggled (were up and went down) since the last frame.
◆ ButtonDown()
| const bool CController::ButtonDown |
( |
DWORD | button | ) |
const |
|
protected |
Test whether a button is currently down.
- Parameters
-
- Returns
- true if that button is down.
◆ GetButtonADown()
| const bool CController::GetButtonADown |
( |
| ) |
|
Test whether button A is down.
- Returns
- true if button A is down.
◆ GetButtonAToggle()
| const bool CController::GetButtonAToggle |
( |
| ) |
|
Get button A toggle status. Uses m_bButtonADown to store previous button state.
- Returns
- true if button A was up and is now down.
◆ GetButtonBDown()
| const bool CController::GetButtonBDown |
( |
| ) |
|
Test whether button B is down.
- Returns
- true if button B is down.
◆ GetButtonBToggle()
| const bool CController::GetButtonBToggle |
( |
| ) |
|
Get button B toggle status. Uses m_bButtonBDown to store previous button state.
- Returns
- true if button B was up and is now down.
◆ GetButtonLSToggle()
| const bool CController::GetButtonLSToggle |
( |
| ) |
|
Get left shoulder button toggle status. Uses m_bButtonLSDown to store previous button state.
- Returns
- true if left shoulder button was up and is now down.
◆ GetButtonRSToggle()
| const bool CController::GetButtonRSToggle |
( |
| ) |
|
Get right shoulder button toggle status. Uses m_bButtonRSDown to store previous button state.
- Returns
- true if right shoulder button was up and is now down.
◆ GetButtonXDown()
| const bool CController::GetButtonXDown |
( |
| ) |
|
Test whether button X is down.
- Returns
- true if button X is down.
◆ GetButtonXToggle()
| const bool CController::GetButtonXToggle |
( |
| ) |
|
Get button X toggle status. Uses m_bButtonXDown to store previous button state.
- Returns
- true if button X was up and is now down.
◆ GetButtonYDown()
| const bool CController::GetButtonYDown |
( |
| ) |
|
Test whether button Y is down.
- Returns
- true if button Y is down.
◆ GetButtonYToggle()
| const bool CController::GetButtonYToggle |
( |
| ) |
|
Get button Y toggle status. Uses m_bButtonYDown to store previous button state.
- Returns
- true if button Y was up and is now down.
◆ GetDPadDown()
| const bool CController::GetDPadDown |
( |
| ) |
const |
Test whether the digital pad down button is currently down.
- Returns
- true if digital pad down button is down.
◆ GetDPadLeft()
| const bool CController::GetDPadLeft |
( |
| ) |
const |
Test whether the digital pad left button is currently down.
- Returns
- true if digital pad left button is down.
◆ GetDPadRight()
| const bool CController::GetDPadRight |
( |
| ) |
const |
Test whether the digital pad right button is currently down.
- Returns
- true if digital pad right button is down.
◆ GetDPadUp()
| const bool CController::GetDPadUp |
( |
| ) |
const |
Test whether the digital pad up button is currently down.
- Returns
- true if digital pad up button is down.
◆ GetLThumb()
| const Vector2 CController::GetLThumb |
( |
| ) |
const |
Get left thumb stick position.
- Returns
- Normalized left thumb stick position.
◆ GetLTrigger()
| const float CController::GetLTrigger |
( |
| ) |
const |
Get left trigger position.
- Returns
- Left trigger position as a float between 0 and 1.
◆ GetRThumb()
| const Vector2 CController::GetRThumb |
( |
| ) |
const |
Get right thumb stick position.
- Returns
- Normalized right thumb stick position.
◆ GetRTrigger()
| const float CController::GetRTrigger |
( |
| ) |
const |
Get right trigger position.
- Returns
- Right trigger position as a float between 0 and 1.
◆ GetState()
| void CController::GetState |
( |
| ) |
|
Poll the controller and get its current state into m_strState. This function should be called once per frame.
◆ IsConnected()
| bool CController::IsConnected |
( |
| ) |
|
Test whether there is a controller connected.
- Returns
- true if there is a controller connected.
◆ Vibrate()
| void CController::Vibrate |
( |
WORD | leftVal = 0, |
|
|
WORD | rightVal = 0 ) |
Set controller's left and right vibration level. Note: calling this function with no parameters defaults to all stop.
- Parameters
-
| leftVal | Left vibrate speed from zero to max unsigned short. |
| rightVal | Right vibrate speed from zero to max unsigned short. |