Neo  0.5.0
Developer Documentation
Neo2D::Neo2DEngine Class Reference

The Neo2DEngine class contains all functionality to set up a GUI. More...

#include <Neo2DEngine.h>

Public Member Functions

 Neo2DEngine ()
 
 ~Neo2DEngine ()
 
FontRefloadFont (const char *filename, unsigned int fontsize)
 
TextureRefloadTexture (const char *filename, const bool mipmap=true, const bool preload=true)
 
const char * getThemeDirectory ()
 
const char * getThemeBorderH ()
 
const char * getThemeBorderV ()
 
const char * getThemeBody ()
 
const char * getThemeEdge ()
 
const char * getThemeBorderHHover ()
 
const char * getThemeBorderVHover ()
 
const char * getThemeBodyHover ()
 
const char * getThemeEdgeHover ()
 
const char * getThemeBorderHPressed ()
 
const char * getThemeBorderVPressed ()
 
const char * getThemeBodyPressed ()
 
const char * getThemeEdgePressed ()
 
void setThemeDirectory (const char *dir)
 Changes the current GUI theme. This change only applies to newly created widgets, all existing ones will keep using the previously selected theme. More...
 
void setupLuaInterface (ScriptContext *script)
 Registers all script functions to the given context. More...
 
void setEnabled (bool enabled)
 Enables or disables the GUI. More...
 
void draw ()
 Draws all Canvases in the order the are layered in. More...
 
void update ()
 Updates all Canvases. More...
 
const char * getDefaultFont ()
 Returns the default font. More...
 
float getDefaultFontSize ()
 Returns the default font size. More...
 
void setDefaultFontSize (float s)
 Changes the default font size. More...
 
Vector4 getNormalBackground ()
 Returns the normal background color. More...
 
Vector4 getHoverBackground ()
 Returns the hover background color. More...
 
Vector4 getHighlightBackground ()
 Returns the highlight color. More...
 
void setNormalBackground (Vector4 color)
 Changes the normal background color. More...
 
void setHoverBackground (Vector4 color)
 Changes the hover background color. More...
 
void setHighlightBackground (Vector4 color)
 Changes the highlight background color. More...
 
WidgetgetWidget (unsigned int idx)
 Retrieves a registered widget using its handle. More...
 
 DISOWN (Widget *w) int addWidget(Widget *w)
 Adds a widget to the internal list. More...
 
size_t getNumWidgets ()
 Returns the number of registered widgets. More...
 
 DISOWN (Canvas *c) void addCanvas(Canvas *c)
 Adds a new Canvas to the update list. More...
 
CanvasgetCanvas (unsigned int i)
 Returns the Canvas with the given index. More...
 
void updateLayers ()
 Sorts all Canvases to match the priority hierarchy defined by the layer mechanism. More...
 
void destroyWidget (int id)
 Destroys the widget with the given handle. More...
 
void clear ()
 Deletes all widgets and canvases except the main canvas. More...
 
void scheduleClear ()
 
bool isMouseOnGui ()
 

Static Public Member Functions

static Neo2DEnginegetInstance ()
 Returns a global instance of the GuiSystem. More...
 

Detailed Description

The Neo2DEngine class contains all functionality to set up a GUI.

Author
Yannick Pflanzer

Constructor & Destructor Documentation

Neo2D::Neo2DEngine::Neo2DEngine ( )
Neo2D::Neo2DEngine::~Neo2DEngine ( )

Member Function Documentation

void Neo2D::Neo2DEngine::clear ( )

Deletes all widgets and canvases except the main canvas.

void Neo2D::Neo2DEngine::destroyWidget ( int  id)

Destroys the widget with the given handle.

Parameters
idThe handle.
Neo2D::Neo2DEngine::DISOWN ( Widget w)

Adds a widget to the internal list.

Parameters
Thenew widget.
Returns
The handle of the widget.
Neo2D::Neo2DEngine::DISOWN ( Canvas c)

Adds a new Canvas to the update list.

Parameters
cThe new Canvas.
void Neo2D::Neo2DEngine::draw ( )

Draws all Canvases in the order the are layered in.

Canvas* Neo2D::Neo2DEngine::getCanvas ( unsigned int  i)
inline

Returns the Canvas with the given index.

Parameters
iThe index.
Returns
The Canvas.
const char* Neo2D::Neo2DEngine::getDefaultFont ( )
inline

