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

A mouse device. More...

Public Member Functions

 MouseDevice (System *system) noexcept
 
virtual ~MouseDevice ()
 
SystemgetSystem () const
 
virtual int getX () const =0
 
virtual int getY () const =0
 
virtual long getLastXMovement () const =0
 
virtual long getLastYMovement () const =0
 
virtual long getLastZMovement () const =0
 
virtual bool getLeftButton () const =0
 
virtual bool getRightButton () const =0
 
virtual bool getCenterButton () const =0
 
virtual void update ()=0
 

Static Public Member Functions

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

Detailed Description

A mouse 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() ;

float xOffset = f * device->getLastXMovement() ;
...

Constructor & Destructor Documentation

◆ MouseDevice()

nkInputs::MouseDevice::MouseDevice ( System system)
noexcept

Constructor.

Parameters
systemThe system to create the device into.

◆ ~MouseDevice()

virtual nkInputs::MouseDevice::~MouseDevice ( )
virtual

Destructor.

Member Function Documentation

◆ getSystem()

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

◆ getX()

virtual int nkInputs::MouseDevice::getX ( ) const
pure virtual
Returns
Current x coordinate on screen.

◆ getY()

virtual int nkInputs::MouseDevice::getY ( ) const
pure virtual
Returns
Current y coordinate on screen.

◆ getLastXMovement()

virtual long nkInputs::MouseDevice::getLastXMovement ( ) const
pure virtual
Returns
The last delta on the x axis.

◆ getLastYMovement()

virtual long nkInputs::MouseDevice::getLastYMovement ( ) const
pure virtual
Returns
The last delta on the y axis.

◆ getLastZMovement()

virtual long nkInputs::MouseDevice::getLastZMovement ( ) const
pure virtual
Returns
The last delta on the z axis (wheel).

◆ getLeftButton()

virtual bool nkInputs::MouseDevice::getLeftButton ( ) const
pure virtual
Returns
Whether the left button is down (true) or not (false).

◆ getRightButton()

virtual bool nkInputs::MouseDevice::getRightButton ( ) const
pure virtual
Returns
Whether the right button is down (true) or not (false).

◆ getCenterButton()

virtual bool nkInputs::MouseDevice::getCenterButton ( ) const
pure virtual
Returns
Whether the center button or wheel is down (true) or not (false).

◆ update()

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

Updates the device's internal tracking memory.

◆ create()

static nkMemory::UniquePtr<MouseDevice> nkInputs::MouseDevice::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: