#include <PhExtendedBackground.h>
Public Member Functions | |
PhExtendedBackground (PhSceneManager *s, PhTexture *t, PhColor c=PhColor(255, 255, 255, 255), float d=-100.0f, bool xt=true, bool yt=true, PhVector2d sp=PhVector2d(0.0f, 0.0f), PhVector2d po=PhVector2d(0.0f, 0.0f), PhVector2d o=PhVector2d(0.0f, 0.0f)) | |
Constuctor. | |
void | setColor (PhColor c) |
Set color function. | |
PhColor | getColor () |
Get color function. | |
void | setTexture (PhTexture *t) |
Set texture function. | |
PhTexture * | getTexture () |
Get texture function. | |
void | setHorizontalTile (bool b) |
Set horizontal tile. | |
void | setVerticalTile (bool b) |
Set vertical tile. | |
void | setPosition (PhVector2d v) |
Set position. | |
PhVector2d | getPosition () |
Get position. | |
void | setTextureOffset (PhVector2d v) |
Set texture offset. | |
PhVector2d | getTextureOffset () |
Get texture offset. | |
void | setScrollSpeed (PhVector2d v) |
Set scroll speed. | |
PhVector2d | getScrollSpeed () |
Get scroll speed. | |
void | onPreRender () |
Pre-render call. | |
void | onRender () |
Render call. | |
void | onPostRender () |
Post-render call. |
This is the extended background class. This is the most advanced background class included with phoenix. Extended background allow for the most control over the background. It provides the ability to change the texture, color, depth, horizontal tile, vertical tile, scroll speed, relative position, and texture offset of a background.
phoenix::PhExtendedBackground::PhExtendedBackground | ( | PhSceneManager * | s, | |
PhTexture * | t, | |||
PhColor | c = PhColor(255, 255, 255, 255) , |
|||
float | d = -100.0f , |
|||
bool | xt = true , |
|||
bool | yt = true , |
|||
PhVector2d | sp = PhVector2d(0.0f, 0.0f) , |
|||
PhVector2d | po = PhVector2d(0.0f, 0.0f) , |
|||
PhVector2d | o = PhVector2d(0.0f, 0.0f) | |||
) |
Constuctor.
s | Pointer to the scenemanager. | |
t | Texture to use. | |
c | Color to use. Default white. | |
d | Depth. Default -100.0f. | |
xt | Horizontal tile. Default true. | |
yt | Vertical tile. Default true. | |
sp | Scroll speed. Defualt [0,0]. | |
po | Relative position of the bg. Default [0,0]. | |
o | Texture offset. Default [0,0]. |
void phoenix::PhExtendedBackground::setColor | ( | PhColor | c | ) |
Set color function.
Sets the color used to colorize the texture.
c | The new color. |
PhColor phoenix::PhExtendedBackground::getColor | ( | ) |
Get color function.
Get the current color used to colorize the texture.
void phoenix::PhExtendedBackground::setTexture | ( | PhTexture * | t | ) |
Set texture function.
Sets the texture used by this node.
t | The new texture. |
PhTexture* phoenix::PhExtendedBackground::getTexture | ( | ) |
Get texture function.
Gets the current texture used by this node.
void phoenix::PhExtendedBackground::setHorizontalTile | ( | bool | b | ) |
Set horizontal tile.
Sets whether of not to tile this background horizontally.
b | Tile boolean. |
void phoenix::PhExtendedBackground::setVerticalTile | ( | bool | b | ) |
Set vertical tile.
Sets whether of not to tile this background vertically.
b | Tile boolean. |
void phoenix::PhExtendedBackground::setPosition | ( | PhVector2d | v | ) |
Set position.
Sets the position of this background.
v | New position. |
PhVector2d phoenix::PhExtendedBackground::getPosition | ( | ) |
Get position.
void phoenix::PhExtendedBackground::setTextureOffset | ( | PhVector2d | v | ) |
Set texture offset.
Sets the texture offset of the background. The texture offset is a normalized value and simply modifies The texture coords of the background. Can be use to achieve effects such as paralax and scrolling backgrounds.
v | The new texture offset. |
PhVector2d phoenix::PhExtendedBackground::getTextureOffset | ( | ) |
void phoenix::PhExtendedBackground::setScrollSpeed | ( | PhVector2d | v | ) |
Set scroll speed.
Using scroll speed the background will automatically change its texture offset every frame, creating the illusion of moving backgrounds.
v | The new speed; |
PhVector2d phoenix::PhExtendedBackground::getScrollSpeed | ( | ) |
void phoenix::PhExtendedBackground::onPreRender | ( | ) | [virtual] |
Pre-render call.
All nodes in the list will have this function called by the scenemanger once per frame. Overloading this is required. If the scene node wants to be drawn it must call phoenix::PhSceneManger::registerForRendering().
Reimplemented from phoenix::PhSceneNode.
void phoenix::PhExtendedBackground::onRender | ( | ) | [virtual] |
Render call.
Any nodes that called phoenix::PhSceneManger::registerForRendering() will first be sorted according to their depth, then this function is called for each node in order. It is highly suggested that you put any drawing code in this function. Of course, it's possible to draw during any of the three node passes, but this pass is the only one that is exclusive (Nodes must register) and is the only one that is depth sorted.
Reimplemented from phoenix::PhSceneNode.
void phoenix::PhExtendedBackground::onPostRender | ( | ) | [virtual] |
Post-render call.
The third render pass takes place at the end of every frame, the scene manager calls this function for every node in the list, and any code that should happen after everything is drawn should go here.
Reimplemented from phoenix::PhSceneNode.