Returns the default font.

Returns
The default font.
float Neo2D::Neo2DEngine::getDefaultFontSize ( )
inline

Returns the default font size.

Returns
The default font size.
Vector4 Neo2D::Neo2DEngine::getHighlightBackground ( )
inline

Returns the highlight color.

Returns
The highlight background.
Vector4 Neo2D::Neo2DEngine::getHoverBackground ( )
inline

Returns the hover background color.

Returns
The hover background.
static Neo2DEngine* Neo2D::Neo2DEngine::getInstance ( )
static

Returns a global instance of the GuiSystem.

Returns
The global GuiSystem.
Vector4 Neo2D::Neo2DEngine::getNormalBackground ( )
inline

Returns the normal background color.

Returns
The normal background.
size_t Neo2D::Neo2DEngine::getNumWidgets ( )
inline

Returns the number of registered widgets.

Returns
The number of widgets.
const char* Neo2D::Neo2DEngine::getThemeBody ( )
inline
const char* Neo2D::Neo2DEngine::getThemeBodyHover ( )
inline
const char* Neo2D::Neo2DEngine::getThemeBodyPressed ( )
inline
const char* Neo2D::Neo2DEngine::getThemeBorderH ( )
inline
const char* Neo2D::Neo2DEngine::getThemeBorderHHover ( )
inline
const char* Neo2D::Neo2DEngine::getThemeBorderHPressed ( )
inline
const char* Neo2D::Neo2DEngine::getThemeBorderV ( )
inline
const char* Neo2D::Neo2DEngine::getThemeBorderVHover ( )
inline
const char* Neo2D::Neo2DEngine::getThemeBorderVPressed ( )
inline
const char* Neo2D::Neo2DEngine::getThemeDirectory ( )
inline
const char* Neo2D::Neo2DEngine::getThemeEdge ( )
inline
const char* Neo2D::Neo2DEngine::getThemeEdgeHover ( )
inline
const char* Neo2D::Neo2DEngine::getThemeEdgePressed ( )
inline
Widget* Neo2D::Neo2DEngine::getWidget ( unsigned int  idx)

Retrieves a registered widget using its handle.

Parameters
idxThe handle of the widget.
Returns
The widget.
bool Neo2D::Neo2DEngine::isMouseOnGui ( )
FontRef* Neo2D::Neo2DEngine::loadFont ( const char *  filename,
unsigned int  fontsize 
)
TextureRef* Neo2D::Neo2DEngine::loadTexture ( const char *  filename,
const bool  mipmap = true,
const bool  preload = true 
)
void Neo2D::Neo2DEngine::scheduleClear ( )
inline
void Neo2D::Neo2DEngine::setDefaultFontSize ( float  s)
inline

Changes the default font size.

Parameters
sThe default font size.
void Neo2D::Neo2DEngine::setEnabled ( bool  enabled)
inline

Enables or disables the GUI.

Parameters
Aboolean.
void Neo2D::Neo2DEngine::setHighlightBackground ( Vector4  color)
inline

Changes the highlight background color.

Parameters
colorThe highlight background.
void Neo2D::Neo2DEngine::setHoverBackground ( Vector4  color)
inline

Changes the hover background color.

Parameters
colorThe hover background.
void Neo2D::Neo2DEngine::setNormalBackground ( Vector4  color)
inline

Changes the normal background color.

Parameters
colorThe normal background.
void Neo2D::Neo2DEngine::setThemeDirectory ( const char *  dir)

Changes the current GUI theme. This change only applies to newly created widgets, all existing ones will keep using the previously selected theme.

Following fils are required: "/body.png", "/edge.png", "/borderh.png", "/borderv.png", "/body-hover.png", "/edge-hover.png", "/borderh-hover.png", "/borderv-hover.png", "/body-pressed.png", "/edge-pressed.png", "/borderh-pressed.png", "/borderv-pressed.png"

Parameters
dirThe directory containing the theme files.
void Neo2D::Neo2DEngine::setupLuaInterface ( ScriptContext script)

Registers all script functions to the given context.

Parameters
scriptThe script interface to register to.
void Neo2D::Neo2DEngine::update ( )

Updates all Canvases.

void Neo2D::Neo2DEngine::updateLayers ( )

Sorts all Canvases to match the priority hierarchy defined by the layer mechanism.


The documentation for this class was generated from the following file: