phoenix::PhRenderSystem Class Reference

The render system. More...

#include <PhRenderSystem.h>

List of all members.

Public Member Functions

 PhRenderSystem ()
 Construct.
 ~PhRenderSystem ()
 Destruct.
void setWindowCaption (std::string str)
 Set window caption.
bool run ()
 Run.
float getFPS ()
 Get frames per second.
int getTicks ()
 Get ticks.
bool initSystem (PhVector2d sc=PhVector2d(640, 480))
 Init system.
PhVector2d getScreenSize ()
 Get screen size.
PhTextureloadTexture (std::string filename, bool linear=false)
 Load texture.
void PhRenderSystem::drawIndexedTriangleList (GLfloat *vertices, GLfloat *normals, GLfloat *tcoords, GLuint *colors, GLuint *indexlist, int tricount)
 Draw indexed trangle list.
void drawRectangle (PhRect r=PhRect(0, 0, 0, 0), float depth=0.0f, PhColor a=PhColor(255, 255, 255), PhColor b=PhColor(255, 255, 255), PhColor c=PhColor(255, 255, 255), PhColor d=PhColor(255, 255, 255))
 Draw rectangle.
void drawPolygon (PhPolygon P, float depth=0.0f, PhColor a=PhColor(255, 255, 255))
 Draws a polygon.
void drawVector (PhVector2d origin, PhVector2d vect)
 Draw vector.
void drawVector2 (PhVector2d origin, PhVector2d vect)
 Draw vector 2.
void drawTexture (PhTexture *source, PhVector2d pos, float depth=0.0f, float rot=0.0f, float scale=1.0f, PhColor color=PhColor(255, 255, 255), bool flip=false)
 Draw texture.
void drawTexturePart (PhTexture *source, PhVector2d pos, PhRect rect, float depth=0.0f, float rot=0.0f, float scale=1.0f, PhColor color=PhColor(255, 255, 255), bool flip=false)
 Draw texture part.
void drawText (std::string text, PhVector2d pos, PhColor color=PhColor(255, 255, 255), float depth=0.0f)
 Draw text.
void setFont (PhTexture *t)
 Set font.
PhTexturegetFont ()
 Get font.
PhEventHandlergetEventHandler ()
 Get event handler.
PhTextureManagergetTextureManager ()
 Get texture manager.


Detailed Description

The render system.

This is the heart of phoenix. On the basic level it provides a layer over OpenGL. It also provides many facilities needed for 2D games.


Member Function Documentation

void phoenix::PhRenderSystem::setWindowCaption ( std::string  str  ) 

Set window caption.

Parameters:
str The new caption of the window.

bool phoenix::PhRenderSystem::run (  ) 

Run.

This is one of the required functions of the render system. This should be called before all drawing functions and should be called once per frame. (perferably in a while loop).

float phoenix::PhRenderSystem::getFPS (  ) 

Get frames per second.

Returns:
The average FPS over the total run time of the program.

int phoenix::PhRenderSystem::getTicks (  ) 

Get ticks.

Returns:
The number of ticks (ms) that have occured since the engine started.

bool phoenix::PhRenderSystem::initSystem ( PhVector2d  sc = PhVector2d(640, 480)  ) 

Init system.

Sets up everything needed by the render system. This should be called at the beginning of this program and is required to use any of the render system's functions.

Parameters:
sc The size of the screen (defualt 640,480).

PhVector2d phoenix::PhRenderSystem::getScreenSize (  ) 

Get screen size.

Returns:
The size of the screen.

PhTexture* phoenix::PhRenderSystem::loadTexture ( std::string  filename,
bool  linear = false 
)

Load texture.

Loads an image as a and adds it to the texture manager for garbage collection. Currently on RGBA .png files are supported. DevIL implementation is planned, no other file formats will be officially supported until then.

Parameters:
filename The filename of the image to load.
linear Tells the loader to use linear filtering or not. (default false).

void phoenix::PhRenderSystem::PhRenderSystem::drawIndexedTriangleList ( GLfloat *  vertices,
GLfloat *  normals,
GLfloat *  tcoords,
GLuint *  colors,
GLuint *  indexlist,
int  tricount 
)

Draw indexed trangle list.

