Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
KODI::GAME::CGameClientMouse Class Reference

Handles mouse events for games. More...

#include <GameClientMouse.h>

Inheritance diagram for KODI::GAME::CGameClientMouse:
KODI::MOUSE::IMouseInputHandler

Public Member Functions

 CGameClientMouse (CGameClient &gameClient, std::string controllerId, MOUSE::IMouseInputProvider *inputProvider)
 Constructor registers for mouse events at CInputManager.
 
 ~CGameClientMouse () override
 Destructor unregisters from mouse events from CInputManager.
 
std::string ControllerID () const override
 The controller profile for this mouse input handler.
 
bool OnMotion (const std::string &relpointer, int dx, int dy) override
 A relative pointer has moved.
 
bool OnButtonPress (const std::string &button) override
 A mouse button has been pressed.
 
void OnButtonRelease (const std::string &button) override
 A mouse button has been released.
 
void OnInputFrame () override
 Called at the end of the frame that provided input.
 
const std::string & GetControllerID () const
 
const PERIPHERALS::PeripheralPtrGetSource () const
 
float GetActivation () const
 
void SetSource (PERIPHERALS::PeripheralPtr sourcePeripheral)
 
void ClearSource ()
 
- Public Member Functions inherited from KODI::MOUSE::IMouseInputHandler
virtual ~IMouseInputHandler (void)=default
 

Detailed Description

Handles mouse events for games.

Listens to mouse events and forwards them to the games (as game_input_event).

Constructor & Destructor Documentation

◆ CGameClientMouse()

CGameClientMouse::CGameClientMouse ( CGameClient & gameClient,
std::string controllerId,
MOUSE::IMouseInputProvider * inputProvider )

Constructor registers for mouse events at CInputManager.

Parameters
gameClientThe game client implementation.
controllerIdThe controller profile used for input
dllStructThe emulator or game to which the events are sent.
inputProviderThe interface providing us with mouse input.

◆ ~CGameClientMouse()

CGameClientMouse::~CGameClientMouse ( )
override

Destructor unregisters from mouse events from CInputManager.

Member Function Documentation

◆ ClearSource()

void CGameClientMouse::ClearSource ( )

◆ ControllerID()

std::string CGameClientMouse::ControllerID ( ) const
overridevirtual

The controller profile for this mouse input handler.

Returns
The ID of the add-on extending kodi.game.controller

Implements KODI::MOUSE::IMouseInputHandler.

◆ GetActivation()

float CGameClientMouse::GetActivation ( ) const

◆ GetControllerID()

const std::string & KODI::GAME::CGameClientMouse::GetControllerID ( ) const
inline

◆ GetSource()

const PERIPHERALS::PeripheralPtr & KODI::GAME::CGameClientMouse::GetSource ( ) const
inline

◆ OnButtonPress()

bool CGameClientMouse::OnButtonPress ( const std::string & button)
overridevirtual

A mouse button has been pressed.

Parameters
buttonThe name of the feature being pressed
Returns
True if the event was handled, otherwise false

Implements KODI::MOUSE::IMouseInputHandler.

◆ OnButtonRelease()

void CGameClientMouse::OnButtonRelease ( const std::string & button)
overridevirtual

A mouse button has been released.

Parameters
buttonThe name of the feature being released

Implements KODI::MOUSE::IMouseInputHandler.

◆ OnInputFrame()

void CGameClientMouse::OnInputFrame ( )
overridevirtual

Called at the end of the frame that provided input.

This can be as a result of a pointer update, a button press, or a button release. All three events will result in a call to OnInputFrame().

Implements KODI::MOUSE::IMouseInputHandler.

◆ OnMotion()

bool CGameClientMouse::OnMotion ( const std::string & relpointer,
int dx,
int dy )
overridevirtual

A relative pointer has moved.

Parameters
relpointerThe name of the relative pointer being moved
dxThe relative x coordinate of motion
dyThe relative y coordinate of motion

The mouse uses a left-handed (graphics) cartesian coordinate system. Positive X is right, positive Y is down.

Returns
True if the event was handled, otherwise false
Todo
Allow mouse motion to activate controller This will follow a larger refactoring of the mouse input system

Implements KODI::MOUSE::IMouseInputHandler.

◆ SetSource()

void CGameClientMouse::SetSource ( PERIPHERALS::PeripheralPtr sourcePeripheral)

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