Bubba-3D  0.9.0
Awesome game engine!
Public Types | Public Member Functions | List of all members
Layout Class Referenceabstract

#include <Layout.h>

Inheritance diagram for Layout:
ListLayout PositioningLayout TextLayout

Public Types

enum  ListenerType { ON_CLICK_LISTENER, ON_HOVER_LISTENER }
 
typedef std::function< void(int x, int y, Layout *element, bool enteredElseLeaving)> EventFunction
 

Public Member Functions

virtual std::map< std::string, IHudDrawable * > getGLSquares (float layoutXPos, float layoutYPos, float layoutWidth, float layoutHeight)
 
virtual Dimension getWidth ()=0
 
virtual Dimension getHeight ()=0
 
virtual void getGLSquares (float layoutXPos, float layoutYPos, float layoutWidth, float layoutHeight, std::map< std::string, IHudDrawable * > *map)=0
 
virtual HUDGraphicgetGraphic ()
 
virtual LayoutsetBackground (HUDGraphic *graphic)
 
virtual LayoutsetLayoutId (std::string id)
 

Detailed Description

A layout is an object that is passed to the HudRenderer to render a menu or UI.

Definition at line 33 of file Layout.h.

Member Function Documentation

map< string, IHudDrawable * > Layout::getGLSquares ( float  layoutXPos,
float  layoutYPos,
float  layoutWidth,
float  layoutHeight 
)
virtual

The function to fetch all GLSquares from this layout and its children based on the position and dimensions given. The parent calculates the dimensions and implementing classes must assume that the dimensions are correct. The parent uses getWidth() and getHeight() to determine the dimensions.

This function doesn't need to be overidden but getGLSquares(float layoutXPos, float layoutYPos, float layoutWidth, float layoutHeight, map<string,IHudDrawable*>* list) must be overridden.

Definition at line 34 of file Layout.cpp.

virtual void Layout::getGLSquares ( float  layoutXPos,
float  layoutYPos,
float  layoutWidth,
float  layoutHeight,
std::map< std::string, IHudDrawable * > *  map 
)
pure virtual

The function to fetch all GLSquares from this layout and its children based on the position and dimensions given. The parent calculates the dimensions and implementing classes must assume that the dimensions are correct. The parent uses getWidth() and getHeight() to determine the dimensions.

The overridden method should always call Layout::getGLSquares(float layoutXPos, float layoutYPos, float layoutWidth, float layoutHeight, map<string,IHudDrawable*>* list) before doing anything else. Otherwise Layout::setBackground() won't have an effect.

Implemented in TextLayout, ListLayout, and PositioningLayout.

Layout * Layout::setBackground ( HUDGraphic graphic)
virtual

Sets the background of this Layout.

Definition at line 108 of file Layout.cpp.

Layout * Layout::setLayoutId ( std::string  id)
virtual

Sets the layout id of this layout. This makes it possible to retrieve the layout by HudRenderer::getLayoutById(). You can also get the rendering GLSquare of the background using HudRenderer::getHudDrawableById().

Definition at line 92 of file Layout.cpp.


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