Guiliani  Version 2.5 revision 7293 (documentation build 13)
CGUIPlaybackInput Class Reference

This is the GUI playback input media, which records user-input for later playback. More...

#include <GUIPlaybackInput.h>

Inheritance diagram for CGUIPlaybackInput:

Public Member Functions

virtual CGUIEventGetEvent (eC_UInt uiIdleTime)
 
virtual void GetOffset (eC_Int &riOffsetX, eC_Int &riOffsetY) const
 
virtual void GetSize (eC_Int &riSizeX, eC_Int &riSizeY) const
 
void SetEventRecordFilename (const eC_String &kEventRecordFilename)
 
virtual void SetOffset (const eC_Int &iOffsetX, const eC_Int &iOffsetY)
 
void SetPlaybackSpeed (const eC_Value &vPlaybackSpeed)
 
virtual void SetSize (const eC_Int &iSizeX, const eC_Int &iSizeY)
 
void StartPlayback (const eC_Bool &bLoop=false, const eC_Bool &bIgnoreUserInput=false)
 
void StartRecording ()
 Starts recording events from the actual input media.
 
virtual void StopIdle ()
 Forwards the StopIdle call to the actual input media. More...
 
void StopPlayback ()
 Stops any ongoing playback.
 
void StopPlaybackOnUserInput (const eC_Bool bStopPlaybackOnUserInput)
 
void StopRecording (const eC_Bool &bKeyboardUsed=false)
 
- Public Member Functions inherited from CGUIInputMedia
eC_Bool GetDebugMode () const
 
virtual CGUIEventGetEvent (eC_UInt uiIdleTime)=0
 
virtual void GetOffset (eC_Int &riOffsetX, eC_Int &riOffsetY) const
 
Rotation_t GetRotation () const
 
virtual void GetSize (eC_Int &riSizeX, eC_Int &riSizeY) const
 
eC_UInt GetSleepInterval () const
 
void SetDebugMode (const eC_Bool &bDebugMode)
 
virtual void SetOffset (const eC_Int &iOffsetX, const eC_Int &iOffsetY)
 
void SetRotation (const Rotation_t &eRotation)
 
virtual void SetSize (const eC_Int &iSizeX, const eC_Int &iSizeY)
 
void SetSleepInterval (const eC_UInt &uiInterval)
 
virtual void StopIdle ()
 

Static Public Member Functions

static void CreateInstance (const eC_Bool bAutomaticMode=true, const eC_String &kEventRecordFilename="EventRecord.dat")
 
static void DeleteInstance ()
 
- Static Public Member Functions inherited from CGUIInputMedia
static void DeleteInstance ()
 

Protected Member Functions

 CGUIPlaybackInput (const eC_Bool bAutomaticMode, const eC_String &kEventRecordFilename)
 
- Protected Member Functions inherited from CGUIInputMedia
 CGUIInputMedia ()
 
virtual ~CGUIInputMedia ()
 

Additional Inherited Members

- Public Types inherited from CGUIInputMedia
enum  Rotation_t { ROTATION_0 , ROTATION_90 , ROTATION_180 , ROTATION_270 }
 rotation of input-device
 
- Protected Attributes inherited from CGUIInputMedia
eC_Bool m_bDebugMode
 debug-mode for input-device
 
eC_Bool m_bStopIdle
 stop idle when waiting for events
 
Rotation_t m_eRotation
 current rotation used for input-device
 
eC_Int m_iOffsetX
 x-offset
 
eC_Int m_iOffsetY
 y-offset
 
eC_Int m_iSizeX
 width
 
eC_Int m_iSizeY
 height
 
eC_UInt m_uiSleepInterval
 sleep interval
 

Detailed Description

This is the GUI playback input media, which records user-input for later playback.

The "playback" module is used as a recorder for all mouse and keyboard events. GUI events can be recorded to a file and can be played back again like an old tape deck (Class: CGUIPlaybackInput).

It is designed to record mouse-input or keyboard-input, and playback the recorded events at a later time, for example for displaying self-running demos on a fair.

Using CGUIPlaybackInput in automatic mode

The easiest way to use this class as follows: 1. Create an instance of your "normal" Input media as always. 2. Create an instance of GUIPlaybackInput

Example:

static void CreateInstance(const HWND &hWnd, const eC_Bool &bEmulateTouchScreen=false)
static void CreateInstance(const eC_Bool bAutomaticMode=true, const eC_String &kEventRecordFilename="EventRecord.dat")

The playbackinput will then intercept all events returned by the actual input media and when the program is shut down, it will write the logged events into a file called "EventRecord.dat" (unless you specify another name).

PLAYBACK MODE: At startup CGUIPlaybackInput search for this file. If it is found, the PlaybackInputMedia will read the events and automatically shoot them into the application in the correct time-order.

RECORD MODE: If the PlaybackInputMedia does NOT find the "EventRecord.dat" file, it will automatically enter Record mode, and log all events to such a file during shutdown.

Using CGUIPlaybackInput in manual mode

If you require more control over the behaviour of CGUIPlaybackInput, you may wish to use it in manual mode. In this case you need to start Playback / Recording of events explicitly via the interfaces StartPlayback(), StopPlayback(), StartRecording() and StopRecording()

Example:

