SimpleGL  1.1.0
A framework for platform independent rendering
Public Member Functions | Static Public Member Functions | Static Protected Attributes | List of all members
sgl::KeyCallback Class Reference

This class wraps a GLFW key callback. More...

#include <glfw_callback.hpp>

Public Member Functions

 KeyCallback (void)
 Creates a key callback. More...
 
 ~KeyCallback (void)
 Destroys a key callback. More...
 
virtual void invoke (GLFWwindow *window, Key key, int scancode, Action action, Modifier mods)
 This function gets called whenever a key is pressed or released. More...
 

Static Public Member Functions

static KeyCallbackgetCurrent ()
 Returns the current key callback. More...
 
static void setCurrent (KeyCallback *callback)
 Sets the current key callback. More...
 
static void dispatch (GLFWwindow *window, int key, int scancode, int action, int mods)
 Dispatches the member function. More...
 

Static Protected Attributes

static KeyCallbackcurrent = nullptr
 Stores the current instance of the key callback. More...
 

Detailed Description

This class wraps a GLFW key callback.

Definition at line 75 of file glfw_callback.hpp.

Constructor & Destructor Documentation

sgl::KeyCallback::KeyCallback ( void  )

Creates a key callback.

Definition at line 72 of file glfw_callback.cpp.

sgl::KeyCallback::~KeyCallback ( void  )

Destroys a key callback.

Definition at line 76 of file glfw_callback.cpp.

Member Function Documentation

void sgl::KeyCallback::dispatch ( GLFWwindow *  window,
int  key,
int  scancode,
int  action,
int  mods 
)
static

Dispatches the member function.

Parameters
windowThe window which received the event.
keyThe key of the event.
scancodeThe system-specific scancode for the key.
actionThe action of the event.
modsA bit field that describes which modifier keys were active.

Definition at line 65 of file glfw_callback.cpp.

KeyCallback * sgl::KeyCallback::getCurrent ( )
static

Returns the current key callback.

Returns
The current key callback.

Definition at line 54 of file glfw_callback.cpp.

void sgl::KeyCallback::invoke ( GLFWwindow *  window,
Key  key,
int  scancode,
Action  action,
Modifier  mods 
)
virtual

This function gets called whenever a key is pressed or released.

Default implementation of the key callback.

Parameters
windowThe window which received the event.
keyThe key of the event.
scancodeThe system-specific scancode for the key.
actionThe action of the event.
modsA bit field that describes which modifier keys were active.

Definition at line 84 of file glfw_callback.cpp.

void sgl::KeyCallback::setCurrent ( KeyCallback callback)
static

Sets the current key callback.

Parameters
callbackThe key callback to set.

Definition at line 58 of file glfw_callback.cpp.

Member Data Documentation

KeyCallback * sgl::KeyCallback::current = nullptr
staticprotected

Stores the current instance of the key callback.

Definition at line 79 of file glfw_callback.hpp.


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