Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions

Renderer Class Reference

Renderer base class. More...

#include <Renderer.h>

Inheritance diagram for Renderer:
OGL_Renderer SDL_Renderer

List of all members.

Public Member Functions

 Renderer ()
 Renderer (const std::string &rendererName)
virtual ~Renderer ()
const std::string & getName ()
const std::string & getDriverName ()
const std::string & getLastError ()
virtual void setApplicationTitle (const std::string &title)
virtual bool setPointer (Image *image)
virtual bool drawImage (Image *image, int x, int y)
virtual bool drawImage (Image *image, int rasterX, int rasterY, int imgX, int imgY, int imgWidth, int imgHeight)
virtual bool drawImagePattern (Image *image, int x, int y, int w, int h)
virtual bool drawImageRect (int x, int y, int w, int h, Image *topLeft, Image *top, Image *topRight, Image *left, Image *center, Image *right, Image *bottomLeft, Image *bottom, Image *bottomRight)
virtual bool drawImageRect (int x, int y, int w, int h, ImageList &images)
virtual void drawPixel (int x, int y, int r, int g, int b, int a=255)
virtual void drawLine (int x, int y, int x2, int y2, int r, int g, int b, int a=255)
void drawBox (const Recti &rect, int r, int g, int b, int a=255)
virtual void drawBox (int x, int y, int width, int height, int r, int g, int b, int a=255)
virtual void drawCircle (int cx, int cy, int radius, int r, int g, int b, int a, int num_segments=10, float scale_x=1.0f, float scale_y=1.0f)
virtual void floodFill (int x, int y, int width, int height, int r, int g, int b, int a=255)
virtual bool drawText (Font *font, const std::string &text, int x, int y, int r, int g, int b, int a=255)
bool drawTextShadow (Font *font, const std::string &text, int x, int y, int sDistance, int r, int g, int b, int sr, int sg, int sb, int a=255)
virtual bool drawTextClamped (Font *font, const std::string &text, int x, int y, int w, int h, int r, int g, int b, int a=255)
bool drawTextShadowClamped (Font *font, const std::string &text, int x, int y, int w, int h, int distance, int r, int g, int b, int sr, int sg, int sb, int a=255)
virtual void imageDesaturate (Image *image)
virtual void fadeIn (int delayTime)
virtual void fadeOut (int delayTime)
virtual void toggleLetterBox ()
virtual void toggleCinematicMode ()
virtual void clearScreen (int r, int g, int b)
virtual Uint getPixelColor (Image *src, int x, int y)
virtual bool isPixelTransparent (Image *src, int x, int y)
virtual int getScreenWidth ()
virtual int getScreenHeight ()
void debug ()
virtual void update ()

Protected Member Functions

virtual bool drawPointer (int x, int y)
virtual void initVideo (Uint resX, Uint resY, Uint bpp, bool fullscreen, bool vsync)

Protected Attributes

std::string mRendererName
std::string mDriverName
StringList mErrorMessages
bool mLetterbox
bool mCinematic
bool mCustomPointer
int mLetterBoxHeight
PointermPointer

Private Member Functions

 Renderer (const Renderer &)
Rendereroperator= (const Renderer &)

Detailed Description

Renderer base class.

Provides a standard Renderer interface. This renderer can be used but will do nothing -- e.g., a NULL renderer.


Constructor & Destructor Documentation

Renderer::Renderer (  ) 

Default constructor.

Renderer::Renderer ( const std::string &  rendererName  ) 
Renderer::~Renderer (  )  [virtual]
Renderer::Renderer ( const Renderer  )  [private]

Member Function Documentation

void Renderer::clearScreen ( int  r,
int  g,
int  b 
) [virtual]

Clears the screen with a given RGB value.

Parameters:
r Red color value between 0 - 255.
g Green Color Value between 0 - 255.
b Blue Color Value between 0 - 255.

Reimplemented in OGL_Renderer, and SDL_Renderer.

void Renderer::debug (  ) 

Writes debug information to the log file.

void Renderer::drawBox ( int  x,
int  y,
int  width,
int  height,
int  r,
int  g,
int  b,
int  a = 255 
) [virtual]

Draws a hollow box on the primary surface.

Parameters:
x X-Coordinate of the box.
y Y-Coordinate of the box.
width Width, in pixels, of the box.
height Height, in pixels, of the box.
r Red Color Value. Must be between 0 - 255.
g Green Color Value. Must be between 0 - 255.
b Blue Color Value. Must be between 0 - 255.
a Alhpa value to use. Must be between 0 (completely transparent) - 255 (completely opaque).

