Game Development Reference
In-Depth Information
void UpdateGamePad();
public:
static InputManager* GetInstance();
static void DestroyInstance();
Action* CreateAction();
void Update();
void TrackKeyDown(Windows::System::VirtualKey
key);
void TrackKeyUp(Windows::System::VirtualKey
key);
void TrackPointerPressed(float x, float y);
void TrackPointerReleased(float x, float y);
void TrackPointerMoved(float x, float y);
bool IsKeyDown(Windows::System::VirtualKey
key);
bool IsPointerPressed();
void GetPointerPos(float *x, float *y);
XINPUT_STATE GetGamepadState(int userIndex);
};
The InputManager stores the actions that have been created, as well as the state
of the input devices that are gathered not only during the update loop, but also from
events sent by the main application.
KeyState is an enumeration that we will use later to allow us to trigger based on
if the key (or pointer) was pressed, released, or "just released," which refers to the
frame right after the input switches from pressed to released.
Within the public methods we have methods to manage the singleton aspect of this
manager, allowing access from anywhere while ensuring we are just talking to one
InputManager . Alongside that are all of the methods required to update the input
Search WWH ::




Custom Search