API Documentation
Public Member Functions | List of all members
nkInputs::System Class Referencefinal

Main interface with the component. More...

Inheritance diagram for nkInputs::System:

Public Member Functions

 System () noexcept
 
virtual ~System ()
 
bool isInitialized () const
 
InputSystemgetInputSystem () const
 
KeyboardDeviceManagergetKeyboardDeviceManager () const
 
LogManagergetLogManager () const
 
MouseDeviceManagergetMouseDeviceManager () const
 
bool initialize ()
 
void shutdown ()
 

Detailed Description

Main interface with the component.

Used to initialize and shut all of its sub parts. This system should be instanciated first before being able to use the component, either through an isolated instance, either through the singleton instance. Typical usage will be :

// One or another, depending on the need
nkInputs::System system ; // Or : nkInputs::System* system = nkInputs::System::getInstance() ;

// Register the logger to ensure we know about any problem
system.getLogManager()->setReceiver(logger) ;

// The system first needs to be initialized
if (!system.initialize()) {// Error during initialization, system not usable}

// Create the devices, either manually, either through the manager depending on lifetime management needs
std::unique_ptr<nkInputs::MouseDevice> mouse = nkInputs::MouseDevice::create(&system) ;
nkInputs::KeyboardDevice* keyboard = system.getKeyboardDeviceManager()->createOrRetrieve("MyKeyboard") ;

// Update the devices to check their current status when needed, for instance before computing a frame's data
mouse->update() ;
keyboard->update() ;

// Do what is needed with their updated status, like updating a camera, some interface...
...

Constructor & Destructor Documentation

◆ System()

nkInputs::System::System ( )
noexcept

Constructor.

◆ ~System()

virtual nkInputs::System::~System ( )
virtual

Destructor.

Member Function Documentation

◆ isInitialized()

bool nkInputs::System::isInitialized ( ) const
Returns
Whether the system is initialized (true) or not (false).

◆ getInputSystem()

InputSystem* nkInputs::System::getInputSystem ( ) const
Returns
The input system.

◆ getKeyboardDeviceManager()

KeyboardDeviceManager* nkInputs::System::getKeyboardDeviceManager ( ) const
Returns
The keyboard device manager linked to the system.
Remarks
If the system is the singleton instance, then the manager will also be the singleton instance. In other words, it would be accessible through the getInstance() method too.

◆ getLogManager()

LogManager* nkInputs::System::getLogManager ( ) const
Returns
The log manager linked to the system.
Remarks
If the system is the singleton instance, then the manager will also be the singleton instance. In other words, it would be accessible through the getInstance() method too.

◆ getMouseDeviceManager()

MouseDeviceManager* nkInputs::System::getMouseDeviceManager ( ) const
Returns
The mouse device manager linked to the system.
Remarks
If the system is the singleton instance, then the manager will also be the singleton instance. In other words, it would be accessible through the getInstance() method too.

◆ initialize()

bool nkInputs::System::initialize ( )

Initializes the component and all of its sub part. This implies launching the input system and back end.

Returns
If the initialization was a success (true) or not (false).

◆ shutdown()

void nkInputs::System::shutdown ( )

Shuts down the component. This frees all memory linked to it and ensure a clean exit. Calling this method manually allows to control the operation's timing, but is called if necessary during the system destruction.


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