Avionics
Dropship Simulator
Devices::Keyboard Class Reference

#include <Keyboard.h>

Collaboration diagram for Devices::Keyboard:
[legend]

Public Member Functions

void FrameMove (float fElapsed)
 
void Initialize (Logger *logger, KeyboardConfig *config, Bus *prmBus, LPDIRECTINPUT8 g_pDI)
 
void SetWindowHandles (std::vector< HWND > prmHwnds)
 
void Destroy ()
 

Private Member Functions

void BufferProc (bool bEnterKey)
 

Static Private Member Functions

static BOOL CALLBACK EnumKeyboardsCallback (const DIDEVICEINSTANCE *pdidInstance, VOID *pContext)
 
static void SetNumLock (bool bState)
 

Private Attributes

LPDIRECTINPUTDEVICE8 g_pKeyboard = nullptr
 
HKL hkl = nullptr
 
unsigned char keyboardState [256]
 contains state of keyboard More...
 
unsigned char oldKeyboardState [256]
 contains previous state of keyboard More...
 
Loggerlogger = nullptr
 
Busbus = nullptr
 
KeyboardConfigkeyboardConfig = nullptr
 
float timeSinceLastKeypress = 0.0f
 
char buffer [10]
 
bool shift = false
 
bool ctrl = false
 
bool alt = false
 
std::vector< HWND > hwnds
 

Detailed Description

Definition at line 40 of file Keyboard.h.

Member Function Documentation

◆ BufferProc()

void Devices::Keyboard::BufferProc ( bool  bEnterKey)
private

Definition at line 7 of file Keyboard.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Destroy()

void Devices::Keyboard::Destroy ( )

Definition at line 320 of file Keyboard.cpp.

Here is the caller graph for this function:

◆ EnumKeyboardsCallback()

BOOL CALLBACK Devices::Keyboard::EnumKeyboardsCallback ( const DIDEVICEINSTANCE *  pdidInstance,
VOID *  pContext 
)
staticprivate

Definition at line 302 of file Keyboard.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FrameMove()

void Devices::Keyboard::FrameMove ( float  fElapsed)

iterate through the non-buffer key types first (by scan code)

would it be easiest if the keyboard mapping was elsewhere? can't do VK_UP because we don't know then which part of the keyboard it came from... probably just fine because we are here only to add keys to the buffer which should be legible string data

this really only works on the main keyboard but keeps me from mapping a bunch of keys manually

if we are still here then we have not handled the key

Definition at line 84 of file Keyboard.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Initialize()

void Devices::Keyboard::Initialize ( Logger logger,
KeyboardConfig config,
Bus prmBus,
LPDIRECTINPUT8  g_pDI 
)

Definition at line 19 of file Keyboard.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetNumLock()

void Devices::Keyboard::SetNumLock ( bool  bState)
staticprivate

Definition at line 284 of file Keyboard.cpp.

Here is the caller graph for this function:

◆ SetWindowHandles()

void Devices::Keyboard::SetWindowHandles ( std::vector< HWND >  prmHwnds)
inline

Definition at line 75 of file Keyboard.h.

Here is the caller graph for this function:

Member Data Documentation

◆ alt

bool Devices::Keyboard::alt = false
private

Definition at line 66 of file Keyboard.h.

◆ buffer

char Devices::Keyboard::buffer[10]
private

Definition at line 62 of file Keyboard.h.

◆ bus

Bus* Devices::Keyboard::bus = nullptr
private

Definition at line 58 of file Keyboard.h.

◆ ctrl

bool Devices::Keyboard::ctrl = false
private

Definition at line 65 of file Keyboard.h.

◆ g_pKeyboard

LPDIRECTINPUTDEVICE8 Devices::Keyboard::g_pKeyboard = nullptr
private

Definition at line 43 of file Keyboard.h.

◆ hkl

HKL Devices::Keyboard::hkl = nullptr
private

Definition at line 48 of file Keyboard.h.

◆ hwnds

std::vector<HWND> Devices::Keyboard::hwnds
private

Definition at line 68 of file Keyboard.h.

◆ keyboardConfig

KeyboardConfig* Devices::Keyboard::keyboardConfig = nullptr
private

Definition at line 59 of file Keyboard.h.

◆ keyboardState

unsigned char Devices::Keyboard::keyboardState[256]
private

contains state of keyboard

Definition at line 50 of file Keyboard.h.

◆ logger

Logger* Devices::Keyboard::logger = nullptr
private

Definition at line 57 of file Keyboard.h.

◆ oldKeyboardState

unsigned char Devices::Keyboard::oldKeyboardState[256]
private

contains previous state of keyboard

Definition at line 52 of file Keyboard.h.

◆ shift

bool Devices::Keyboard::shift = false
private

Definition at line 64 of file Keyboard.h.

◆ timeSinceLastKeypress

float Devices::Keyboard::timeSinceLastKeypress = 0.0f
private

Definition at line 61 of file Keyboard.h.


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