CGUIPlaybackInput::CreateInstance(false, "other_resources/EventRecord.dat");
// Somewhere within the application's code...
static_cast<CGUIPlaybackInput&>(GETINPUTMEDIA).StartPlayback();
static_cast<CGUIPlaybackInput&>(GETINPUTMEDIA).StopPlayback();
This is the GUI playback input media, which records user-input for later playback.
Definition: GUIPlaybackInput.h:83
void StopPlayback()
Stops any ongoing playback.
void StartPlayback(const eC_Bool &bLoop=false, const eC_Bool &bIgnoreUserInput=false)

ATTENTION: If you record the events in PC, write them in file and want to simulate in a target, you should always check whether the size of the type in the target is same as in PC.

Constructor & Destructor Documentation

◆ CGUIPlaybackInput()

CGUIPlaybackInput::CGUIPlaybackInput ( const eC_Bool  bAutomaticMode,
const eC_String &  kEventRecordFilename 
)
protected

Constructor

Parameters
bAutomaticModeTrue for automatic mode
kEventRecordFilenameThe file name of the record

Member Function Documentation

◆ CreateInstance()

static void CGUIPlaybackInput::CreateInstance ( const eC_Bool  bAutomaticMode = true,
const eC_String &  kEventRecordFilename = "EventRecord.dat" 
)
static

Singleton for creating a Playback Input Media.

Parameters
bAutomaticModeWhen set to TRUE CGUIPlaybackInput will automatically search for an existing "EventRecord.dat" (or your supplied name) at Startup and enter playback mode if it was found. When set to FALSE you must manually start/end record and playback using the StartPlayback(), StopPlayback(), StartRecording() and StopRecording() APIs.
kEventRecordFilenameFilename from which previously recorded events will be loaded. (And to which they will be saved in case you are recording)

◆ DeleteInstance()

static void CGUIPlaybackInput::DeleteInstance ( )
static

Delete the instance

◆ GetEvent()

virtual CGUIEvent * CGUIPlaybackInput::GetEvent ( eC_UInt  uiIdleTime)
virtual

Gets an event from the actual input media OR the internal list of recorded events, depending on whether the PlaybackInputMedia is in record or playback mode

Parameters
uiIdleTimeThe idle time
Returns
The event from the queue

Implements CGUIInputMedia.

◆ GetOffset()

virtual void CGUIPlaybackInput::GetOffset ( eC_Int &  riOffsetX,
eC_Int &  riOffsetY 
) const
virtual

get the offset of the input-device

Parameters
riOffsetXx-offset
riOffsetYy-offset

Reimplemented from CGUIInputMedia.

◆ GetSize()

virtual void CGUIPlaybackInput::GetSize ( eC_Int &  riSizeX,
eC_Int &  riSizeY 
) const
virtual

get the size of the input-device

Parameters
riSizeXwidth
riSizeYheight

Reimplemented from CGUIInputMedia.

◆ SetEventRecordFilename()

void CGUIPlaybackInput::SetEventRecordFilename ( const eC_String &  kEventRecordFilename)

Sets the name of the file containing previously recorded events. This file will be used for successive calls to StartPlayback().

Parameters
kEventRecordFilenameName of file containing recorded events.

◆ SetOffset()

virtual void CGUIPlaybackInput::SetOffset ( const eC_Int &  iOffsetX,
const eC_Int &  iOffsetY 
)
virtual

set the offset for the input-device

Parameters
iOffsetXx-offset
iOffsetYy-offset

Reimplemented from CGUIInputMedia.

◆ SetPlaybackSpeed()

void CGUIPlaybackInput::SetPlaybackSpeed ( const eC_Value &  vPlaybackSpeed)

Sets the speed for playback. Values below 1.0 will decrease the speed, while values above 1.0 will increase the speed

Parameters
vPlaybackSpeedspeed

◆ SetSize()

virtual void CGUIPlaybackInput::SetSize ( const eC_Int &  iSizeX,
const eC_Int &  iSizeY 
)
virtual

set the size for the input-device

Parameters
iSizeXwidth
iSizeYheight

Reimplemented from CGUIInputMedia.

◆ StartPlayback()

void CGUIPlaybackInput::StartPlayback ( const eC_Bool &  bLoop = false,
const eC_Bool &  bIgnoreUserInput = false 
)

Tries to load a file with previously recorded events and commences playback if successful. The filename can be given during construction or via SetEventRecordFilename().

Parameters
bLoopset to true if playback should be looped until stopped.
bIgnoreUserInputif true the user input is ignored Caution: when using playback with ignore user input, the application will not react to any user input until it is restarted.

◆ StopIdle()

virtual void CGUIPlaybackInput::StopIdle ( )
virtual

Forwards the StopIdle call to the actual input media.

Reimplemented from CGUIInputMedia.

◆ StopPlaybackOnUserInput()

void CGUIPlaybackInput::StopPlaybackOnUserInput ( const eC_Bool  bStopPlaybackOnUserInput)

Specifies whether a running playback will immediately be stopped when there is an event received from the actual input media. Note that this will only take effect 1 second after starting a playback, in order to give the user a chance to e.g. start playback by clicking on a button, without accidentally stopping the playback immediately again. By default, StopPlaybackOnUserInput is set to true.

Parameters
bStopPlaybackOnUserInputIf true, then any ongoing playback will be stopped immediately after receiving an event from the actual input media.

◆ StopRecording()

void CGUIPlaybackInput::StopRecording ( const eC_Bool &  bKeyboardUsed = false)

Stops recording events and writes them to the file.

See also
SetEventRecordFilename
Parameters
bKeyboardUsedindicates that a keyboard was used to trigger recording. the first recorded event will be the KEY_UP for the key used to start the recording and the last recorded event will be the key down of the key used to stop the recording. If this is true these two events will be erased.

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