Public Member Functions | Private Member Functions | Private Attributes

SDL_Renderer Class Reference

SDL Renderer. More...

#include <SDL_Renderer.h>

Inheritance diagram for SDL_Renderer:
Renderer

List of all members.

Public Member Functions

 SDL_Renderer ()
 SDL_Renderer (Uint ResX, Uint ResY, Uint BPP, bool fullscreen, bool vsync)
 ~SDL_Renderer ()
void setApplicationTitle (const std::string &title)
bool drawImage (Image *image, int x, int y)
bool drawImage (Image *image, int rasterX, int rasterY, int imgX, int imgY, int imgWidth, int imgHeight)
bool drawImagePattern (Image *image, int x, int y, int w, int h)
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)
bool drawImageRect (int x, int y, int w, int h, ImageList &images)
void drawPixel (int x, int y, int r, int g, int b, int a)
void drawLine (int x, int y, int x2, int y2, int r, int g, int b, int a)
void drawBox (int x, int y, int width, int height, int r, int g, int b, int a)
void drawCircle (int cx, int cy, int radius, int r, int g, int b, int a, int num_segments, float scale_x, float scale_y)
void floodFill (int x, int y, int width, int height, int r, int g, int b, int a)
bool drawText (Font *font, const std::string &text, int x, int y, int r, int g, int b, int a)
bool drawTextClamped (Font *font, const std::string &text, int x, int y, int w, int h, int r, int g, int b, int a)
void imageDesaturate (Image *image)
void clearScreen (int r, int g, int b)
Uint getPixelColor (Image *src, int x, int y)
bool isPixelTransparent (Image *src, int x, int y)
int getScreenWidth ()
int getScreenHeight ()
void update ()

Private Member Functions

 SDL_Renderer (const SDL_Renderer &)
SDL_Rendereroperator= (const SDL_Renderer &)
bool drawPointer (int x, int y)
void initVideo (Uint resX, Uint resY, Uint bpp, bool fullscreen, bool vsync)

Private Attributes

SDL_Surface * mScreen

Detailed Description

SDL Renderer.

Implements all Renderer functions with the SDL API.


Constructor & Destructor Documentation

SDL_Renderer::SDL_Renderer (  ) 
SDL_Renderer::SDL_Renderer ( Uint  ResX,
Uint  ResY,
Uint  BPP,
bool  fullscreen,
bool  vsync 
)

This version of the Constructor is used if you don't want to use a Configuration class.

SDL_Renderer::~SDL_Renderer (  ) 
SDL_Renderer::SDL_Renderer ( const SDL_Renderer  )  [private]

Member Function Documentation

void SDL_Renderer::clearScreen ( int  r,
int  g,
int  b 
) [virtual]
Todo:
It may be overkill to do it here but we should probably attempt to clamp the values where they should be.

Reimplemented from Renderer.

void SDL_Renderer::drawBox ( int  x,
int  y,
int  width,
int  height,
int  r,
int  g,
int  b,
int  a 
) [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 from Renderer.

void SDL_Renderer::drawCircle ( int  cx,
int  cy,
int  radius,
int  r,
int  g,
int  b,
int  a,
int  num_segments,
float  scale_x,
float  scale_y 
) [virtual]

Reimplemented from Renderer.

bool SDL_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 from Renderer.

bool SDL_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 from Renderer.

bool SDL_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 from Renderer.

bool SDL_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 from Renderer.

bool SDL_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 from Renderer.

void SDL_Renderer::drawLine ( int  x,
int  y,
int  x2,
int  y2,
int  r,
int  g,
int  b,
int  a 
) [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 from Renderer.

void SDL_Renderer::drawPixel ( int  x,
int  y,
int  r,
int  g,
int  b,
int  a 
) [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 from Renderer.

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

Reimplemented from Renderer.

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

Reimplemented from Renderer.

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

Reimplemented from Renderer.

void SDL_Renderer::floodFill ( int  x,
int  y,
int  width,
int  height,
int  r,
int  g,
int  b,
int  a 
) [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 from Renderer.

Uint SDL_Renderer::getPixelColor ( Image src,
int  x,
int  y 
) [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 from Renderer.

int SDL_Renderer::getScreenHeight (  )  [virtual]

Returns the primary display's Height.

Reimplemented from Renderer.

int SDL_Renderer::getScreenWidth (  )  [virtual]

Returns the primary display's Width.

Reimplemented from Renderer.

void SDL_Renderer::imageDesaturate ( Image image  )  [virtual]

Desaturates a source image.

Parameters:
image A pointer to a properly constructed Image.
Note:
This function permanently modifies the Image passed to it.

Reimplemented from Renderer.

void SDL_Renderer::initVideo ( Uint  resX,
Uint  resY,
Uint  bpp,
bool  fullscreen,
bool  vsync 
) [private, virtual]

Reimplemented from Renderer.

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

Determins whether the pixel at specified location is completely transparent.

Note:
Assumes that the source image is 32-Bit and has an alpha channel.
Todo:
Add support for color-keyed images.

Reimplemented from Renderer.

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

Reimplemented from Renderer.

void SDL_Renderer::update (  )  [virtual]

Refresh the screen and flip the screen buffers.

Reimplemented from Renderer.


Member Data Documentation

SDL_Surface* SDL_Renderer::mScreen [private]

Primary screen surface.


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