ScummVM API documentation
Common::VirtualMouse Class Reference

#include <virtual-mouse.h>

Inheritance diagram for Common::VirtualMouse:
Common::EventSource Common::EventObserver

Public Member Functions

 VirtualMouse (EventDispatcher *eventDispatcher)
 
bool pollEvent (Event &event) override
 
bool notifyEvent (const Event &event) override
 
void addActionsToKeymap (Keymap *keymap)
 
- Public Member Functions inherited from Common::EventSource
virtual bool allowMapping () const
 
- Public Member Functions inherited from Common::EventObserver
virtual void notifyPoll ()
 

Detailed Description

The Virtual Mouse can produce mouse move events on systems without a physical mouse.

It is useful for moving the mouse cursor using a gamepad or a keyboard.

This class defines a keymap with actions for moving the cursor in all four directions. The keymapper produces custom backend events whenever keys bound to these actions are pressed. This class handles the events through its EventObserver interface and produces mouse move events when necesssary through its EventSource interface.

Member Function Documentation

◆ pollEvent()

bool Common::VirtualMouse::pollEvent ( Event event)
overridevirtual

Query an event from the source.

Parameters
eventReference to the event struct where the event should be stored.
Return values
trueIf an event was polled, false otherwise.

Implements Common::EventSource.

◆ notifyEvent()

bool Common::VirtualMouse::notifyEvent ( const Event event)
overridevirtual

Notify the observer of an incoming event.

An observer is supposed to 'eat' the event, with returning true, when it wants to prevent other observers from receiving the event. A usage example here is the keymapper: If it processes an Event, it should 'eat' it and create a new event, which the EventDispatcher will then catch.

Parameters
eventThe event that is incoming.
Return values
trueIf the event should not be passed to other observers, false otherwise.

Implements Common::EventObserver.

◆ addActionsToKeymap()

void Common::VirtualMouse::addActionsToKeymap ( Keymap keymap)

Add the virtual mouse keymapper actions to a keymap


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