Public Member Functions

wit::Renderer Class Reference

#include <wit/renderer.h>

List of all members.

Public Member Functions

 Renderer ()
virtual ~Renderer ()
virtual void render ()=0
virtual void waitForRendering ()
float scale () const
void setScale (float mag)
float translateX () const
float translateY () const
void setTranslation (float x, float y)
void drawPoint (const Point &p, const GXColor &color)
void drawPoint (float x, float y, const GXColor &color)
void drawLine (const Point &p1, const Point &p2, const GXColor &color)
void drawLine (float x1, float y1, float x2, float y2, const GXColor &color)
void drawRect (const Rect &rect, const GXColor &color)
void fillRect (const Rect &rect, const GXColor &color)
void drawPoints (const Polygon &poly, const GXColor &color)
void drawPolygon (const Polygon &poly, const GXColor &color)
void fillPolygon (const Polygon &poly, const GXColor &color)

Detailed Description

The Renderer class provides an interface for objects that wish to render graphics on the screen.

The render() function will be called on each Renderer object every vblank; if double-buffering is enabled, this will be immediately before the framebuffer is flipped.

The Renderer class also provides a number of convenience functions for drawing graphical primitives. You are not required to use these functions; you may use direct framebuffer access, the text console (if wit::UseConsole is enabled), GX (if wit::UseGX is enabled), or third-party graphics libraries for rendering.

Definition at line 14 of file renderer.h.


Constructor & Destructor Documentation

wit::Renderer::Renderer (  )

Constructs a new Renderer.

Definition at line 46 of file renderer.cpp.

wit::Renderer::~Renderer (  ) [virtual]

Destroys the Renderer.

Definition at line 60 of file renderer.cpp.


Member Function Documentation

void wit::Renderer::drawLine ( const Point p1,
const Point p2,
const GXColor &  color 
)

Draws a line on the screen in the selected color.

This is an overloaded member function provided for convenience.

Definition at line 216 of file renderer.cpp.

void wit::Renderer::drawLine ( float  x1,
float  y1,
float  x2,
float  y2,
const GXColor &  color 
)

Draws a line on the screen in the selected color.

Definition at line 199 of file renderer.cpp.

void wit::Renderer::drawPoint ( const Point p,
const GXColor &  color 
)

Draws a point on the screen in the selected color.

This is an overloaded member function provided for convenience.

Definition at line 191 of file renderer.cpp.

void wit::Renderer::drawPoint ( float  x,
float  y,
const GXColor &  color 
)

Draws a point on the screen in the selected color.

Definition at line 176 of file renderer.cpp.

void wit::Renderer::drawPoints ( const Polygon poly,
const GXColor &  color 
)

Draws a series of points on the screen in the specified color.

Definition at line 264 of file renderer.cpp.

void wit::Renderer::drawPolygon ( const Polygon poly,
const GXColor &  color 
)

Draws a polygon on the screen in the specified color.

Definition at line 282 of file renderer.cpp.

void wit::Renderer::drawRect ( const Rect rect,
const GXColor &  color 
)

Draws a rectangle on the screen in the specified color.

Definition at line 224 of file renderer.cpp.

void wit::Renderer::fillPolygon ( const Polygon poly,
const GXColor &  color 
)

Draws a polygon on the screen and fills it with the specified color.

Note that this function will only accurately fill convex polygons whose points are specified in clockwise order.

Definition at line 305 of file renderer.cpp.

void wit::Renderer::fillRect ( const Rect rect,
const GXColor &  color 
)

Draws a rectangle on the screen and fills it with the specified color.

Definition at line 245 of file renderer.cpp.

void wit::Renderer::render (  ) [pure virtual]

Implement this function to perform whatever steps are necessary to draw the Renderer's content on the screen.

To render in another thread, you may use this function to signal a rendering thread to begin processing, or you may ignore this function and use waitForRendered() to control the event loop when rendering is complete.

float wit::Renderer::scale (  ) const

Returns the current scaling factor applied to the convenience functions for this renderer object.

See also:
setScale()

Definition at line 123 of file renderer.cpp.

void wit::Renderer::setScale ( float  mag )

Sets the scaling factor applied to the convenience functions for this renderer object.

The default value of 1.0 performs no scaling.

See also:
scale()

Definition at line 135 of file renderer.cpp.

void wit::Renderer::setTranslation ( float  x,
float  y 
)

Sets the translation applied to the convenience functions for this renderer object.

The default value of 0.0 for both horizontal and vertical translations performs no translation.

See also:
translateX(), translateY()

Definition at line 167 of file renderer.cpp.

float wit::Renderer::translateX (  ) const

Returns the horizontal translation applied to the convenience functions for this renderer object.

See also:
setTranslation()

Definition at line 145 of file renderer.cpp.

float wit::Renderer::translateY (  ) const

Returns the vertical translation applied to the convenience functions for this renderer object.

See also:
setTranslation()

Definition at line 155 of file renderer.cpp.

void wit::Renderer::waitForRendering (  ) [virtual]

If you are performing rendering in another thread, implement this function to block the main event loop until the rendering is complete.

The default implementation does nothing.

Definition at line 85 of file renderer.cpp.


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