JNGL
Easy to use cross-platform 2D game library
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
Label Class Reference

Simple Widget displaying a line of text. More...

#include <jngl/Label.hpp>

Public Member Functions

 Label (const std::string &str, Font &, Color, Vec2 position)
 
void drawSelf () const override
 Override this function to draw the widget. More...
 
void setAlpha (float alpha)
 Set font color alpha from 0...1.
 
void setAlign (Alignment)
 How to align the label's text, default is CENTER.
 
float getWidth () const
 Returns the width of the underlying jngl::TextLine.
 
- Public Member Functions inherited from Widget
 Widget (jngl::Vec2 position)
 Creates a Widget centered at position.
 
virtual Action step ()
 Steps all Effects. More...
 
virtual void draw () const
 Draws the widget with all effects applied.
 
virtual void drawSelf () const =0
 Override this function to draw the widget. More...
 
void addEffect (std::unique_ptr< Effect >)
 
template<class T , class... Args>
void addEffect (Args &&... args)
 
void removeEffect (Effect *)
 
virtual void removeEffects ()
 Removes all effects.
 
jngl::Vec2 getPosition () const
 Returns the center.
 

Protected Attributes

float alpha = 1.f
 
- Protected Attributes inherited from Widget
jngl::Vec2 position
 Center. More...
 

Additional Inherited Members

- Public Types inherited from Widget
enum class  Action { NONE , REMOVE , REQUEST_FOCUS }
 

Detailed Description

Simple Widget displaying a line of text.

Definition at line 15 of file Label.hpp.

Inheritance diagram for Label:
[legend]
Collaboration diagram for Label:
[legend]

Member Function Documentation

◆ drawSelf()

void drawSelf ( ) const
overridevirtual

Override this function to draw the widget.

Implements Widget.

Member Data Documentation

◆ alpha

float alpha = 1.f
protected

Definition at line 31 of file Label.hpp.


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