GUInity
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
Input Class Reference

Public Member Functions

 Input (shared_ptr< GLFWwindow > w)
 
 ~Input ()
 

Static Public Member Functions

static bool getKeyPressed (int keyCode)
 
static bool getKeyReleased (int keyCode)
 
static bool getKey (int keyCode)
 
static bool getMouseButtonPressed (int keyCode)
 
static bool getMouseButtonReleased (int keyCode)
 
static bool getMouseButton (int keyCode)
 
static void updateInputState ()
 
static shared_ptr< GLFWwindow > getWindow ()
 
static void setWindow (shared_ptr< GLFWwindow > window)
 

Static Public Attributes

static std::array< int, nKeys > oldKeyboardInputState = { 0 }
 
static std::array< int, nKeys > keyboardInputState = { 0 }
 
static std::array< int, nMouseButtons > oldMouseInputState = { 0 }
 
static std::array< int, nMouseButtons > mouseInputState = { 0 }
 
static glm::vec2 lastMousePos
 
static glm::vec2 mousePos
 
static glm::vec2 mouseDelta
 

Constructor & Destructor Documentation

Input::Input ( shared_ptr< GLFWwindow >  w)

Constructor for a window handle

Input::~Input ( )
inline

Default destructor

Member Function Documentation

bool Input::getKey ( int  keyCode)
static

Returns true if the key IS pressed (every frame that the key is pressed)

bool Input::getKeyPressed ( int  keyCode)
static

Returns true if the key was pressed (1st frame only)

bool Input::getKeyReleased ( int  keyCode)
static

Returns true if the key was pressed (release frame only)

bool Input::getMouseButton ( int  keyCode)
static

Returns true if the mouse button IS pressed (every frame that the mouse button is pressed)

bool Input::getMouseButtonPressed ( int  keyCode)
static

Returns true if the mouse button was pressed (1st frame only)

bool Input::getMouseButtonReleased ( int  keyCode)
static

Returns true if the mouse button was pressed (release frame only)

static shared_ptr<GLFWwindow> Input::getWindow ( )
static

window getter

static void Input::setWindow ( shared_ptr< GLFWwindow >  window)
static

window setter

void Input::updateInputState ( )
static

Updates the state of input. Swaps the old/new and gets the new input state

Uses move to prevend copying arrays

Get updated value from GLFW for keyboard state

Uses move to prevend copying arrays

Get updated value from GLFW for mouse state

Updates mouse position

Member Data Documentation

std::array< int, Input::nKeys > Input::keyboardInputState = { 0 }
static

Keyboard state of all keyboard keys on current frame

glm::vec2 Input::lastMousePos
static

Last mouse position x,y on screen

glm::vec2 Input::mouseDelta
static

Mouse position delta, x,y on screen

std::array< int, Input::nMouseButtons > Input::mouseInputState = { 0 }
static

Keyboard state of all mouse buttons on current frame

glm::vec2 Input::mousePos
static

Current mouse position x,y on screen

std::array< int, Input::nKeys > Input::oldKeyboardInputState = { 0 }
static

Keyboard state of all keyboard keys on last frame

std::array< int, Input::nMouseButtons > Input::oldMouseInputState = { 0 }
static

Keyboard state of all mouse buttons on last frame


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