Reimplemented in OGL_Renderer, and SDL_Renderer.

void Renderer::drawBox ( const Recti rect,
int  r,
int  g,
int  b,
int  a = 255 
)

Draws a hollow box on the primary surface.

Parameters:
rect A Recti defining the box dimensions.
r Red Color Value. Must be between 0 - 255.
g Green Color Value. Must be between 0 - 255.
b Blue Color Value. Must be between 0 - 255.
a Alpha Value. Must be between 0 - 255.
virtual void Renderer::drawCircle ( int  cx,
int  cy,
int  radius,
int  r,
int  g,
int  b,
int  a,
int  num_segments = 10,
float  scale_x = 1.0f,
float  scale_y = 1.0f 
) [inline, virtual]

Reimplemented in OGL_Renderer, and SDL_Renderer.

bool Renderer::drawImage ( Image image,
int  rasterX,
int  rasterY,
int  imgX,
int  imgY,
int  imgWidth,
int  imgHeight 
) [virtual]

Draws a portion of a given Image to the screen.

Parameters:
image A pointer to an Image Resource class.
rasterX X-Coordinate of the Image to draw.
rasterY Y-Coordinate of the Image to draw.
imgX X-Coordinate of the Rectangle to start getting pixel data from.
imgY Y-Coordinate of the Rectangle to start getting pixel data from.
imgWidth Width of the Rectangle to start getting pixel data from.
imgHeight Height of the Rectangle to start getting pixel data from.

Reimplemented in OGL_Renderer, and SDL_Renderer.

bool Renderer::drawImage ( Image image,
int  x,
int  y 
) [virtual]

Draws an Image to the screen.

Parameters:
image A pointer to an Image Resource class.
x X-Coordinate of the Image to draw.
y Y-Coordinate of the Image to draw.

Reimplemented in OGL_Renderer, and SDL_Renderer.

bool Renderer::drawImagePattern ( Image image,
int  x,
int  y,
int  w,
int  h 
) [virtual]

Trevor, Comment Me!

Parameters:
image A pointer to an Image Resource class.
x Comment me!
y Comment me!
w Comment me!
h Comment me!

Reimplemented in OGL_Renderer, and SDL_Renderer.

bool Renderer::drawImageRect ( int  x,
int  y,
int  w,
int  h,
Image topLeft,
Image top,
Image topRight,
Image left,
Image center,
Image right,
Image bottomLeft,
Image bottom,
Image bottomRight 
) [virtual]
Todo:
Comment me!

Reimplemented in OGL_Renderer, and SDL_Renderer.

bool Renderer::drawImageRect ( int  x,
int  y,
int  w,
int  h,
ImageList images 
) [virtual]

Draws a rectangle using a series of set of images.

This function expects an ImageList with 9 images in it: four corners, four edges and a center image to fill the rest in with.

Todo:
Document the expected order of images to properly draw a rectangle.

Reimplemented in OGL_Renderer, and SDL_Renderer.

void Renderer::drawLine ( int  x,
int  y,
int  x2,
int  y2,
int  r,
int  g,
int  b,
int  a = 255 
) [virtual]

Draws a line from (x, y) - (x2, y2) on the primary surface.

Parameters:
x X-Coordinate of the start of the line.
y Y-Coordinate of the start of the line.
x2 X-Coordinate of the end of the line.
y2 Y-Coordinate of the end of the line.
r Red Color Value. Must be between 0 - 255.
g Green Color Value. Must be between 0 - 255.
b Blue Color Value. Must be between 0 - 255.
a Alpha Value. Must be between 0 - 255. Defaults to 255.

Reimplemented in OGL_Renderer, and SDL_Renderer.

void Renderer::drawPixel ( int  x,
int  y,
int  r,
int  g,
int  b,
int  a = 255 
) [virtual]

Draws a single Pixel to the primary surface.

Parameters:
x X-Coordinate of the pixel to draw.
y Y-Coordinate of the pixel to draw.
r Red Color Value. Must be between 0 - 255.
g Green Color Value. Must be between 0 - 255.
b Blue Color Value. Must be between 0 - 255.
a Alpha Value. Must be between 0 - 255. Defaults to 255.

Reimplemented in OGL_Renderer, and SDL_Renderer.

bool Renderer::drawPointer ( int  x,
int  y 
) [protected, virtual]
Todo:
Do we actually use this??

Reimplemented in OGL_Renderer, and SDL_Renderer.

virtual bool Renderer::drawText ( Font font,
const std::string &  text,
int  x,
int  y,
int  r,
int  g,
int  b,
int  a = 255 
) [virtual]

Reimplemented in OGL_Renderer, and SDL_Renderer.

virtual bool Renderer::drawTextClamped ( Font font,
const std::string &  text,
int  x,
int  y,
int  w,
int  h,
int  r,
int  g,
int  b,
int  a = 255 
) [virtual]

Reimplemented in OGL_Renderer, and SDL_Renderer.

bool Renderer::drawTextShadow ( Font font,
const std::string &  text,
int  x,
int  y,
int  sDistance,
int  r,
int  g,
int  b,
int  sr,
int  sg,
int  sb,
int  a = 255 
)
bool Renderer::drawTextShadowClamped ( Font font,
const std::string &  text,
int  x,
int  y,
int  w,
int  h,
int  distance,
int  r,
int  g,
int  b,
int  sr,
int  sg,
int  sb,
int  a = 255 
)
void Renderer::fadeIn ( int  delayTime  )  [virtual]

Fades the screen in from Black.

Parameters:
delayTime Number of seconds the fade should last.
void Renderer::fadeOut ( int  delayTime  )  [virtual]

Fades the screen to Black.

Parameters:
delayTime Number of seconds the fade should last.
void Renderer::floodFill ( int  x,
int  y,
int  width,
int  height,
int  r,
int  g,
int  b,
int  a = 255 
) [virtual]

Fills a given area with a solid color on the primary surface.

Parameters:
x X-Coordinate of the area to fill.
y Y-Coordinate of the area to fill.
width Width, in pixels, of the area to fill.
height Height, in pixels, of the area to fill.
r Red Color Value. Must be between 0 - 255.
g Green Color Value. Must be between 0 - 255.
b Blue Color Value. Must be between 0 - 255.
a Alpha value. Must be between 0 - 255.

Reimplemented in OGL_Renderer, and SDL_Renderer.

const string & Renderer::getDriverName (  ) 

Returns the name of the driver as named by the operating system.

const string & Renderer::getLastError (  ) 

Returns a description of the last error message, if any.

const string & Renderer::getName (  ) 

Returns the name of the Renderer.

virtual Uint Renderer::getPixelColor ( Image src,
int  x,
int  y 
) [inline, virtual]

Returns the RGB color of a pixel at X, Y as an unsigned 32-Bit Integer.

Parameters:
src A pointer to an Image.
x X-Coordinate of the pixel to inspect.
y Y-Coordinate of the pixel to inspect.

Reimplemented in OGL_Renderer, and SDL_Renderer.

int Renderer::getScreenHeight (  )  [virtual]

Returns the primary display's Height.

Reimplemented in OGL_Renderer, and SDL_Renderer.

int Renderer::getScreenWidth (  )  [virtual]

Returns the primary display's Width.

Reimplemented in OGL_Renderer, and SDL_Renderer.

virtual void Renderer::imageDesaturate ( Image image  )  [inline, virtual]

Reimplemented in OGL_Renderer, and SDL_Renderer.

virtual void Renderer::initVideo ( Uint  resX,
Uint  resY,
Uint  bpp,
bool  fullscreen,
bool  vsync 
) [inline, protected, virtual]

Reimplemented in OGL_Renderer, and SDL_Renderer.

virtual bool Renderer::isPixelTransparent ( Image src,
int  x,
int  y 
) [inline, virtual]

Reimplemented in OGL_Renderer, and SDL_Renderer.

Renderer& Renderer::operator= ( const Renderer  )  [private]
virtual void Renderer::setApplicationTitle ( const std::string &  title  )  [inline, virtual]

Reimplemented in OGL_Renderer, and SDL_Renderer.

bool Renderer::setPointer ( Image image  )  [virtual]

Sets an Image to be used as the mouse pointer over the default system pointer.

void Renderer::toggleCinematicMode (  )  [virtual]

Toggles Cinematic Mode.

void Renderer::toggleLetterBox (  )  [virtual]

Toggles LetterBox mode.

virtual void Renderer::update (  )  [inline, virtual]

Reimplemented in OGL_Renderer, and SDL_Renderer.


Member Data Documentation

bool Renderer::mCinematic [protected]

Toggles Cinematic Mode

bool Renderer::mCustomPointer [protected]

Toggles drawing of system pointer or custom set pointer.

std::string Renderer::mDriverName [protected]

OS Driver name

String describing the last error that occured

bool Renderer::mLetterbox [protected]

Toggles Letterbox Mode

int Renderer::mLetterBoxHeight [protected]

Height of Letter Box's

Internal mouse pointer.

std::string Renderer::mRendererName [protected]

Internal name of the Renderer.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines