Nymph Game Engine
Chaiscript based Game Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Graphics::UI::QuitButton Class Reference

Class for UI quit button. More...

#include <quit_button.h>

Inheritance diagram for Graphics::UI::QuitButton:
Graphics::UI::Button Graphics::UI::TextArea Graphics::UI::Area Graphics::UI::Element Graphics::Renderable Component Events::Subject Events::Observer

Public Member Functions

 QuitButton (std::shared_ptr< WrappableText > text, VertexData vertex_data, std::shared_ptr< Skin > skin, const unsigned int layer)
 Quit Button constructor. More...
 
virtual void onLeftClick () override
 Called when element is left clicked. More...
 
virtual std::string className () const noexceptoverride
 Returns a string representing the class name. More...
 
- Public Member Functions inherited from Graphics::UI::Button
 Button (std::shared_ptr< WrappableText > text, VertexData vertex_data, std::shared_ptr< Skin > skin, const unsigned int layer)
 Button constructor. 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...
 
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::TextArea
 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< WrappableTextgetText () const noexcept
 Gets the text. 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...
 
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...
 
- 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< SkingetSkin () 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)
 
Renderableoperator= (Renderable &&renderable)
 
virtual ~Renderable ()
 
void setShader (std::shared_ptr< Shader > shader_object) noexcept
 Sets the shader. More...
 
std::shared_ptr< ShadergetShader () 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< TransformgetTransform () 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
< QuitButton
create (std::shared_ptr< Skin > skin, std::shared_ptr< WrappableText > text, glm::vec4 color, glm::vec4 text_color, float screen_width, float screen_height, float x_pos, float y_pos, float width, float height, const unsigned int layer)
 Quit Button factory function. More...
 
- Static Public Member Functions inherited from Graphics::UI::Button
static std::shared_ptr< Buttoncreate (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)
 Factory function for Button. More...
 
- Static Public Member Functions inherited from Graphics::UI::TextArea
static std::shared_ptr< TextAreacreate (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< Areacreate (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< EventgetEvent ()
 
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::UI::Button
const glm::vec4 mouse_over_dim = glm::vec4(0.1, 0.1, 0.1, 0.0)
 
- Protected Attributes inherited from Graphics::Renderable
std::set< Uniformuniforms
 
- Protected Attributes inherited from Component
std::weak_ptr< Entityentity
 
std::shared_ptr< Transformtransform
 
bool active
 
unsigned int id
 
- Static Protected Attributes inherited from Component
static unsigned int next_id = 0
 

Detailed Description

Class for UI quit button.

Constructor & Destructor Documentation

Graphics::UI::QuitButton::QuitButton ( std::shared_ptr< WrappableText text,
VertexData  vertex_data,
std::shared_ptr< Skin skin,
const unsigned int  layer 
)

Quit Button constructor.

Parameters
[in]textThe text
[in]vertex_dataThe vertex data
[in]skinThe skin

References Graphics::UI::Element::setTextPadding().

Member Function Documentation

std::string Graphics::UI::QuitButton::className ( ) const
overridevirtualnoexcept

Returns a string representing the class name.

Returns
The class name

Reimplemented from Graphics::UI::Button.

Referenced by generated::getQuitButtonModule().

std::shared_ptr< QuitButton > Graphics::UI::QuitButton::create ( std::shared_ptr< Skin skin,
std::shared_ptr< WrappableText text,
glm::vec4  color,
glm::vec4  text_color,
float  screen_width,
float  screen_height,
float  x_pos,
float  y_pos,
float  width,
float  height,
const unsigned int  layer 
)
static

Quit Button factory function.

Parameters
[in]skinThe skin
[in]textThe text
[in]colorThe color
[in]text_colorThe text color
[in]screen_widthThe screen width
[in]screen_heightThe screen height
[in]x_posThe x position
[in]y_posThe y position
[in]widthThe width
[in]heightThe height
Returns
A newly constructed QuitButton

References Graphics::UI::Element::basisTexCoords(), and Graphics::UI::Element::generateRect().

Referenced by generated::getQuitButtonModule().

void Graphics::UI::QuitButton::onLeftClick ( )
overridevirtual

Called when element is left clicked.

Reimplemented from Graphics::UI::Button.

References SetEntityActiveEvent::create(), and Events::Subject::notifyNow().

Referenced by generated::getQuitButtonModule().


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