Nymph Game Engine
Chaiscript based Game Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
area.h
Go to the documentation of this file.
1 #ifndef AREA_H
2 #define AREA_H
3 
4 #include <memory>
5 #include "graphics/ui/element.h"
6 #include "graphics/ui/skin.h"
7 #include "events/event.h"
8 //= SCRIPTABLE
9 //= SCRIPTABLE BASES Element
10 
11 namespace Graphics {
12  namespace UI {
16  class Area : public Element, virtual public el::Loggable {
17  public:
18  //= BEGIN SCRIPTABLE
19 
26  Area(VertexData vertex_data, std::shared_ptr<Skin> skin, const unsigned int layer);
41  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);
42 
43  virtual void onLeftClick() override;
44  virtual void onRightClick() override;
45  virtual void onLeftClickRelease() override;
46  virtual void onRightClickRelease() override;
47  virtual void onCursorEnter() override;
48  virtual void onCursorLeave() override;
49  virtual void onKeyDown(const int key) override;
50  virtual void onKeyUp(const int key) override;
51  virtual void onKeyRepeat(const int key) override;
52  virtual void onScroll(const glm::dvec2 position_change) override;
53  virtual std::string to_string() const noexcept override;
54  virtual std::string className() const noexcept override;
55  //= END SCRIPTABLE
56 
57  virtual void onDestroy() override;
58  virtual void onStart() override;
59  virtual bool onUpdate(const double delta) override;
60 
61  void handleQueuedEvent(std::shared_ptr<Events::Event> event) override;
62  void onNotifyNow(std::shared_ptr<Events::Event> event) override;
63  virtual void log(el::base::type::ostream_t& os) const override;
64  };
65  }
66 }
67 
68 #endif
virtual bool onUpdate(const double delta) override
Called every engine loop.
Definition: area.cpp:32
virtual std::string to_string() const noexceptoverride
Returns a string representation of the object.
Definition: area.cpp:78
virtual void onLeftClickRelease() override
Called when element has left click released over it.
Definition: area.cpp:52
virtual void onKeyDown(const int key) override
Called when a key is pressed while element is in focus.
Definition: area.cpp:66
virtual void onStart() override
Called when the engine starts and when a new scene is loaded.
Definition: area.cpp:28
virtual void log(el::base::type::ostream_t &os) const override
Definition: area.cpp:86
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.
Definition: area.cpp:10
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 ...
Definition: area.cpp:40
virtual void onScroll(const glm::dvec2 position_change) override
Called when the mouse wheel is scrolled while element is in focus.
Definition: area.cpp:75
Class for vertex data.
Definition: vertex_data.h:17
virtual void onLeftClick() override
Called when element is left clicked.
Definition: area.cpp:44
virtual void onKeyUp(const int key) override
Called when a key is released while element is in focus.
Definition: area.cpp:69
virtual void onRightClick() override
Called when element is right clicked.
Definition: area.cpp:48
Area(VertexData vertex_data, std::shared_ptr< Skin > skin, const unsigned int layer)
Area constructor.
Definition: area.cpp:7
void handleQueuedEvent(std::shared_ptr< Events::Event > event) override
HandleQueuedEvent allows derived classes to define behaviour for when queuedEvents are received...
Definition: area.cpp:36
virtual void onRightClickRelease() override
Called when element has right click released over it.
Definition: area.cpp:56
virtual void onCursorLeave() override
Called when the mouse cursor goes off the element.
Definition: area.cpp:63
virtual void onKeyRepeat(const int key) override
Called when a key is repeated while element is in focus.
Definition: area.cpp:72
virtual void onDestroy() override
Called when the engine is shutting down.
Definition: area.cpp:24
Class for UI Area.
Definition: area.h:16
Definition: element.h:14
virtual std::string className() const noexceptoverride
Returns a string representing the class name.
Definition: area.cpp:82
virtual void onCursorEnter() override
Called when the mosue cursor goes over the element.
Definition: area.cpp:60