Provides the ability to quickly draw an indexed triangle list to OpenGL.

Parameters:
vertices The list of vertices in the triangle list.
normals The list of normals for each vertex (this is usually just <0,0,1>).
tcoords The list of texture coords for each vertex.
colors The list of colors for each vertex.
indexlist The list of each vertex that makes up each triangle.
tricount The number of trangles.
Todo:
Add drawIndexedTriangleFan()

void phoenix::PhRenderSystem::drawRectangle ( PhRect  r = PhRect(0, 0, 0, 0),
float  depth = 0.0f,
PhColor  a = PhColor(255, 255, 255),
PhColor  b = PhColor(255, 255, 255),
PhColor  c = PhColor(255, 255, 255),
PhColor  d = PhColor(255, 255, 255) 
)

Draw rectangle.

Draws a rectangle with a color for each corner.

Parameters:
r The rectangle to be drawn.
depth The depth of the rectangle.
a Color of the top-left corner.
b Color of the top-right corner.
c Color of the bottom-right corner.
d Color of the bottom-left corner.

void phoenix::PhRenderSystem::drawPolygon ( PhPolygon  P,
float  depth = 0.0f,
PhColor  a = PhColor(255, 255, 255) 
)

Draws a polygon.

Simply draws a polygon with the given depth and color.

Parameters:
P Polygon to draw.
depth Depth to draw it at.
a Color to draw it with.

void phoenix::PhRenderSystem::drawVector ( PhVector2d  origin,
PhVector2d  vect 
)

Draw vector.

Draws the given vector starting from the origin.

Parameters:
origin The place to start from.
vect The vector to draw.
Note:
You must set an active color before calling this function.
See also:
drawVector2()

void phoenix::PhRenderSystem::drawVector2 ( PhVector2d  origin,
PhVector2d  vect 
)

Draw vector 2.

Draws a line from origin to vect.

Parameters:
origin The place to start from.
vect The place to end.
Note:
You must set an active color before calling this function.
See also:
drawVector()

void phoenix::PhRenderSystem::drawTexture ( PhTexture source,
PhVector2d  pos,
float  depth = 0.0f,
float  rot = 0.0f,
float  scale = 1.0f,
PhColor  color = PhColor(255, 255, 255),
bool  flip = false 
)

Draw texture.

Parameters:
source The texture to draw.
pos Where to draw it at.
depth The depth to draw it at.
rot Rotation (in degrees).
scale Scale.
color Color.
flip If true, flip horizontally.
See also:
drawTexturePart()

void phoenix::PhRenderSystem::drawTexturePart ( PhTexture source,
PhVector2d  pos,
PhRect  rect,
float  depth = 0.0f,
float  rot = 0.0f,
float  scale = 1.0f,
PhColor  color = PhColor(255, 255, 255),
bool  flip = false 
)

Draw texture part.

Draws a texture with a clipping rectangle.

Parameters:
source The texture to draw.
pos Where to draw it at.
rect The clipping rectangle.
depth The depth to draw it at.
rot Rotation (in degrees).
scale Scale.
color Color.
flip If true, flip horizontally.
See also:
drawTexture()

void phoenix::PhRenderSystem::drawText ( std::string  text,
PhVector2d  pos,
PhColor  color = PhColor(255, 255, 255),
float  depth = 0.0f 
)

Draw text.

Draws a texture using the current font.

Parameters:
text The text to draw.
pos Where to draw it at.
color The color of the font.
depth The depth to draw it at.
See also:
loadFont()

void phoenix::PhRenderSystem::setFont ( PhTexture t  ) 

Set font.

Sets the font to the given texture.

Parameters:
t The new font.
See also:
getFont()

PhTexture* phoenix::PhRenderSystem::getFont (  ) 

Get font.

Returns:
The current textured used as a font.
See also:
setFont()

PhEventHandler* phoenix::PhRenderSystem::getEventHandler (  ) 

Get event handler.

Returns:
A pointer to the event handler used by the system.

PhTextureManager* phoenix::PhRenderSystem::getTextureManager (  ) 

Get texture manager.

Returns:
A pointer to the texture manager.


The documentation for this class was generated from the following file:
Generated on Tue Nov 20 21:59:24 2007 for Phoenix by  doxygen 1.5.4