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
16
17#ifndef ZOAPPINTERFACEPOINTERCALLBACK_H
18#define ZOAPPINTERFACEPOINTERCALLBACK_H
19
20#include <glm/glm.hpp>
21
22namespace ToyMaker {
23 class IRightClickable;
24 class ILeftClickable;
25 class IHoverable;
26
39 public:
44 ~IUsePointer()=default;
45 protected:
54 bool leftClickOn(ILeftClickable& clickable, glm::vec4 clickLocation);
55
64 bool leftReleaseOn(ILeftClickable& clickable, glm::vec4 clickLocation);
65
74 bool pointerEnter(IHoverable& hoverable, glm::vec4 hoverLocation);
75
83 bool pointerLeave(IHoverable& hoverable);
84 };
85
99 virtual bool onPointerLeftClick(glm::vec4 clickLocation)=0;
100
108 virtual bool onPointerLeftRelease(glm::vec4 clickLocation)=0;
109 friend class IUsePointer;
110 };
111
112 // class IRightClickable {
113 // virtual bool onPointerRightClick(glm::vec4 clickLocation)=0;
114 // virtual bool onPointerRightRelease(glm::vec4 clickLocation)=0;
115 // friend class IUsePointer;
116 // };
117
131 virtual bool onPointerEnter(glm::vec4 hoverLocation)=0;
132
139 virtual bool onPointerLeave()=0;
140 friend class IUsePointer;
141 };
142
143 // inline bool IUsePointer::rightClickOn(IRightClickable& clickable, glm::vec4 clickLocation) { return clickable.onPointerRightClick(clickLocation); }
144 // inline bool IUsePointer::rightReleaseOn(IRightClickable& clickable, glm::vec4 clickLocation) { return clickable.onPointerRightRelease(clickLocation); }
145
146 inline bool IUsePointer::leftClickOn(ILeftClickable& clickable, glm::vec4 clickLocation) { return clickable.onPointerLeftClick(clickLocation); }
147 inline bool IUsePointer::leftReleaseOn(ILeftClickable& clickable, glm::vec4 clickLocation) { return clickable.onPointerLeftRelease(clickLocation); }
148
149 inline bool IUsePointer::pointerEnter(IHoverable& hoverable, glm::vec4 hoverLocation) { return hoverable.onPointerEnter(hoverLocation); }
150 inline bool IUsePointer::pointerLeave(IHoverable& hoverable) { return hoverable.onPointerLeave(); }
151
152}
153
154#endif
The interface implemented by aspects which wish to respond to pointer hover related events.
Definition interface_pointer_callback.hpp:123
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...
The interface used by aspects which wish to respond to mouse left click events (or equivalent).
Definition interface_pointer_callback.hpp:91
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:38
~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:147
bool pointerEnter(IHoverable &hoverable, glm::vec4 hoverLocation)
Callback for when a pointer enters a region containing an object.
Definition interface_pointer_callback.hpp:149
bool pointerLeave(IHoverable &hoverable)
Callback for when a pointer leaves a region containing an object.
Definition interface_pointer_callback.hpp:150
bool leftClickOn(ILeftClickable &clickable, glm::vec4 clickLocation)
Calls the left mouse button press (or equivalent) callback on an object.
Definition interface_pointer_callback.hpp:146
Namespace containing all class definitions and functions related to the ToyMaker engine.
Definition application.hpp:25