Xrb::FrameHandler Class Reference

Facilitates once-per-game-loop-frame computation. More...

#include <xrb_framehandler.hpp>

Inheritance diagram for Xrb::FrameHandler:

Inheritance graph
[legend]

List of all members.

Public Member Functions

 FrameHandler ()
 Constructor.
virtual ~FrameHandler ()
 Destructor.
Float MostRecentFrameTime () const
 Returns the time of the most recent frame.
Uint32 FrameCount () const
 Returns the accumulated frame count.
void SetSkipTime (bool const skip_time)
 This function will be deprecated soon.
void ProcessFrame (Float const time)
 Initiates once-per-game-loop-frame computation.

Protected Member Functions

Float FrameTime () const
 Returns the current frame time.
Float FrameDT () const
 Returns the time delta from the most recently processed frame.
virtual void HandleFrame ()=0
 Overridable method for the actual computation required by subclasses.


Detailed Description

Facilitates once-per-game-loop-frame computation.

Time-based computation can be done using a FrameHandler. The processing function is guaranteed to be called exactly once per game loop (as opposed to the non-guaranteed calls to Xrb::Widget::Draw for example). Various time metrics are provided for use inside the frame processing function.

Definition at line 26 of file xrb_framehandler.hpp.


Constructor & Destructor Documentation

Xrb::FrameHandler::FrameHandler (  ) 

Constructor.

The frame count starts at 0.

Definition at line 16 of file xrb_framehandler.cpp.

Xrb::FrameHandler::~FrameHandler (  )  [virtual]

Destructor.

Does nothing.

Definition at line 25 of file xrb_framehandler.cpp.


Member Function Documentation

Float Xrb::FrameHandler::MostRecentFrameTime (  )  const [inline]

Returns the time of the most recent frame.

Returns 0 if no frame has been processed yet.

Definition at line 42 of file xrb_framehandler.hpp.

References Xrb::Max().

Referenced by Xrb::ModalWidget::Shutdown().

Uint32 Xrb::FrameHandler::FrameCount (  )  const [inline]

Returns the accumulated frame count.

The frame count is incremented once per call to ProcessFrame.

Definition at line 46 of file xrb_framehandler.hpp.

void Xrb::FrameHandler::SetSkipTime ( bool const   skip_time  )  [inline]

This function will be deprecated soon.

Todo:
Deprecate this fucktion.

Definition at line 53 of file xrb_framehandler.hpp.

void Xrb::FrameHandler::ProcessFrame ( Float const   time  ) 

Initiates once-per-game-loop-frame computation.

Sets up the frame variables and then calls the overridden HandleFrame which is what actuall does the processing.

Definition at line 30 of file xrb_framehandler.cpp.

References HandleFrame().

Float Xrb::FrameHandler::FrameTime (  )  const [inline, protected]

Returns the current frame time.

Only valid inside HandleFrame -- use MostRecentFrameTime otherwise. If this method is called from outside of HandleFrame, it will assert.

Definition at line 68 of file xrb_framehandler.hpp.

Referenced by Xrb::KeyRepeater::HandleFrame(), and Xrb::EventQueue::HandleFrame().

Float Xrb::FrameHandler::FrameDT (  )  const [inline, protected]

Returns the time delta from the most recently processed frame.

Only valid inside HandleFrame. If this method is called from outside of HandleFrame, it will assert.

Definition at line 77 of file xrb_framehandler.hpp.

virtual void Xrb::FrameHandler::HandleFrame (  )  [protected, pure virtual]

Overridable method for the actual computation required by subclasses.

This is called by ProcessFrame after a bit of preparation. FrameTime and FrameDT can be used inside this method.

Implemented in Xrb::Widget, Xrb::KeyRepeater, and Xrb::EventQueue.

Referenced by ProcessFrame().


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

Hosted by SourceForge.net Logo -- Generated on Fri Aug 21 21:46:39 2009 for XuqRijBuh by doxygen 1.5.8