proland::EventRecorder Class Reference
[ui]

An EventHandler that can record and replay events, and save a video during replay. More...

#include <EventRecorder.h>

List of all members.

Classes

struct  Event
 A recorded event. More...

Public Member Functions

 EventRecorder (const char *eventFile, bool autoSave, const char *frames, ptr< Program > cursorProg, ptr< Texture2D > cursor, ptr< EventHandler > next)
 Creates a new EventRecorder.
virtual ~EventRecorder ()
 Deletes this EventRecorder.

Protected Member Functions

 EventRecorder ()
 Creates an uninitialized EventRecorder.
void init (const char *eventFile, bool autoSave, const char *frames, ptr< Program > cursorProg, ptr< Texture2D > cursor, ptr< EventHandler > next)
 Initializes this EventRecorder.
virtual RecordablegetRecorded ()=0
 Returns the used to save/restore the framerate and the scene state.

Protected Attributes

Recordabler
 The object used to save/restore the framerate and the scene state.

Private Member Functions

void saveFrame (char *tga)
 Saves the framebuffer content to the given TGA file.
void saveEvents ()
 Saves the recorded events to a temporary file if autoSave is true.

Private Attributes

const char * eventFile
 The name of a file containing stored events to be replayed, or NULL.
bool autoSave
 True to save events in a temporary file at each mouse click and key typed event (useful for saving events if scenario leads to a crash).
const char * frames
 The file name format to be used to save the video frames.
int cursW
 The width of the cursor texture cursor.
int cursH
 The height of the cursor texture cursor.
ptr< Program > cursorProg
 The GLSL program used to draw the cursor on replaying videos.
ptr< Texture2D > cursor
 The cursor RGBA texture pixels.
ptr< UniformSampler > cursorSamplerU
 The cursor texture sampler.
ptr< Uniform4f > rescaleU
 Rescaling factor used to draw the cursor on the screen.
ptr< Uniform3f > correctU
 Rescaling factor used to draw the cursor on the screen.
bool isRecording
 True if this EventHandler is currently recording events.
bool isPlaying
 True if this EventHandler is currently replaying events.
bool saveVideo
 True if a video must be saved during replaying.
int lastSavedEvent
 The index of the recorded event corresponding to the last saved video frame.
int lastSavedFrame
 The index of the last saved video frame.
int savedX
 The x cursor position of the last replayed mouse event.
int savedY
 The x cursor position of the last replayed mouse event.
unsigned int lastPlayed
 The index of the last replayed event.
vector< EventrecordedEvents
 The recorded events.
ptr< EventHandler > next
 The EventHandler that must handle the events recorded and replayed by this EventRecorder.

Detailed Description

An EventHandler that can record and replay events, and save a video during replay.

Recording is started and stopped with F12. Replay is triggered with F11, or SHIFT+F11 to record a video while replaying. The recorded video does not contain all the original frames, but only 25 frames per second. Since replay cannot be done at the same rate as the original events, especially when saving a video, the events are recorded together with the time at which they originally occured, to be able to override the real-time during replay with the original time during recording. Also if modifications have been performed to the scene during the recording, the initial scene state must be restored before replaying the event. This is managed by a Recordable, that is used by this EventRecorder.


Constructor & Destructor Documentation

proland::EventRecorder::EventRecorder ( const char *  eventFile,
bool  autoSave,
const char *  frames,
ptr< Program >  cursorProg,
ptr< Texture2D >  cursor,
ptr< EventHandler >  next 
)

Creates a new EventRecorder.

Parameters:
eventFile the name of a file containing stored events to be replayed, or NULL.
autoSave true to save events in a temporary file at each mouse click and key typed event (useful for saving events if scenario leads to a crash).
frames the file name format to be used to save the video frames. For instance "video/frame-%d.tga" or "video/frame-%.4d.tga".
cursorProg the GLSL program used to draw the cursor on the screen.
cursor a cursor texture to display the cursor position during replay.
next the EventHandler that must handle the events recorded and replayed by this EventRecorder.
virtual proland::EventRecorder::~EventRecorder (  )  [virtual]

Deletes this EventRecorder.

proland::EventRecorder::EventRecorder (  )  [protected]

Creates an uninitialized EventRecorder.


Member Function Documentation

virtual Recordable* proland::EventRecorder::getRecorded (  )  [protected, pure virtual]

Returns the used to save/restore the framerate and the scene state.

void proland::EventRecorder::init ( const char *  eventFile,
bool  autoSave,
const char *  frames,
ptr< Program >  cursorProg,
ptr< Texture2D >  cursor,
ptr< EventHandler >  next 
) [protected]

Initializes this EventRecorder.

See EventRecorder.

void proland::EventRecorder::saveEvents (  )  [private]

Saves the recorded events to a temporary file if autoSave is true.

void proland::EventRecorder::saveFrame ( char *  tga  )  [private]

Saves the framebuffer content to the given TGA file.

Parameters:
tga a TGA file name.

Member Data Documentation

True to save events in a temporary file at each mouse click and key typed event (useful for saving events if scenario leads to a crash).

ptr<Uniform3f> proland::EventRecorder::correctU [private]

Rescaling factor used to draw the cursor on the screen.

The height of the cursor texture cursor.

ptr<Texture2D> proland::EventRecorder::cursor [private]

The cursor RGBA texture pixels.

ptr<Program> proland::EventRecorder::cursorProg [private]

The GLSL program used to draw the cursor on replaying videos.

ptr<UniformSampler> proland::EventRecorder::cursorSamplerU [private]

The cursor texture sampler.

The width of the cursor texture cursor.

const char* proland::EventRecorder::eventFile [private]

The name of a file containing stored events to be replayed, or NULL.

const char* proland::EventRecorder::frames [private]

The file name format to be used to save the video frames.

True if this EventHandler is currently replaying events.

True if this EventHandler is currently recording events.

unsigned int proland::EventRecorder::lastPlayed [private]

The index of the last replayed event.

The index of the recorded event corresponding to the last saved video frame.

The index of the last saved video frame.

ptr<EventHandler> proland::EventRecorder::next [private]

The EventHandler that must handle the events recorded and replayed by this EventRecorder.

The object used to save/restore the framerate and the scene state.

The recorded events.

ptr<Uniform4f> proland::EventRecorder::rescaleU [private]

Rescaling factor used to draw the cursor on the screen.

The x cursor position of the last replayed mouse event.

The x cursor position of the last replayed mouse event.

True if a video must be saved during replaying.


Generated on Sat May 12 09:41:39 2012 for proland by  doxygen 1.6.1