xbmc
Public Member Functions | List of all members
KODI::GAME::CGameAgentManager Class Reference

Class to manage game-playing agents for a running game client. More...

#include <GameAgentManager.h>

Inheritance diagram for KODI::GAME::CGameAgentManager:
Inheritance graph
[legend]
Collaboration diagram for KODI::GAME::CGameAgentManager:
Collaboration graph
[legend]

Public Member Functions

 CGameAgentManager (PERIPHERALS::CPeripherals &peripheralManager, CInputManager &inputManager)
 
void Start (GameClientPtr gameClient)
 
void Stop ()
 
void Refresh ()
 
void Notify (const Observable &obs, const ObservableMessage msg) override
 Process a message from an observable. More...
 
bool OnKeyPress (const CKey &key) override
 A key has been pressed. More...
 
void OnKeyRelease (const CKey &key) override
 A key has been released. More...
 
bool OnPosition (int x, int y) override
 Handle mouse position updates. More...
 
bool OnButtonPress (MOUSE::BUTTON_ID button) override
 A mouse button has been pressed. More...
 
void OnButtonRelease (MOUSE::BUTTON_ID button) override
 A mouse button has been released. More...
 
- Public Member Functions inherited from Observable
virtual Observableoperator= (const Observable &observable)
 
virtual void RegisterObserver (Observer *obs)
 Register an observer. More...
 
virtual void UnregisterObserver (Observer *obs)
 Unregister an observer. More...
 
virtual void NotifyObservers (const ObservableMessage message=ObservableMessageNone)
 Send a message to all observers when m_bObservableChanged is true. More...
 
virtual void SetChanged (bool bSetTo=true)
 Mark an observable changed. More...
 
virtual bool IsObserving (const Observer &obs) const
 Check whether this observable is being observed by an observer. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Observable
void SendMessage (const ObservableMessage message)
 Send a message to all observer when m_bObservableChanged is true. More...
 
- Protected Attributes inherited from Observable
std::atomic< bool > m_bObservableChanged {false}
 
std::vector< Observer * > m_observers
 
CCriticalSection m_obsCritSection
 

Detailed Description

Class to manage game-playing agents for a running game client.

Currently, port mapping is controller-based and does not take into account the human belonging to the controller. In the future, humans and possibly bots will be managed here.

To map ports to controllers, a list of controllers is retrieved in ProcessJoysticks(). After expired controllers are removed, the port mapping occurs in the static function MapJoysticks(). The strategy is to simply sort controllers by heuristics and greedily assign to game ports.

Member Function Documentation

◆ Notify()

void CGameAgentManager::Notify ( const Observable obs,
const ObservableMessage  msg 
)
overridevirtual

Process a message from an observable.

Parameters
obsThe observable that sends the message.
msgThe message.

Implements Observer.

◆ OnButtonPress()

bool CGameAgentManager::OnButtonPress ( MOUSE::BUTTON_ID  button)
overridevirtual

A mouse button has been pressed.

Parameters
buttonThe index of the pressed button
Returns
True if the event was handled, otherwise false

Implements KODI::MOUSE::IMouseDriverHandler.

◆ OnButtonRelease()

void KODI::GAME::CGameAgentManager::OnButtonRelease ( MOUSE::BUTTON_ID  button)
inlineoverridevirtual

A mouse button has been released.

Parameters
buttonThe index of the released button

Implements KODI::MOUSE::IMouseDriverHandler.

◆ OnKeyPress()

bool CGameAgentManager::OnKeyPress ( const CKey key)
overridevirtual

A key has been pressed.

Parameters
keyThe pressed key
Returns
True if the event was handled, false otherwise

Implements KODI::KEYBOARD::IKeyboardDriverHandler.

◆ OnKeyRelease()

void KODI::GAME::CGameAgentManager::OnKeyRelease ( const CKey key)
inlineoverridevirtual

A key has been released.

Parameters
keyThe released key

Implements KODI::KEYBOARD::IKeyboardDriverHandler.

◆ OnPosition()

bool CGameAgentManager::OnPosition ( int  x,
int  y 
)
overridevirtual

Handle mouse position updates.

Parameters
xThe new x coordinate of the pointer
yThe new y coordinate of the pointer

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, false otherwise

Implements KODI::MOUSE::IMouseDriverHandler.


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