Nymph Game Engine
Chaiscript based Game Engine
|
Class for text area. More...
#include <text_area.h>
Public Member Functions | |
TextArea (std::shared_ptr< WrappableText > text, VertexData vertex_data, std::shared_ptr< Skin > skin, const unsigned int layer) | |
TextArea constructor. More... | |
void | setText (std::shared_ptr< WrappableText > text) |
Sets the text. More... | |
std::shared_ptr< WrappableText > | getText () const noexcept |
Gets the text. More... | |
virtual void | onLeftClick () override |
Called when element is left clicked. More... | |
virtual void | onRightClick () override |
Called when element is right clicked. More... | |
virtual void | onLeftClickRelease () override |
Called when element has left click released over it. More... | |
virtual void | onRightClickRelease () override |
Called when element has right click released over it. More... | |
virtual void | onCursorEnter () override |
Called when the mosue cursor goes over the element. More... | |
virtual void | onCursorLeave () override |
Called when the mouse cursor goes off the element. More... | |
virtual void | onKeyDown (const int key) override |
Called when a key is pressed while element is in focus. More... | |
virtual void | onKeyUp (const int key) override |
Called when a key is released while element is in focus. More... | |
virtual void | onKeyRepeat (const int key) override |
Called when a key is repeated while element is in focus. More... | |
virtual void | onScroll (const glm::dvec2 position_change) override |
Called when the mouse wheel is scrolled while element is in focus. 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... | |
virtual std::string | to_string () const noexceptoverride |
Returns a string representation of the object. More... | |
virtual std::string | className () const noexceptoverride |
Returns a string representing the class name. 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 void | log (el::base::type::ostream_t &os) const |
Public Member Functions inherited from Graphics::UI::Area | |
Area (VertexData vertex_data, std::shared_ptr< Skin > skin, const unsigned int layer) | |
Area constructor. More... | |
Public Member Functions inherited from Graphics::UI::Element | |
Element (VertexData vertex_data, std::shared_ptr< Skin > skin, const unsigned int layer) | |
Element constructor. More... | |
virtual | ~Element () |
Destroys element. More... | |
std::shared_ptr< Skin > | getSkin () const noexcept |
Gets the UI skin. More... | |
void | setSkin (std::shared_ptr< Skin > skin) noexcept |
Sets the UI skin. More... | |
glm::vec2 | getAnchorPoint () const noexcept |
Gets the anchor point. More... | |
void | setAnchorPoint (const glm::vec2 anchor_point) |
Sets the anchor point. More... | |
float | getWidth () const noexcept |
Gets the width. More... | |
float | getHeight () const noexcept |
Gets the height. More... | |
void | setWidth (const float width) noexcept |
Sets the width. More... | |
void | setHeight (const float height) noexcept |
Sets the height. More... | |
float | getTextPadding () const noexcept |
Gets the text padding. More... | |
void | setTextPadding (const float text_padding) noexcept |
Sets the text padding. More... | |
glm::vec4 | getColor () const noexcept |
Gets the color. More... | |
void | setColor (const glm::vec4 color) noexcept |
Sets the color. More... | |
bool | isPointWithin (glm::vec2 point) noexcept |
Determines if point is within element. More... | |
virtual unsigned long long | getValueForSorting () const noexceptoverride |
Gets the value for sorting. More... | |
Public Member Functions inherited from Graphics::Renderable | |
Renderable (const unsigned int vertex_array_object, const VertexData &vertex_data) | |
Renderable constructor. More... | |
Renderable (const Renderable &)=delete | |
Renderable | operator= (Renderable &)=delete |
Renderable (Renderable &&renderable) | |
Renderable & | operator= (Renderable &&renderable) |
virtual | ~Renderable () |
void | setShader (std::shared_ptr< Shader > shader_object) noexcept |
Sets the shader. More... | |
std::shared_ptr< Shader > | getShader () const noexcept |
Gets the shader. More... | |
void | addTexture (const unsigned int unit, const std::string uniform_name, std::shared_ptr< BaseTexture > texture_object) noexcept |
Adds a texture. More... | |
void | removeTexture (const unsigned int unit) |
Removes a texture. More... | |
std::map< unsigned int, std::shared_ptr< BaseTexture > > | getTextures () const noexcept |
Gets the textures. More... | |
void | setLightReactive (const bool reactive) noexcept |
Sets if the renderable should be light reactive. More... | |
bool | isLightReactive () const noexcept |
Determines if light reactive. More... | |
void | setAmbientLight (const glm::vec3 color) noexcept |
Sets the ambient light. More... | |
glm::vec3 | getAmbientLight () const noexcept |
Gets the ambient light. More... | |
void | setAmbientIntensity (const float intensity) noexcept |
Sets the ambient intensity. More... | |
float | getAmbientIntensity () const noexcept |
Gets the ambient intensity. More... | |
void | addInfluencingLight (std::shared_ptr< Light > light) noexcept |
Adds an influencing light. More... | |
void | clearInfluencingLights () |
Clears all influencing lights. More... | |
float | highestZ () const noexcept |
The highest possible z value in the renderable. More... | |
unsigned int | getVertexArrayBinding () const noexcept |
Gets the vertex array binding. More... | |
VertexData | getVertexData () const noexcept |
Gets the vertex data. More... | |
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... | |
Static Public Member Functions | |
static std::shared_ptr< TextArea > | create (std::shared_ptr< Skin > skin, std::shared_ptr< WrappableText > text, glm::vec4 color, glm::vec4 text_color, float padding, float screen_width, float screen_height, float x_pos, float y_pos, float width, float height, const unsigned int layer) |
TextArea factory function. More... | |
Static Public Member Functions inherited from Graphics::UI::Area | |
static std::shared_ptr< Area > | create (std::shared_ptr< Skin > skin, glm::vec4 color, float screen_width, float screen_height, float x_pos, float y_pos, float width, float height, const unsigned int layer) |
Area factory function. More... | |
Static Public Member Functions inherited from Graphics::Renderable | |
static std::shared_ptr < Renderable > | create (const VertexData &vertex_data) |
Renderable factory function. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from Graphics::Renderable | |
void | setUniform (const Uniform &uniform) noexcept |
Renderable () | |
Protected Member Functions inherited from Events::Observer | |
std::shared_ptr< Event > | getEvent () |
bool | eventsWaiting () const noexcept |
Static Protected Member Functions inherited from Graphics::UI::Element | |
static std::vector< glm::vec3 > | generateRect (float screen_width, float screen_height, float x_pos, float y_pos, float width, float height) noexcept |
static std::vector< glm::vec2 > | basisTexCoords () noexcept |
Protected Attributes inherited from Graphics::Renderable | |
std::set< Uniform > | uniforms |
Protected Attributes inherited from Component | |
std::weak_ptr< Entity > | entity |
std::shared_ptr< Transform > | transform |
bool | active |
unsigned int | id |
Static Protected Attributes inherited from Component | |
static unsigned int | next_id = 0 |
Class for text area.
Graphics::UI::TextArea::TextArea | ( | std::shared_ptr< WrappableText > | text, |
VertexData | vertex_data, | ||
std::shared_ptr< Skin > | skin, | ||
const unsigned int | layer | ||
) |
TextArea constructor.
[in] | text | The text |
[in] | vertex_data | The vertex data |
[in] | skin | The skin |
References Component::getTransform().
|
overridevirtualnoexcept |
Returns a string representing the class name.
Reimplemented from Graphics::UI::Area.
Reimplemented in Graphics::UI::TextField, Graphics::UI::Button, and Graphics::UI::QuitButton.
Referenced by generated::getTextAreaModule().
|
static |
TextArea factory function.
[in] | skin | The skin |
[in] | text | The text |
[in] | color | The color |
[in] | text_color | The text color |
[in] | padding | The padding |
[in] | screen_width | The screen width |
[in] | screen_height | The screen height |
[in] | x_pos | The x position |
[in] | y_pos | The y position |
[in] | width | The width |
[in] | height | The height |
References Graphics::UI::Element::basisTexCoords(), and Graphics::UI::Element::generateRect().
Referenced by generated::getTextAreaModule().
|
noexcept |
Gets the text.
Referenced by generated::getTextAreaModule(), handleQueuedEvent(), and onStart().
|
overridevirtual |
HandleQueuedEvent allows derived classes to define behaviour for when queuedEvents are received.
[in] | event | The event |
Reimplemented from Graphics::UI::Area.
Reimplemented in Graphics::UI::TextField.
References Events::CHANGE_TEXT, getText(), and Graphics::UI::Area::handleQueuedEvent().
Referenced by Graphics::UI::Button::handleQueuedEvent(), Graphics::UI::TextField::handleQueuedEvent(), and onNotifyNow().
|
virtual |
Reimplemented from Graphics::UI::Area.
Reimplemented in Graphics::UI::TextField, and Graphics::UI::Button.
References to_string().
Referenced by Graphics::UI::Button::log().
|
overridevirtual |
Called when the mosue cursor goes over the element.
Reimplemented from Graphics::UI::Area.
Reimplemented in Graphics::UI::TextField, and Graphics::UI::Button.
Referenced by generated::getTextAreaModule().
|
overridevirtual |
Called when the mouse cursor goes off the element.
Reimplemented from Graphics::UI::Area.
Reimplemented in Graphics::UI::TextField, and Graphics::UI::Button.
Referenced by generated::getTextAreaModule().
|
overridevirtual |
Called when the engine is shutting down.
Reimplemented from Graphics::UI::Area.
Reimplemented in Graphics::UI::TextField.
References Graphics::UI::Area::onDestroy().
Referenced by generated::getTextAreaModule(), and Graphics::UI::TextField::onDestroy().
|
overridevirtual |
Called when a key is pressed while element is in focus.
[in] | key | The key |
Reimplemented from Graphics::UI::Area.
Reimplemented in Graphics::UI::TextField, and Graphics::UI::Button.
Referenced by generated::getTextAreaModule().
|
overridevirtual |
Called when a key is repeated while element is in focus.
[in] | key | The key |
Reimplemented from Graphics::UI::Area.
Reimplemented in Graphics::UI::TextField, and Graphics::UI::Button.
Referenced by generated::getTextAreaModule().
|
overridevirtual |
Called when a key is released while element is in focus.
[in] | key | The key |
Reimplemented from Graphics::UI::Area.
Reimplemented in Graphics::UI::TextField, and Graphics::UI::Button.
Referenced by generated::getTextAreaModule().
|
overridevirtual |
Called when element is left clicked.
Reimplemented from Graphics::UI::Area.
Reimplemented in Graphics::UI::TextField, Graphics::UI::Button, and Graphics::UI::QuitButton.
Referenced by generated::getTextAreaModule().
|
overridevirtual |
Called when element has left click released over it.
Reimplemented from Graphics::UI::Area.
Reimplemented in Graphics::UI::TextField, and Graphics::UI::Button.
Referenced by generated::getTextAreaModule().
|
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 Graphics::UI::Area.
Reimplemented in Graphics::UI::TextField.
References handleQueuedEvent().
|
overridevirtual |
Called when element is right clicked.
Reimplemented from Graphics::UI::Area.
Reimplemented in Graphics::UI::TextField, and Graphics::UI::Button.
Referenced by generated::getTextAreaModule().
|
overridevirtual |
Called when element has right click released over it.
Reimplemented from Graphics::UI::Area.
Reimplemented in Graphics::UI::TextField, and Graphics::UI::Button.
Referenced by generated::getTextAreaModule().
|
overridevirtual |
Called when the mouse wheel is scrolled while element is in focus.
[in] | position_change | The position change |
Reimplemented from Graphics::UI::Area.
Reimplemented in Graphics::UI::TextField, and Graphics::UI::Button.
Referenced by generated::getTextAreaModule().
|
overridevirtual |
Called when the engine starts and when a new scene is loaded.
Reimplemented from Graphics::UI::Area.
Reimplemented in Graphics::UI::TextField.
References Graphics::UI::Element::getAnchorPoint(), getText(), and Graphics::UI::Area::onStart().
Referenced by generated::getTextAreaModule(), and Graphics::UI::TextField::onStart().
|
overridevirtual |
Called every engine loop.
[in] | delta | The delta |
Reimplemented from Graphics::UI::Area.
Reimplemented in Graphics::UI::TextField.
References Graphics::UI::Area::onUpdate().
Referenced by generated::getTextAreaModule(), and Graphics::UI::TextField::onUpdate().
void Graphics::UI::TextArea::setText | ( | std::shared_ptr< WrappableText > | text | ) |
Sets the text.
[in] | text | The text |
Referenced by generated::getTextAreaModule(), Graphics::UI::TextField::onLeftClick(), and Graphics::UI::TextField::TextField().
|
overridevirtualnoexcept |
Returns a string representation of the object.
Reimplemented from Graphics::UI::Area.
Reimplemented in Graphics::UI::TextField.
References Graphics::UI::Area::to_string().
Referenced by generated::getTextAreaModule(), log(), and Graphics::UI::TextField::to_string().