Resolution independent 2D graphics engine
qr::renderer

Class Description

The core of the graphics engine, this class handles graphics engine set up and scene node rendering. There should only ever be one instance of this class at a time.

Public Methods

renderer (vector2d_i viewp_aspr, float project_width, bool fulscr=false, vector2d_i alt_res=vector2d_i(0, 0), bool vsync=false, int multisample=0)
scene_manager * get_scene_manager ()
void main ()
bool run ()
void drop ()
void set_total_layers (unsigned int num_layers)
void set_window_title (const char *title)
float get_time_delta ()
float get_ticks ()
float get_fps ()
void set_camera_location (vector2d_f new_loc)
vector2d_f get_camera_location ()
float get_pix_size ()
vector2d_f get_viewport_size ()
void set_bg_sprite (sprite *ob_sprite)
sprite * get_bg_sprite ()

Details

qr::renderer::renderer ( vector2d_i viewp_aspr,
float project_width,
bool fulscr,
vector2d_i alt_res,
bool vsync,
int multisample
)

Description

Set up the renderer and create a window.

Paramiters

viewp_aspr Viewport Aspect ratio, the viewport is automatically letterboxed to maintain this ratio regardless of the window size.
project_width View port width in relative co-ordinate space.
fulscr Full screen or windowed display.
alt_res Window size hint (the user can resize the window if they wish), pass 0 for a maximised window. This is ignored if full screen is set to true.
vsync Enables vertical synchronisation, avoids tearing but may be slower.
multisample Multi sample anti-aliasing level.
scene_manager* qr::renderer::get_scene_manager ( ) [inline]

Description

Gets the scene manager.

Retunes

Pointer to scene manager.

void qr::renderer::main ( )

Description

Runs the engines internal event loop, returns when an event receiver returns false.

bool qr::renderer::run ( )

Description

Runs the graphics engine for one frame.

Retunes

True unless an qr::quit_event has bean raised.

void qr::renderer::drop ( )

Description

Deletes the renderer, scene manager and all registered resources.

void qr::renderer::set_total_layers ( unsigned int num_layers
)

Description

Sets the total number of layers.

Paramiters

num_layers Number of layers.
void qr::renderer::set_window_title ( const char * title
)

Description

Set the window title.

Paramiters

title Window title.
float qr::renderer::get_time_delta ( ) [inline]

Description

Get time difference between the current and previous frame in milliseconds.

float qr::renderer::get_ticks ( ) [inline]

Description

Get time in milliseconds since the application was started.

float qr::renderer::get_fps ( ) [inline]

Description

Get the current frames per second.

void qr::renderer::set_camera_location ( vector2d_f new_loc
) [inline]

Description

Sets the camera location.

Paramiters

new_loc New camera location.
vector2d_f qr::renderer::get_camera_location ( ) [inline]

Description

Gets the camera location.

Retunes

Camera location.

float qr::renderer::get_pix_size ( ) [inline]

Description

Gets the size of a pixel in relative coordinate space.

Retunes

The size of a pixel in relative units.

vector2d_f qr::renderer::get_viewport_size ( ) [inline]

Description

Gets the dimensions of the view port.

Retunes

The dimensions of the view port in relative units.

void qr::renderer::set_bg_sprite ( sprite * ob_sprite
) [inline]

Description

Replaces the background sprite.

Paramiters

ob_sprite New background sprite.
sprite* qr::renderer::get_bg_sprite ( ) [inline]

Description

Gets the background sprite.