Tucano  0.1
A library for rapid prototyping with modern OpenGL and GLSL
Tucano::GUI::Base Class Reference

Base class for GUI, contains all elements and handles viewport and rendering transformations. More...

#include <base.hpp>

Public Member Functions

 Base (void)
 Default constructor. More...
 
void add (Element *el)
 Adds an element to the gui. More...
 
void setViewportSize (const Eigen::Vector2i &vs)
 Set viewport size. More...
 
void setViewportSize (int w, int h)
 Set viewport size. More...
 
void render (void)
 renders the 2D gui interface More...
 
bool checkClicked (int x, int y, vector< Tucano::GUI::Element * > *list)
 Check if any element in a given list is inside clicked coordinates. More...
 
bool leftButtonPressed (int x, int y)
 Treats mouse left click callback for all elements. More...
 
bool leftButtonReleased (int x, int y)
 Treats mouse left release callback for last clicked element. More...
 
bool cursorMove (int x, int y)
 Treats mouse mouvement. More...
 

Protected Attributes

Eigen::Vector2i viewport_size
 Viewport size. More...
 
Tucano::Camera camera_2d
 2D camera More...
 
Tucano::Shader gui_shader
 Shader for rendering gui elements. More...
 
vector< Tucano::GUI::Element * > elements
 Vector containing gui elements. More...
 
Tucano::GUI::Elementlast_clicked = NULL
 Last clicked element. More...
 

Detailed Description

Base class for GUI, contains all elements and handles viewport and rendering transformations.

Constructor & Destructor Documentation

Tucano::GUI::Base::Base ( void  )
inline

Default constructor.

Member Function Documentation

void Tucano::GUI::Base::add ( Element el)
inline

Adds an element to the gui.

bool Tucano::GUI::Base::checkClicked ( int  x,
int  y,
vector< Tucano::GUI::Element * > *  list 
)
inline

Check if any element in a given list is inside clicked coordinates.

Parameters
xX clicked coordinate
yY clicked coordinate
listElement list
Returns
True if any element was clicked, false otherwise
bool Tucano::GUI::Base::cursorMove ( int  x,
int  y 
)
inline

Treats mouse mouvement.

Parameters
xMouse x position
yMouse y position
Returns
True if any element is selected, false otherwise
bool Tucano::GUI::Base::leftButtonPressed ( int  x,
int  y 
)
inline

Treats mouse left click callback for all elements.

Parameters
xMouse x position
yMouse y position
Returns
True if any gui element was clicked, false otherwise
bool Tucano::GUI::Base::leftButtonReleased ( int  x,
int  y 
)
inline

Treats mouse left release callback for last clicked element.

Parameters
xMouse x position
yMouse y position
Returns
True if any element is selected, false otherwise
void Tucano::GUI::Base::render ( void  )
inline

renders the 2D gui interface

void Tucano::GUI::Base::setViewportSize ( const Eigen::Vector2i &  vs)
inline

Set viewport size.

Parameters
vsViewport size
void Tucano::GUI::Base::setViewportSize ( int  w,
int  h 
)
inline

Set viewport size.

Parameters
wViewport width
hViewport height

Member Data Documentation

Tucano::Camera Tucano::GUI::Base::camera_2d
protected

2D camera

vector< Tucano::GUI::Element* > Tucano::GUI::Base::elements
protected

Vector containing gui elements.

Tucano::Shader Tucano::GUI::Base::gui_shader
protected

Shader for rendering gui elements.

Tucano::GUI::Element* Tucano::GUI::Base::last_clicked = NULL
protected

Last clicked element.

Eigen::Vector2i Tucano::GUI::Base::viewport_size
protected

Viewport size.


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