Nymph Game Engine
Chaiscript based Game Engine
|
Class for text. More...
#include <text.h>
Public Member Functions | |
Text () | |
Constructor for Text. More... | |
void | setFont (const std::shared_ptr< Font > font) |
Sets the font. More... | |
virtual void | setText (const std::string &text) |
Sets the text string. More... | |
std::string | getText () const noexcept |
Gets the text string. More... | |
void | setColor (const glm::vec4 &color) |
Sets the color. More... | |
glm::vec4 | getColor () const noexcept |
Gets the color. More... | |
void | setShader (std::shared_ptr< Shader > shader) |
Sets the shader. More... | |
void | setKerning (const float amount) noexcept |
Sets the kerning. More... | |
float | getKerning () const noexcept |
Gets the kerning. More... | |
std::string | to_string () const noexcept |
Returns a string representation of the object. More... | |
virtual std::string | className () const noexceptoverride |
Returns a string representing the class name. More... | |
virtual void | onDestroy () override |
Called when the engine is shutting down. More... | |
virtual void | onStart () override |
Called when the engine starts and when a new scene is loaded. More... | |
virtual bool | onUpdate (const double delta) override |
Called every engine loop. More... | |
void | handleQueuedEvent (std::shared_ptr< Events::Event > event) override |
HandleQueuedEvent allows derived classes to define behaviour for when queuedEvents are received. More... | |
void | onNotifyNow (std::shared_ptr< Events::Event > event) override |
When receiving an event that is immediate, onNotifyNow is used. It acts as an interrupt to make sure the object is notified before another engine loop. This is pure virtual and is implemented on a case by case basis in derived classes. More... | |
virtual unsigned long long | getValueForSorting () const noexceptoverride |
Gets the value for sorting. More... | |
virtual void | log (el::base::type::ostream_t &os) const |
Public Member Functions inherited from Component | |
Component () | |
Component constructor. More... | |
void | setTransform (std::shared_ptr< Transform > transform) |
Sets the transform. More... | |
std::shared_ptr< Transform > | getTransform () const noexcept |
Gets the transform. More... | |
void | setActive (const bool active) noexcept |
Sets the component active or inactive. More... | |
bool | isActive () const noexcept |
Determines if active. More... | |
unsigned int | getId () const noexcept |
Gets the identifier. More... | |
bool | operator< (Component &other) noexcept |
Operator < using getValueForSorting. More... | |
virtual | ~Component () |
Destroys the object. More... | |
Public Member Functions inherited from Events::Subject | |
virtual | ~Subject ()=default |
virtual void | notify (std::shared_ptr< Event > event) |
notify is used to tell observers of an event. More... | |
virtual void | notifyNow (std::shared_ptr< Event > event) |
notifyNow is used to tell observers of an event as an interrupt. More... | |
virtual void | addObserver (std::shared_ptr< Observer > observer) |
Adds an observer. More... | |
virtual void | removeObserver (std::shared_ptr< Observer > observer) |
Removes an observer. More... | |
Public Member Functions inherited from Events::Observer | |
virtual | ~Observer () |
void | onNotify (std::shared_ptr< Event > event) |
When receiving an event that is non-immediate, onNotify is used. The event is added to the event queue that is processed when processEventQueue is called. More... | |
void | processEventQueue () |
This should be called once ever loop for every Observer to properly use queued events. More... | |
Protected Member Functions | |
void | renderCharacter (const unsigned char character, Transform transform) |
Protected Member Functions inherited from Events::Observer | |
std::shared_ptr< Event > | getEvent () |
bool | eventsWaiting () const noexcept |
Protected Attributes | |
std::shared_ptr< Font > | font |
std::string | text |
glm::vec4 | color |
std::shared_ptr< Shader > | shader |
float | kerning |
Protected Attributes inherited from Component | |
std::weak_ptr< Entity > | entity |
std::shared_ptr< Transform > | transform |
bool | active |
unsigned int | id |
Additional Inherited Members | |
Static Protected Attributes inherited from Component | |
static unsigned int | next_id = 0 |
Class for text.
Graphics::UI::Text::Text | ( | ) |
Constructor for Text.
|
overridevirtualnoexcept |
Returns a string representing the class name.
Reimplemented from Component.
Reimplemented in Graphics::UI::WrappableText.
Referenced by generated::getTextModule().
|
noexcept |
|
noexcept |
|
noexcept |
Gets the text string.
References text.
Referenced by generated::getTextModule().
|
overridevirtualnoexcept |
Gets the value for sorting.
Implements Component.
References Component::getTransform().
|
overridevirtual |
HandleQueuedEvent allows derived classes to define behaviour for when queuedEvents are received.
[in] | event | The event |
Reimplemented from Component.
Reimplemented in Graphics::UI::WrappableText.
References Component::handleQueuedEvent().
Referenced by onNotifyNow().
|
virtual |
|
overridevirtual |
Called when the engine is shutting down.
Implements Component.
Reimplemented in Graphics::UI::WrappableText.
|
overridevirtual |
When receiving an event that is immediate, onNotifyNow is used. It acts as an interrupt to make sure the object is notified before another engine loop. This is pure virtual and is implemented on a case by case basis in derived classes.
[in] | event | The event |
Reimplemented from Component.
Reimplemented in Graphics::UI::WrappableText.
References handleQueuedEvent().
|
overridevirtual |
Called when the engine starts and when a new scene is loaded.
Implements Component.
Reimplemented in Graphics::UI::WrappableText.
|
overridevirtual |
Called every engine loop.
[in] | delta | The delta |
Implements Component.
Reimplemented in Graphics::UI::WrappableText.
References color, font, Component::getTransform(), Component::isActive(), kerning, renderCharacter(), Graphics::Uniform::setData(), shader, and text.
|
protected |
References font, Transform::getAbsoluteTransformationMatrix(), Component::getTransform(), Graphics::Uniform::setData(), and shader.
Referenced by Graphics::UI::WrappableText::onUpdate(), and onUpdate().
void Graphics::UI::Text::setColor | ( | const glm::vec4 & | color | ) |
Sets the color.
[in] | color | The color |
References color.
Referenced by generated::getTextModule().
void Graphics::UI::Text::setFont | ( | const std::shared_ptr< Font > | font | ) |
Sets the font.
[in] | font | The font |
References font.
Referenced by generated::getTextModule().
|
noexcept |
void Graphics::UI::Text::setShader | ( | std::shared_ptr< Shader > | shader | ) |
Sets the shader.
[in] | shader | The shader |
References shader.
Referenced by generated::getTextModule().
|
virtual |
Sets the text string.
[in] | text | The text string |
Reimplemented in Graphics::UI::WrappableText.
References text.
Referenced by generated::getTextModule().
|
virtualnoexcept |
Returns a string representation of the object.
Reimplemented from Component.
Reimplemented in Graphics::UI::WrappableText.
References color, kerning, text, and Component::to_string().
Referenced by generated::getTextModule(), log(), and Graphics::UI::WrappableText::to_string().
|
protected |
Referenced by getColor(), Graphics::UI::WrappableText::onUpdate(), onUpdate(), setColor(), and to_string().
|
protected |
|
protected |
|
protected |
Referenced by Graphics::UI::WrappableText::onUpdate(), onUpdate(), renderCharacter(), and setShader().
|
protected |