The main class that is able to initialize and maintain the render loop as well as a view, an input object, an object manager and a model renderer. More...

#include <Renderer.h>

Public Types

typedef int RendererCaller
 

Public Member Functions

 Renderer ()
 Constructor. More...
 
virtual ~Renderer ()
 Virtual destructor. More...
 
ViewPtr getView ()
 Returns a pointer to the view of the renderer. More...
 
InputPtr getInput ()
 Returns a pointer to the input handler of the renderer. More...
 
ObjectManagerPtr getObjects ()
 Returns a pointer to the object management of the renderer. More...
 
ModelRendererPtr getModelRenderer ()
 Returns a pointer to the model renderer. More...
 
bool isInitialized ()
 Returns true if the renderer has already been initialized. More...
 
bool isRunning ()
 Returns true if the renderer is running. More...
 
void setRenderProject (IRenderProject *p)
 Sets the project instance to be used for function calls. More...
 
void setInitFunction (void(*f)())
 Sets a static function that gets called when initializing the renderer. More...
 
void setLoopFunction (void(*f)(const double deltaTime, const double elapsedTime))
 Sets a static function that gets called repeatedly when looping. More...
 
void setTerminateFunction (void(*f)())
 Sets a static function that gets called when terminating the renderer. More...
 
bool initRenderer (std::string windowTitle=bRenderer::DEFAULT_WINDOW_TITLE())
 Do all necessary initializations for the renderer to be ready to run (returns true in the case of success) More...
 
bool initRenderer (bool fullscreen, std::string windowTitle=bRenderer::DEFAULT_WINDOW_TITLE())
 Do all necessary initializations for the renderer to be ready to run (returns true in the case of success) More...
 
bool initRenderer (GLint width, GLint height, bool fullscreen=false, std::string windowTitle=bRenderer::DEFAULT_WINDOW_TITLE())
 Do all necessary initializations for the renderer to be ready to run (returns true in the case of success) More...
 
void runRenderer ()
 Start the render loop. More...
 
void stopRenderer ()
 Stop the render loop. More...
 
void terminateRenderer ()
 Terminate the renderer. More...
 

Detailed Description

The main class that is able to initialize and maintain the render loop as well as a view, an input object, an object manager and a model renderer.

Author
Benjamin Buergisser

Member Typedef Documentation

Constructor & Destructor Documentation

Renderer::Renderer ( )

Constructor.

virtual Renderer::~Renderer ( )
inlinevirtual

Virtual destructor.

Member Function Documentation

InputPtr Renderer::getInput ( )

Returns a pointer to the input handler of the renderer.

ModelRendererPtr Renderer::getModelRenderer ( )

Returns a pointer to the model renderer.

ObjectManagerPtr Renderer::getObjects ( )

Returns a pointer to the object management of the renderer.

ViewPtr Renderer::getView ( )

Returns a pointer to the view of the renderer.

This function returns a pointer to the view of the renderer. The view is where the OpenGL context and on desktop systems a window is created and managed. On iOS a UIView is created instead.

bool Renderer::initRenderer ( std::string  windowTitle = bRenderer::DEFAULT_WINDOW_TITLE())

Do all necessary initializations for the renderer to be ready to run (returns true in the case of success)

Parameters
[in]windowTitleThe title for the window on desktop systems (optional)
bool Renderer::initRenderer ( bool  fullscreen,
std::string  windowTitle = bRenderer::DEFAULT_WINDOW_TITLE() 
)

Do all necessary initializations for the renderer to be ready to run (returns true in the case of success)

Parameters
[in]fullscreenDecides whether or not the application runs in full screen mode
[in]windowTitleThe title for the window on desktop systems (optional)
bool Renderer::initRenderer ( GLint  width,
GLint  height,
bool  fullscreen = false,
std::string  windowTitle = bRenderer::DEFAULT_WINDOW_TITLE() 
)

Do all necessary initializations for the renderer to be ready to run (returns true in the case of success)

Parameters
[in]widthThe width of the window in pixels
[in]heightThe height of the window in pixels
[in]fullscreenDecides whether or not the application runs in full screen mode (optional)
[in]windowTitleThe title for the window on desktop systems (optional)
bool Renderer::isInitialized ( )

Returns true if the renderer has already been initialized.

bool Renderer::isRunning ( )

Returns true if the renderer is running.

void Renderer::runRenderer ( )

Start the render loop.

void Renderer::setInitFunction ( void(*)()  f)

Sets a static function that gets called when initializing the renderer.

In an application a function can be defined that gets called immediately after the renderer is initialized.

Parameters
[in]fThe function to be called
void Renderer::setLoopFunction ( void(*)(const double deltaTime, const double elapsedTime)  f)

Sets a static function that gets called repeatedly when looping.

The set function gets called repeatedly while the renderer is running. Usually the scene gets drawn and setup in the defined function.

Parameters
[in]fThe function to be called
void Renderer::setRenderProject ( IRenderProject p)

Sets the project instance to be used for function calls.

The init, loop and terminate function of the set instance get called automatically.

Parameters
[in]pThe project instance
void Renderer::setTerminateFunction ( void(*)()  f)

Sets a static function that gets called when terminating the renderer.

The set function gets called when the renderer is terminated. Here allocated memory can be freed, instances deleted and statuses changed.

Parameters
[in]fThe function to be called
void Renderer::stopRenderer ( )

Stop the render loop.

void Renderer::terminateRenderer ( )

Terminate the renderer.