Om  1.0.0
A universal framework for multimedia simulation
Classes | Public Member Functions | Protected Member Functions | List of all members
om::engine::SimpleDemo Class Reference

A simple demo application with a single window, basic key/mouse input, and drawing. More...

#include <omSimpleDemo.h>

Classes

class  Delegate
 A class that represents a set of delegate methods for demo event handling. More...
 

Public Member Functions

 SimpleDemo ()
 Create a new simple demo with the name "Simple Demo" and window size 1024x768. More...
 
 SimpleDemo (const UTF8String &newName, const Size2D &newWindowSize)
 Create a new simple demo with the specified name and window size. More...
 
virtual ~SimpleDemo ()
 
virtual void run ()
 Run this demo. More...
 
void stop ()
 Stop running this demo. More...
 
Bool getIsRunning () const
 Return whether or not the demo is currently running. More...
 
void setIsRunning (Bool newIsRunning)
 Set whether or not the demo should be running. More...
 
Bool getIsPaused () const
 Return whether or not the demo is currently paused. More...
 
void setIsPaused (Bool newIsPaused)
 Set whether or not the demo should be paused. More...
 
Bool getIsFullscreen () const
 Return whether or not the demo is currently fullscreen. More...
 
void setIsFullscreen (Bool newIsFullscreen)
 Set whether or not the demo should be fullscreen. More...
 
const TimegetTargetDt () const
 Return the frame time that the demo attempts to execute at (but not faster than). More...
 
void setTargetDt (const Time &newTargetDt)
 Set the frame time that the demo attempts to execute at (but not faster than). More...
 
const Shared< GraphicsContext > & getContext () const
 Return a pointer to the graphics context which this simple demo is using. More...
 
ResourceManager & getResourceManager ()
 Return a reference to the resource manager which this simple demo is using. More...
 
const ResourceManager & getResourceManager () const
 Return a reference to the resource manager which this simple demo is using. More...
 
const KeyboardgetKeyboard () const
 Return a reference to the keyboard state for this demo. More...
 
Size getDelegateCount () const
 Return the total number of delegate objects that are responding to events for this demo. More...
 
const DelegategetDelegate (Index delegateIndex) const
 Return a pointer to the delegate at the specified index. More...
 
DelegategetDelegate (Index delegateIndex)
 Return a pointer to the delegate at the specified index. More...
 
Index addDelegate (const Delegate &newDelegate)
 Add a new delegate to this demo. More...
 
void clearDelegates ()
 Remove all delegates from this simple demo. More...
 
base::EngineContextgetEngine ()
 Return a reference to the engine context for this demo. More...
 
const base::EngineContextgetEngine () const
 Return a reference to the engine context for this demo. More...
 
const TimegetLastUpdateTime () const
 Return the total time that it took to update the last frame. More...
 
const TimegetLastDrawTime () const
 Return the total time that it took to draw the last frame. More...
 
const TimegetLastFrameTime () const
 Return the total time that it took to complete the last frame. More...
 
Double getCurrentFPS () const
 Return current average frames per second for the demo. More...
 

Protected Member Functions

virtual Bool initialize (const Shared< GraphicsContext > &context)
 
virtual void deinitialize ()
 
virtual void update (const Time &dt)
 
virtual void draw (const Shared< GraphicsContext > &context)
 
virtual void resize (const Size2D &newSize)
 
virtual Bool textEvent (const TextEvent &event)
 
virtual Bool keyEvent (const KeyEvent &event)
 
virtual Bool mouseButtonEvent (const MouseButtonEvent &event)
 
virtual Bool mouseWheelEvent (const MouseWheelEvent &event)
 
virtual Bool mouseMotionEvent (const MouseMotionEvent &event)
 

Detailed Description

A simple demo application with a single window, basic key/mouse input, and drawing.

This class provides basic functionality needed for simple demo applications where quick prototyping is important.

Constructor & Destructor Documentation

om::engine::SimpleDemo::SimpleDemo ( )

Create a new simple demo with the name "Simple Demo" and window size 1024x768.

om::engine::SimpleDemo::SimpleDemo ( const UTF8String &  newName,
const Size2D &  newWindowSize 
)

Create a new simple demo with the specified name and window size.

virtual om::engine::SimpleDemo::~SimpleDemo ( )
virtual

Member Function Documentation

virtual void om::engine::SimpleDemo::run ( )
virtual

Run this demo.

void om::engine::SimpleDemo::stop ( )

Stop running this demo.

Bool om::engine::SimpleDemo::getIsRunning ( ) const
inline

Return whether or not the demo is currently running.

void om::engine::SimpleDemo::setIsRunning ( Bool  newIsRunning)
inline

Set whether or not the demo should be running.

Bool om::engine::SimpleDemo::getIsPaused ( ) const
inline

Return whether or not the demo is currently paused.

void om::engine::SimpleDemo::setIsPaused ( Bool  newIsPaused)
inline

Set whether or not the demo should be paused.

Bool om::engine::SimpleDemo::getIsFullscreen ( ) const
inline

Return whether or not the demo is currently fullscreen.

void om::engine::SimpleDemo::setIsFullscreen ( Bool  newIsFullscreen)
inline

Set whether or not the demo should be fullscreen.

const Time& om::engine::SimpleDemo::getTargetDt ( ) const
inline

Return the frame time that the demo attempts to execute at (but not faster than).

void om::engine::SimpleDemo::setTargetDt ( const Time newTargetDt)
inline

Set the frame time that the demo attempts to execute at (but not faster than).

const Shared<GraphicsContext>& om::engine::SimpleDemo::getContext ( ) const
inline

Return a pointer to the graphics context which this simple demo is using.

If the demo has not yet been started or the context was not able to be created, this method returns NULL.

ResourceManager& om::engine::SimpleDemo::getResourceManager ( )
inline

Return a reference to the resource manager which this simple demo is using.

const ResourceManager& om::engine::SimpleDemo::getResourceManager ( ) const
inline

Return a reference to the resource manager which this simple demo is using.

const Keyboard& om::engine::SimpleDemo::getKeyboard ( ) const
inline

Return a reference to the keyboard state for this demo.

Size om::engine::SimpleDemo::getDelegateCount ( ) const
inline

Return the total number of delegate objects that are responding to events for this demo.

const Delegate* om::engine::SimpleDemo::getDelegate ( Index  delegateIndex) const
inline

Return a pointer to the delegate at the specified index.

The method returns NULL if the specified delegate index is invalid.

Delegate* om::engine::SimpleDemo::getDelegate ( Index  delegateIndex)
inline

Return a pointer to the delegate at the specified index.

The method returns NULL if the specified delegate index is invalid.

Index om::engine::SimpleDemo::addDelegate ( const Delegate newDelegate)
inline

Add a new delegate to this demo.

The method returns the index of the new delegate.

void om::engine::SimpleDemo::clearDelegates ( )
inline

Remove all delegates from this simple demo.

base::EngineContext& om::engine::SimpleDemo::getEngine ( )
inline

Return a reference to the engine context for this demo.

const base::EngineContext& om::engine::SimpleDemo::getEngine ( ) const
inline

Return a reference to the engine context for this demo.

const Time& om::engine::SimpleDemo::getLastUpdateTime ( ) const
inline

Return the total time that it took to update the last frame.

const Time& om::engine::SimpleDemo::getLastDrawTime ( ) const
inline

Return the total time that it took to draw the last frame.

const Time& om::engine::SimpleDemo::getLastFrameTime ( ) const
inline

Return the total time that it took to complete the last frame.

Double om::engine::SimpleDemo::getCurrentFPS ( ) const
inline

Return current average frames per second for the demo.

virtual Bool om::engine::SimpleDemo::initialize ( const Shared< GraphicsContext > &  context)
protectedvirtual
virtual void om::engine::SimpleDemo::deinitialize ( )
protectedvirtual
virtual void om::engine::SimpleDemo::update ( const Time dt)
protectedvirtual
virtual void om::engine::SimpleDemo::draw ( const Shared< GraphicsContext > &  context)
protectedvirtual
virtual void om::engine::SimpleDemo::resize ( const Size2D &  newSize)
protectedvirtual
virtual Bool om::engine::SimpleDemo::textEvent ( const TextEvent event)
protectedvirtual
virtual Bool om::engine::SimpleDemo::keyEvent ( const KeyEvent event)
protectedvirtual
virtual Bool om::engine::SimpleDemo::mouseButtonEvent ( const MouseButtonEvent event)
protectedvirtual
virtual Bool om::engine::SimpleDemo::mouseWheelEvent ( const MouseWheelEvent event)
protectedvirtual
virtual Bool om::engine::SimpleDemo::mouseMotionEvent ( const MouseMotionEvent event)
protectedvirtual

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