This is the GUI playback input media, which records user-input for later playback. More...
#include <GUIPlaybackInput.h>
Public Member Functions | |
virtual eC_Bool | GetMulitpleTouches () const |
virtual void | GetOffset (eC_Int &riOffsetX, eC_Int &riOffsetY) const |
virtual void | GetSize (eC_Int &riSizeX, eC_Int &riSizeY) const |
virtual void | PollEvent () |
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) |
![]() | |
void | AddEvent (CGUIEvent *pkEvent) |
eC_Bool | GetDebugMode () const |
CGUIEvent * | GetEvent (eC_UInt uiIdleTime) |
eC_UInt | GetMaxEventThreshold () const |
eC_UInt | GetMinEventThreshold () const |
virtual eC_Bool | GetMulitpleTouches () const |
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 |
virtual void | PollEvent () |
CGUIEvent * | RetrieveEvent () |
void | SetDebugMode (const eC_Bool &bDebugMode) |
void | SetMaxEventThreshold (const eC_UInt &uiMaxEventThreshold) |
void | SetMinEventThreshold (const eC_UInt &uiMinEventThreshold) |
virtual void | SetMultipleTouches (const eC_Bool &bMultipleTouches) |
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 void | DeleteInstance () |
Protected Member Functions | |
CGUIPlaybackInput (const eC_Bool bAutomaticMode, const eC_String &kEventRecordFilename) | |
![]() | |
CGUIInputMedia (const eC_Bool &bQueuedEvents=false, const AcquisitionType_t &eType=Polling) | |
virtual | ~CGUIInputMedia () |
Additional Inherited Members | |
![]() | |
enum | AcquisitionType_t { Polling , Callback } |
how events are collected | |
enum | Rotation_t { ROTATION_0 , ROTATION_90 , ROTATION_180 , ROTATION_270 } |
rotation of input-device | |
![]() | |
eC_Bool | m_bDebugMode |
debug-mode for input-device | |
eC_Bool | m_bMultipleTouches |
supports multiple touches | |
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_uiIdleTime |
maximum time to spend | |
eC_UInt | m_uiSleepInterval |
sleep interval | |
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.
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:
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.
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:
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.
|
protected |
Constructor
bAutomaticMode | True for automatic mode |
kEventRecordFilename | The file name of the record |
|
static |
Singleton for creating a Playback Input Media.
bAutomaticMode | When 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. |
kEventRecordFilename | Filename from which previously recorded events will be loaded. (And to which they will be saved in case you are recording) |
|
static |
Delete the instance
|
virtual |
get if multiple touches supported
Reimplemented from CGUIInputMedia.
|
virtual |
get the offset of the input-device
riOffsetX | x-offset |
riOffsetY | y-offset |
Reimplemented from CGUIInputMedia.
|
virtual |
get the size of the input-device
riSizeX | width |
riSizeY | height |
Reimplemented from CGUIInputMedia.
|
virtual |
Poll for 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
Reimplemented from CGUIInputMedia.
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().
kEventRecordFilename | Name of file containing recorded events. |
|
virtual |
set the offset for the input-device
iOffsetX | x-offset |
iOffsetY | y-offset |
Reimplemented from CGUIInputMedia.
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
vPlaybackSpeed | speed |
|
virtual |
set the size for the input-device if negative values are used the axis is inverted
iSizeX | width |
iSizeY | height |
Reimplemented from CGUIInputMedia.
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().
bLoop | set to true if playback should be looped until stopped. |
bIgnoreUserInput | if 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. |
|
virtual |
Forwards the StopIdle call to the actual input media.
Reimplemented from CGUIInputMedia.
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.
bStopPlaybackOnUserInput | If true, then any ongoing playback will be stopped immediately after receiving an event from the actual input media. |
void CGUIPlaybackInput::StopRecording | ( | const eC_Bool & | bKeyboardUsed = false | ) |
Stops recording events and writes them to the file.
bKeyboardUsed | indicates 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. |