Tucano  0.1
A library for rapid prototyping with modern OpenGL and GLSL
label.hpp
Go to the documentation of this file.
1 
23 #ifndef __LABEL__
24 #define __LABEL__
25 
26 #include <tucano/shapes/quad.hpp>
27 #include <tucano/gui/element.hpp>
28 #include <Eigen/Dense>
29 
30 namespace Tucano
31 {
32 
33 namespace GUI
34 {
35 
40 class Label : public Element {
41 
42 protected:
43 
45  Eigen::Vector4f color;
46 
47  public:
48 
52  Label (void)
53  {
55  num_params = 0;
56  }
57 
64  Label (int x, int y, string texture)
65  {
66  Label();
67  position << x, y;
68  setTexture (texture);
69  }
70 
71 
72  int getType (void)
73  {
74  return Tucano::GUI::LABEL;
75  }
76 
81  void setTexture (string file)
82  {
84  texture.setTexParameters( GL_REPEAT, GL_REPEAT, GL_LINEAR, GL_LINEAR );
85 
88  }
89 
94  void setColor (const Eigen::Vector4f& c)
95  {
96  color = c;
97  }
98 
99 };
100 }
101 }
102 #endif
Eigen::Vector2i dimensions
Dimensions in pixels.
Definition: element.hpp:66
Eigen::Vector2i position
Position of top-left corner in pixels.
Definition: element.hpp:69
Base class for all GUI elements (buttons, sliders ...)
Definition: element.hpp:52
int getType(void)
Returns the element type.
Definition: label.hpp:72
void setTexture(string file)
Loads the label texture file.
Definition: label.hpp:81
virtual void setModelMatrix(void)
Sets the element model matrix.
Definition: element.hpp:195
Tucano::Texture texture
Element texture.
Definition: element.hpp:75
Definition: bufferobject.hpp:34
void setColor(const Eigen::Vector4f &c)
Sets the label color.
Definition: label.hpp:94
static bool loadImage(string filename, Tucano::Texture *tex) __attribute__((unused))
Definition: imageIO.hpp:45
Label(void)
Default constructor.
Definition: label.hpp:52
void setTexParameters(GLenum wraps=GL_CLAMP, GLenum wrapt=GL_CLAMP, GLenum magfilter=GL_NEAREST, GLenum minfilter=GL_NEAREST)
Deletes the texture.
Definition: texture.hpp:221
int getWidth(void)
Returns the texture width.
Definition: texture.hpp:102
A simple label to hold text or similar it has no callbacks, it is just a placeholder for rendering a ...
Definition: label.hpp:40
Eigen::Vector4f color
Color.
Definition: label.hpp:45
int num_params
Number of parameters for the callback.
Definition: element.hpp:60
Definition: element.hpp:42
int getHeight(void)
Returns the texture height.
Definition: texture.hpp:111
int element_type
Type of element.
Definition: element.hpp:57
Label(int x, int y, string texture)
Overload constructor that receives position and texture file.
Definition: label.hpp:64