#include <PhRenderSystem.h>
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. | |
PhTexture * | loadTexture (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. | |
PhTexture * | getFont () |
Get font. | |
PhEventHandler * | getEventHandler () |
Get event handler. | |
PhTextureManager * | getTextureManager () |
Get texture manager. |
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.
void phoenix::PhRenderSystem::setWindowCaption | ( | std::string | str | ) |
Set window caption.
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.
int phoenix::PhRenderSystem::getTicks | ( | ) |
Get ticks.
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.
sc | The size of the screen (defualt 640,480). |
PhVector2d phoenix::PhRenderSystem::getScreenSize | ( | ) |
Get screen size.
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.
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.
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. |
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.
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.
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.
origin | The place to start from. | |
vect | The vector to draw. |
void phoenix::PhRenderSystem::drawVector2 | ( | PhVector2d | origin, | |
PhVector2d | vect | |||
) |
Draw vector 2.
Draws a line from origin to vect.
origin | The place to start from. | |
vect | The place to end. |
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.
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. |
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.
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. |
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.
text | The text to draw. | |
pos | Where to draw it at. | |
color | The color of the font. | |
depth | The depth to draw it at. |
void phoenix::PhRenderSystem::setFont | ( | PhTexture * | t | ) |
PhTexture* phoenix::PhRenderSystem::getFont | ( | ) |
PhEventHandler* phoenix::PhRenderSystem::getEventHandler | ( | ) |
Get event handler.
PhTextureManager* phoenix::PhRenderSystem::getTextureManager | ( | ) |
Get texture manager.