ToyMaker Game Engine 0.0.2
ToyMaker is a game engine developed and maintained by Zoheb Shujauddin.
Loading...
Searching...
No Matches
interface_pointer_callback.hpp
Go to the documentation of this file.
1
10
11#ifndef TOYMAKERBUILTINS_INTERFACEPOINTERCALLBACK_H
12#define TOYMAKERBUILTINS_INTERFACEPOINTERCALLBACK_H
13
14#include <glm/glm.hpp>
15
16namespace ToyMaker {
17 class IRightClickable;
18 class ILeftClickable;
19 class IHoverable;
20
37 public:
42 ~IUsePointer()=default;
43 protected:
52 bool leftClickOn(ILeftClickable& clickable, glm::vec4 clickLocation);
53
62 bool leftReleaseOn(ILeftClickable& clickable, glm::vec4 clickLocation);
63
72 bool pointerEnter(IHoverable& hoverable, glm::vec4 hoverLocation);
73
83 bool pointerHover(IHoverable& hoverable, glm::vec4 hoverLocation);
84
92 bool pointerLeave(IHoverable& hoverable);
93 };
94
108 virtual bool onPointerLeftClick(glm::vec4 clickLocation)=0;
109
117 virtual bool onPointerLeftRelease(glm::vec4 clickLocation)=0;
118 friend class IUsePointer;
119 };
120
121 // class IRightClickable {
122 // virtual bool onPointerRightClick(glm::vec4 clickLocation)=0;
123 // virtual bool onPointerRightRelease(glm::vec4 clickLocation)=0;
124 // friend class IUsePointer;
125 // };
126
140 virtual bool onPointerEnter(glm::vec4 hoverLocation)=0;
141
149 virtual bool onPointerHover(glm::vec4 hoverLocation)=0;
150
157 virtual bool onPointerLeave()=0;
158 friend class IUsePointer;
159 };
160
161 // inline bool IUsePointer::rightClickOn(IRightClickable& clickable, glm::vec4 clickLocation) { return clickable.onPointerRightClick(clickLocation); }
162 // inline bool IUsePointer::rightReleaseOn(IRightClickable& clickable, glm::vec4 clickLocation) { return clickable.onPointerRightRelease(clickLocation); }
163
164 inline bool IUsePointer::leftClickOn(ILeftClickable& clickable, glm::vec4 clickLocation) { return clickable.onPointerLeftClick(clickLocation); }
165 inline bool IUsePointer::leftReleaseOn(ILeftClickable& clickable, glm::vec4 clickLocation) { return clickable.onPointerLeftRelease(clickLocation); }
166
167 inline bool IUsePointer::pointerEnter(IHoverable& hoverable, glm::vec4 hoverLocation) { return hoverable.onPointerEnter(hoverLocation); }
168 inline bool IUsePointer::pointerHover(IHoverable& hoverable, glm::vec4 hoverLocation) { return hoverable.onPointerHover(hoverLocation); }
169 inline bool IUsePointer::pointerLeave(IHoverable& hoverable) { return hoverable.onPointerLeave(); }
170}
171
172#endif
The interface implemented by aspects which wish to respond to pointer hover related events.
Definition interface_pointer_callback.hpp:132
virtual bool onPointerEnter(glm::vec4 hoverLocation)=0
Virtual method called by a subclass of IUsePointer to signal that a pointer has entered this object's...
virtual bool onPointerLeave()=0
Virtual method called by a subclass of IUsePointer to signal that a pointer has just left this object...
virtual bool onPointerHover(glm::vec4 hoverLocation)=0
Virtual method called by a subclass of IUsePointer every tick while the pointer is in this object's r...
The interface used by aspects which wish to respond to mouse left click events (or equivalent).
Definition interface_pointer_callback.hpp:100
virtual bool onPointerLeftRelease(glm::vec4 clickLocation)=0
Virtual method called by a subclass of IUsePointer to signal that a left mousebutton release event ha...
virtual bool onPointerLeftClick(glm::vec4 clickLocation)=0
Virtual method called by a subclass of IUsePointer to signal that a left mousebutton press event has ...
The interface used by aspects, objects, which cast pointer rays to interact with objects present in t...
Definition interface_pointer_callback.hpp:36
bool pointerHover(IHoverable &hoverable, glm::vec4 hoverLocation)
Callback for when a pointer hovers in a region containing an object.
Definition interface_pointer_callback.hpp:168
~IUsePointer()=default
Virtual IUsePointer destructor, so that subclasses can use their own.
bool leftReleaseOn(ILeftClickable &clickable, glm::vec4 clickLocation)
Calls the left mouse button release (or equivalent) callback on an object.
Definition interface_pointer_callback.hpp:165
bool pointerEnter(IHoverable &hoverable, glm::vec4 hoverLocation)
Callback for when a pointer enters a region containing an object.
Definition interface_pointer_callback.hpp:167
bool pointerLeave(IHoverable &hoverable)
Callback for when a pointer leaves a region containing an object.
Definition interface_pointer_callback.hpp:169
bool leftClickOn(ILeftClickable &clickable, glm::vec4 clickLocation)
Calls the left mouse button press (or equivalent) callback on an object.
Definition interface_pointer_callback.hpp:164
Namespace containing all class definitions and functions related to the ToyMaker engine.
Definition application.hpp:26