"L. Spiro Engine"
|
Buffer keyboard data until the next frame of the game is processed. More...
#include <LSEKeyboardBuffer.h>
Classes | |
struct | LSE_KEY_EVENT |
Public Types | |
enum | LSE_KEY_EVENTS { LSE_KE_KEYUP, LSE_KE_KEYDOWN } |
enum | LSE_TOTALS { LSE_T_TOTALKEYS = 300, LSE_T_MAXEVENTS = 250 } |
Public Member Functions | |
LSVOID LSE_CALL | OnKeyDown (LSUINT32 _ui32Key) |
LSVOID LSE_CALL | OnKeyUp (LSUINT32 _ui32Key) |
LSVOID LSE_CALL | UpdateKeyboard (CKeyboard *_pkKeyboard) |
Protected Types | |
typedef struct lse::CKeyboardBuffer::LSE_KEY_EVENT * | LPLSE_KEY_EVENT |
typedef struct lse::CKeyboardBuffer::LSE_KEY_EVENT | LPCLSE_KEY_EVENT |
Protected Attributes | |
CSVectorPoD< LSE_KEY_EVENT, LSUINT8, 2UL > | m_keKeyData [LSE_T_TOTALKEYS] |
CTime | m_tTime |
CCriticalSection | m_csCrit |
Friends | |
class | CKeyboard |
Buffer keyboard data until the next frame of the game is processed.
Class CKeyboardBuffer Description: Description: Keyboard input has to be handled by the game on a frame-by-frame basis. But simply reading the keys each frame will cause lack of sensivity when keys are pressed and released before the next frame. Additionally, key timestamps will be off a bit. We use a buffer to store key events until the next frame, at which time we pass the buffered data off to the actual keyboard. Each key has an array of events. When passing the data off to the real keyboard, we remove the bottom index from each key. This allows all events to be processed in order on a per-frame basis and without missing any events.
This class provides the buffered key data. Each key contains an array of events. Each event contains the event information (key down or key up) and a timestamp.
typedef struct lse::CKeyboardBuffer::LSE_KEY_EVENT * lse::CKeyboardBuffer::LPLSE_KEY_EVENT [protected] |
Event information.
Key events.
Totals of various kinds.
LSVOID LSE_CALL lse::CKeyboardBuffer::OnKeyDown | ( | LSUINT32 | _ui32Key | ) |
Handle a key-down event.
_ui32Key | The key that was pressed. If greater than or equal to LSE_TK_TOTALKEYS, this function does nothing. |
LSVOID LSE_CALL lse::CKeyboardBuffer::OnKeyUp | ( | LSUINT32 | _ui32Key | ) |
Handle a key-up event.
_ui32Key | The key that was released. If greater than or equal to LSE_TK_TOTALKEYS, this function does nothing. |
LSVOID LSE_CALL lse::CKeyboardBuffer::UpdateKeyboard | ( | CKeyboard * | _pkKeyboard | ) |
Update a keyboard with our buffered information. Ensures that events are processed in order.
_pkKeyboard | The keyboard to update. |