API Documentation
Public Member Functions | Static Public Member Functions | List of all members
nkInputs::KeyboardDevice Class Referenceabstract

A keyboard device. More...

Public Member Functions

 KeyboardDevice (System *system) noexcept
 
virtual ~KeyboardDevice ()
 
SystemgetSystem () const
 
virtual bool isKeyDown (KEY_CODE keyCode)=0
 
virtual void update ()=0
 

Static Public Member Functions

static nkMemory::UniquePtr< KeyboardDevicecreate (System *system=nullptr)
 

Detailed Description

A keyboard device.

The usual way to use the device is to create it, and update is before checking its state. Typical usage looks like :

device->update() ;

if (device->isKeyDown(...)) ...

Constructor & Destructor Documentation

◆ KeyboardDevice()

nkInputs::KeyboardDevice::KeyboardDevice ( System system)
noexcept

Constructor.

Parameters
systemThe system to create the device into.

◆ ~KeyboardDevice()

virtual nkInputs::KeyboardDevice::~KeyboardDevice ( )
virtual

Destructor.

Member Function Documentation

◆ getSystem()

System* nkInputs::KeyboardDevice::getSystem ( ) const
Returns
The system the device is in.

◆ isKeyDown()

virtual bool nkInputs::KeyboardDevice::isKeyDown ( KEY_CODE  keyCode)
pure virtual
Parameters
keyCodethe code of the key to check.
Returns
If the key wanted is down (true) or not (false).

◆ update()

virtual void nkInputs::KeyboardDevice::update ( )
pure virtual

Updates the device.

◆ create()

static nkMemory::UniquePtr<KeyboardDevice> nkInputs::KeyboardDevice::create ( System system = nullptr)
static

Creates a standalone device, linking it to a system, but no manager. This method can be used to allocate a device and manually manage its lifetime.

Parameters
systemThe system to create the device into. If left to nullptr, then the Singleton instance will be used.
Returns
The created device instance.

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