Neo
0.5.0
Developer Documentation
|
The Canvas class contains all widgets and renders them. More...
#include <Canvas.h>
Public Member Functions | |
~Canvas () | |
Canvas () | |
DISOWN (SpriteBatch *b) void addSpriteBatch(SpriteBatch *b) | |
void | draw () |
Draws the Canvas and its contents. More... | |
void | update () |
Updates the Canvas and all its children. More... | |
void | clear () |
Clears the Canvas by removing all children. More... | |
int | getLayer () |
Returns which layer this particular Canvas is at. More... | |
void | setLayer (int nl) |
Sets the on which layer this Canvas will appear. More... | |
void | addWidget (int w) |
Adds a widget to the Canvas. More... | |
Vector4 | getClearColor () |
Returns the clear color of the Canvas. More... | |
void | setClearColor (Vector4 vec) |
Changes the clear color of the Canvas. More... | |
void | enableRenderToTexture (const char *tex) |
Enables render to texture for the Canvas. More... | |
void | enableRenderToTexture () |
Enables the render to texture flag. More... | |
void | disableRenderToTexture () |
Disables the render to texture flag. More... | |
void | setCameraOffset (Vector2 value) |
Sets the camera offset value that emulates a basic 2D camera. More... | |
Vector2 | getCameraOffset () |
Returns the current camera offset. More... | |
Static Public Member Functions | |
static Canvas * | getInstance () |
Returns the global canvas object that directly maps to the screen. More... | |
The Canvas class contains all widgets and renders them.
A canvas contains all widgets, layouts, groups. All elements can be rendered directly to the screen or to a texture.
|
inline |
|
inline |
void Neo2D::Canvas::addWidget | ( | int | w | ) |
void Neo2D::Canvas::clear | ( | ) |
Clears the Canvas by removing all children.
Attention: No objects are deleted from memory!
|
inline |
Disables the render to texture flag.
This is useful to temporarily suspend and resume rendering to a texture when Canvas::enableRenderToTexture(const char* text) was already called.
|
inline |
void Neo2D::Canvas::draw | ( | ) |
Draws the Canvas and its contents.
void Neo2D::Canvas::enableRenderToTexture | ( | const char * | tex | ) |
Enables render to texture for the Canvas.
When render to texture is enabled the canvas will not render directly to the screen anymore. It will draw everything to the specified texture in memory instead which can be used as a widget of some sort or some texture in the game.
Attention: This will not overwrite the texture file on disk! It merely uses it to identify the surface to render to!
tex | The filename of the texture to render to. |
|
inline |
Enables the render to texture flag.
This is useful to temporarily suspend and resume rendering to a texture when Canvas::enableRenderToTexture(const char* text) was already called.
|
inline |
Returns the current camera offset.
|
inline |
Returns the clear color of the Canvas.
|
inlinestatic |
Returns the global canvas object that directly maps to the screen.
|
inline |
Returns which layer this particular Canvas is at.
Canvases are sorted from low to high, meaning that higher values appear in front of lower values.
|
inline |
Sets the camera offset value that emulates a basic 2D camera.
value | The new offset that should be applied. |
|
inline |
Changes the clear color of the Canvas.
vec | The new clear color as RGBA between 0.0f and 1.0f |
|
inline |
Sets the on which layer this Canvas will appear.
Canvases are sorted from low to high, meaning that higher values appear in front of lower values.
nl | The new layer value. |
void Neo2D::Canvas::update | ( | ) |
Updates the Canvas and all its children.