CG_Labs  2021.2
Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
InputHandler Class Reference

#include <InputHandler.h>

Classes

struct  IState
 

Public Member Functions

 InputHandler ()
 
void FeedKeyboard (int key, int scancode, int action)
 
void FeedMouseButtons (int button, int action)
 
void FeedMouseMotion (glm::vec2 const &position)
 
void Advance ()
 
std::uint32_t GetScancodeState (int scancode)
 
std::uint32_t GetKeycodeState (int key)
 
std::uint32_t GetMouseState (std::uint32_t button)
 
glm::vec2 GetMousePositionAtStateShift (std::uint32_t button)
 
glm::vec2 GetMousePosition ()
 
bool IsMouseCapturedByUI () const
 
bool IsKeyboardCapturedByUI () const
 
void SetUICapture (bool mouseCapture, bool keyboardCapture)
 

Private Types

using InputStateMap = std::unordered_map< size_t, IState >
 

Private Member Functions

void DownEvent (InputStateMap &map, size_t loc)
 
void UpEvent (InputStateMap &map, size_t loc)
 
std::uint32_t GetState (InputStateMap const &map, size_t loc)
 

Private Attributes

InputStateMap mScancodeMap
 
InputStateMap mKeycodeMap
 
InputStateMap mMouseMap
 
glm::vec2 mMousePosition { -1.0f }
 
std::array< glm::vec2, GLFW_MOUSE_BUTTON_LAST > mMousePositionSwitched
 
bool mMouseCapturedByUI { false }
 
bool mKeyboardCapturedByUI { false }
 
std::uint64_t mTick { 0ULL }
 

Member Typedef Documentation

◆ InputStateMap

using InputHandler::InputStateMap = std::unordered_map<size_t, IState>
private

Constructor & Destructor Documentation

◆ InputHandler()

InputHandler::InputHandler ( )

Member Function Documentation

◆ Advance()

void InputHandler::Advance ( )

◆ DownEvent()

void InputHandler::DownEvent ( InputStateMap map,
size_t  loc 
)
private

◆ FeedKeyboard()

void InputHandler::FeedKeyboard ( int  key,
int  scancode,
int  action 
)

◆ FeedMouseButtons()

void InputHandler::FeedMouseButtons ( int  button,
int  action 
)

◆ FeedMouseMotion()

void InputHandler::FeedMouseMotion ( glm::vec2 const &  position)

◆ GetKeycodeState()

std::uint32_t InputHandler::GetKeycodeState ( int  key)

◆ GetMousePosition()

glm::vec2 InputHandler::GetMousePosition ( )

◆ GetMousePositionAtStateShift()

glm::vec2 InputHandler::GetMousePositionAtStateShift ( std::uint32_t  button)

◆ GetMouseState()

std::uint32_t InputHandler::GetMouseState ( std::uint32_t  button)

◆ GetScancodeState()

std::uint32_t InputHandler::GetScancodeState ( int  scancode)

◆ GetState()

std::uint32_t InputHandler::GetState ( InputStateMap const &  map,
size_t  loc 
)
private

◆ IsKeyboardCapturedByUI()

bool InputHandler::IsKeyboardCapturedByUI ( ) const

◆ IsMouseCapturedByUI()

bool InputHandler::IsMouseCapturedByUI ( ) const

◆ SetUICapture()

void InputHandler::SetUICapture ( bool  mouseCapture,
bool  keyboardCapture 
)

◆ UpEvent()

void InputHandler::UpEvent ( InputStateMap map,
size_t  loc 
)
private

Member Data Documentation

◆ mKeyboardCapturedByUI

bool InputHandler::mKeyboardCapturedByUI { false }
private

◆ mKeycodeMap

InputStateMap InputHandler::mKeycodeMap
private

◆ mMouseCapturedByUI

bool InputHandler::mMouseCapturedByUI { false }
private

◆ mMouseMap

InputStateMap InputHandler::mMouseMap
private

◆ mMousePosition

glm::vec2 InputHandler::mMousePosition { -1.0f }
private

◆ mMousePositionSwitched

std::array<glm::vec2, GLFW_MOUSE_BUTTON_LAST> InputHandler::mMousePositionSwitched
private

◆ mScancodeMap

InputStateMap InputHandler::mScancodeMap
private

◆ mTick

std::uint64_t InputHandler::mTick { 0ULL }
private

The documentation for this class was generated from the following files: