Annchienta::VideoManager Class Reference

List of all members.

Public Member Functions

void boxBlur (int x1, int y1, int x2, int y2, int radius=2)
void clear ()
void disableClipping () const
void drawLine (int x1, int y1, int x2, int y2) const
void drawPattern (Surface *surface, int x1, int y1, int x2, int y2) const
void drawQuad (int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) const
void drawRectangle (int x1, int y1, int x2, int y2) const
void drawString (Font *font, const char *str, int x, int y) const
void drawStringCentered (Font *font, const char *str, int x, int y) const
void drawStringRight (Font *font, const char *str, int x, int y) const
void drawSurface (Surface *surface, int x1, int y1, int x2, int y2) const
void drawSurface (Surface *surface, int dx, int dy, int sx1, int sy1, int sx2, int sy2) const
void drawSurface (Surface *surface, int x, int y) const
void drawTriangle (int x1, int y1, int x2, int y2, int x3, int y3) const
void flip ()
int getNumberOfBackBuffers () const
int getScreenHeight () const
int getScreenWidth () const
int getVideoScale () const
void grabBuffer (Surface *surface, int x1, int y1, int x2, int y2) const
void grabBuffer (Surface *surface) const
void identity () const
int isFullScreen () const
void pop () const
void push () const
void reset ()
void restoreBuffer (int slot) const
void rotate (float degrees) const
void scale (float x, float y) const
void setAlpha (int alpha=0xff) const
void setClearColor (int red=0xff, int green=0xff, int blue=0xff, int alpha=0xff) const
void setClippingRectangle (int x1, int y1, int x2, int y2) const
void setColor (int red=0xff, int green=0xff, int blue=0xff, int alpha=0xff) const
void setVideoMode (int w, int h, const char *title="Annchienta RPG Engine", bool fullScreen=false, int videoScale=1)
void storeBuffer (int slot)
void translate (float x, float y) const
 VideoManager ()
 ~VideoManager ()

Private Attributes

Surface ** backBuffers
bool fullScreen
int screenHeight
int screenWidth
int videoScale

Static Private Attributes

static const int numberOfBackBuffers = 8


Detailed Description

A class used for painting on the screen. This supports 2D drawing features.

Constructor & Destructor Documentation

Annchienta::VideoManager::VideoManager (  ) 

Annchienta::VideoManager::~VideoManager (  ) 


Member Function Documentation

void Annchienta::VideoManager::boxBlur ( int  x1,
int  y1,
int  x2,
int  y2,
int  radius = 2 
)

Perform a fairly quick box blur to a rectangle of the current buffer. This is pretty nice for visual effects.

Parameters:
x1 Top left x coord of the rectangle.
y1 Top left y coord of the rectangle.
x2 Bottom right x coord of the rectangle.
y2 Bottom right y coord of the rectangle.
radius Blur radius. A large radius will slow down this function.
Warning:
Matrix transformations do not apply to this.

This function will mess up your clipping rectangle if you set one with setClippingRectangle().

void Annchienta::VideoManager::clear (  ) 

Begins the scene. Clears and resets the screen.

void Annchienta::VideoManager::disableClipping (  )  const

Disable the clipping rectangle set with setClippingRectangle().

void Annchienta::VideoManager::drawLine ( int  x1,
int  y1,
int  x2,
int  y2 
) const

Draw a straight line between two points.

Parameters:
x1 X coord of the 1st point.
y1 Y coord of the 1st point.
x2 X coord of the 2nd point.
y2 Y coord of the 2nd point.

void Annchienta::VideoManager::drawPattern ( Surface surface,
int  x1,
int  y1,
int  x2,
int  y2 
) const

Draws a surface, tiled like a pattern to rectangle on the screen.

Parameters:
surface Surface to be drawn.
x1 Top left x coord of the rectangle.
y1 Top left y coord of the rectangle.
x2 Bottom right x coord of the rectangle.
y2 Bottom right y coord of the rectangle.

void Annchienta::VideoManager::drawQuad ( int  x1,
int  y1,
int  x2,
int  y2,
int  x3,
int  y3,
int  x4,
int  y4 
) const

Draw a quad between four points.

Parameters:
x1 X coord of the 1st point.
y1 Y coord of the 1st point.
x2 X coord of the 2nd point.
y2 Y coord of the 2nd point.
x3 X coord of the 3rd point.
y3 Y coord of the 3rd point.
x4 X coord of the 4rd point.
y4 Y coord of the 4rd point.

void Annchienta::VideoManager::drawRectangle ( int  x1,
int  y1,
int  x2,
int  y2 
) const

Draw an axis-aligned rectangle.

Parameters:
x1 Top left x coord of the rectangle.
y1 Top left y coord of the rectangle.
x2 Bottom right x coord of the rectangle.
y2 Bottom right y coord of the rectangle.

void Annchienta::VideoManager::drawString ( Font font,
const char *  str,
int  x,
int  y 
) const

Draws a string to the screen.

Parameters:
font Font to be used.
str The string to be drawn.
x X destination coord on the screen.
y Y destination coord on the screen.

void Annchienta::VideoManager::drawStringCentered ( Font font,
const char *  str,
int  x,
int  y 
) const

Draws a string to the screen, horizontally centered.

Parameters:
font Font to be used.
str The string to be drawn.
x X destination coord on the screen.
y Y destination coord on the screen.

void Annchienta::VideoManager::drawStringRight ( Font font,
const char *  str,
int  x,
int  y 
) const

Draws a string to the screen, horizontally right-aligned.

Parameters:
font Font to be used.
str The string to be drawn.
x X destination coord on the screen.
y Y destination coord on the screen.

void Annchienta::VideoManager::drawSurface ( Surface surface,
int  x1,
int  y1,
int  x2,
int  y2 
) const

Draws a surface, stretched to a rectangle on the screen.

Parameters:
surface Surface to be drawn.
x1 Top left x coord of the rectangle.
y1 Top left y coord of the rectangle.
x2 Bottom right x coord of the rectangle.
y2 Bottom right y coord of the rectangle.

void Annchienta::VideoManager::drawSurface ( Surface surface,
int  dx,
int  dy,
int  sx1,
int  sy1,
int  sx2,
int  sy2 
) const

Draws a rectangular part of a surface to the screen.

Parameters:
surface Surface to be drawn.
dx X coord of destination on screen.
dy Y coord of destination on screen.
sx1 Top left x coord of the rectangle.
sy1 Top left y coord of the rectangle.
sx2 Bottom right x coord of the rectangle.
sy2 Bottom right y coord of the rectangle.

void Annchienta::VideoManager::drawSurface ( Surface surface,
int  x,
int  y 
) const

Draws an entire surface to the screen. This should be slightly faster than the other drawSurface() methods because it is optimized.

Parameters:
surface Surface to be drawn.
x X coord of destination on screen.
y Y coord of destination on screen.

void Annchienta::VideoManager::drawTriangle ( int  x1,
int  y1,
int  x2,
int  y2,
int  x3,
int  y3 
) const

Draw a triangle between three points.

Parameters:
x1 X coord of the 1st point.
y1 Y coord of the 1st point.
x2 X coord of the 2nd point.
y2 Y coord of the 2nd point.
x3 X coord of the 3rd point.
y3 Y coord of the 3rd point.

void Annchienta::VideoManager::flip (  ) 

Draw the buffer to the screen.

int Annchienta::VideoManager::getNumberOfBackBuffers (  )  const

Returns:
The number of backbuffers available.

int Annchienta::VideoManager::getScreenHeight (  )  const

Returns:
Height of the screen.

int Annchienta::VideoManager::getScreenWidth (  )  const

Returns:
Width of the screen.

int Annchienta::VideoManager::getVideoScale (  )  const

Returns:
The video mode scale.

void Annchienta::VideoManager::grabBuffer ( Surface surface,
int  x1,
int  y1,
int  x2,
int  y2 
) const

Copy a part of the buffer to a Surface. Make sure your Surface is large enough, especially when the videoScale set is larger than 1.

Parameters:
surface Destination of the buffer pixels.
x1 Top left x coord of the rectangle.
y1 Top left y coord of the rectangle.
x2 Bottom right x coord of the rectangle.
y2 Bottom right y coord of the rectangle.
Warning:
Matrix transformations do not apply to this.
Note:
It is safer to use the storeBuffer() and restoreBuffer() methods.

void Annchienta::VideoManager::grabBuffer ( Surface surface  )  const

Copy the entire buffer to a Surface. Make sure your Surface is large enough, especially when the videoScale set is larger than 1.

Parameters:
surface Destination of the buffer pixels.
Warning:
Matrix transformations to not apply to this.
Note:
It is safer to use the storeBuffer() and restoreBuffer() methods.

void Annchienta::VideoManager::identity (  )  const

Loads identity matrix.

int Annchienta::VideoManager::isFullScreen (  )  const

Returns:
If we are in full screen mode.

void Annchienta::VideoManager::pop (  )  const

Restores a matrix from the stack.

void Annchienta::VideoManager::push (  )  const

Pushes the current matrix onto the stack.

void Annchienta::VideoManager::reset (  ) 

Resets all matrixes, colors...

void Annchienta::VideoManager::restoreBuffer ( int  slot  )  const

Restores a buffer, stored with storeBuffer().

Parameters:
slot Slot to restore from.

void Annchienta::VideoManager::rotate ( float  degrees  )  const

Multiply the current matrix with a rotation matrix.

Parameters:
degrees Degrees to be rotated clockwise.

void Annchienta::VideoManager::scale ( float  x,
float  y 
) const

Multiply the current matrix with a scalar matrix.

Parameters:
x X scale factor.
y Y scale factor.

void Annchienta::VideoManager::setAlpha ( int  alpha = 0xff  )  const

Sets the alpha component for the current color.

Parameters:
alpha Alpha Component. [0-255].

void Annchienta::VideoManager::setClearColor ( int  red = 0xff,
int  green = 0xff,
int  blue = 0xff,
int  alpha = 0xff 
) const

Sets the color used for clearing the screen with.

Parameters:
red Red component of clearing color. [0-255].
green Green component of clearing color. [0-255].
blue Blue component of clearing color. [0-255].
alpha Alpha component of clearing color. [0-255].

void Annchienta::VideoManager::setClippingRectangle ( int  x1,
int  y1,
int  x2,
int  y2 
) const

Sets clipping rectangle. This means all drawing, from now on, will be clipped to the rectangle specified.

Parameters:
x1 Top left x coord of the rectangle.
y1 Top left y coord of the rectangle.
x2 Bottom right x coord of the rectangle.
y2 Bottom right y coord of the rectangle.
Warning:
Matrix transformations do not apply to this.

void Annchienta::VideoManager::setColor ( int  red = 0xff,
int  green = 0xff,
int  blue = 0xff,
int  alpha = 0xff 
) const

Sets the color used for all drawing of primitives and text. This color gets applied to a Surface too. When you want to draw a Surface in it's regular color, set the color to white.

Parameters:
red Red component of clearing color. [0-255].
green Green component of clearing color. [0-255].
blue Blue component of clearing color. [0-255].
alpha Alpha component of clearing color. [0-255].

void Annchienta::VideoManager::setVideoMode ( int  w,
int  h,
const char *  title = "Annchienta RPG Engine",
bool  fullScreen = false,
int  videoScale = 1 
)

Sets the video mode. Use this before doing any drawing operations.

Parameters:
w Width for the screen.
h Height for the screen.
title Caption to be used for the window.
fullScreen Should the game run in fullscreen mode? (Might not always work with all resolutions.)
videoScale Defaults to 1, choose a higher number to get a larger screen.

void Annchienta::VideoManager::storeBuffer ( int  slot  ) 

Saves the current buffer to a slot. There are certainly 8 slots, so [0-7] can be used. I advise however to use [1-7] exclusively because slot 0 is sometimes internally used. You can use getNumberOfBackBuffers() to determine the exact number of slots.

Parameters:
slot Slot to save to.

void Annchienta::VideoManager::translate ( float  x,
float  y 
) const

Multiply the current matrix with a translation matrix.

Parameters:
x X translation distance.
y Y translation distance.


Member Data Documentation

const int Annchienta::VideoManager::numberOfBackBuffers = 8 [static, private]


Generated on Wed Feb 4 16:31:47 2009 for Annchienta by  doxygen 1.5.7.1