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 &, Rgb, Vec2 position)
 
void drawSelf (jngl::Mat3) const override
 Override this function to draw the widget.
 
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.
 
virtual void draw () const
 Draws the widget with all effects applied.
 
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.
 

Additional Inherited Members

- Public Types inherited from Widget
enum class  Action : uint8_t { 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 ( jngl::Mat3 modelview) 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: