Game of Ur 0.3.3
This is a computer adaptation of Game of Ur, written in C++ mainly using SDL and OpenGL.
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
20class IRightClickable;
21class ILeftClickable;
22class IHoverable;
23
36public:
41 ~IUsePointer()=default;
42protected:
51 bool leftClickOn(ILeftClickable& clickable, glm::vec4 clickLocation);
52
61 bool leftReleaseOn(ILeftClickable& clickable, glm::vec4 clickLocation);
62
71 bool pointerEnter(IHoverable& hoverable, glm::vec4 hoverLocation);
72
80 bool pointerLeave(IHoverable& hoverable);
81};
82
96 virtual bool onPointerLeftClick(glm::vec4 clickLocation)=0;
97
105 virtual bool onPointerLeftRelease(glm::vec4 clickLocation)=0;
106friend class IUsePointer;
107};
108
109// class IRightClickable {
110// virtual bool onPointerRightClick(glm::vec4 clickLocation)=0;
111// virtual bool onPointerRightRelease(glm::vec4 clickLocation)=0;
112// friend class IUsePointer;
113// };
114
128 virtual bool onPointerEnter(glm::vec4 hoverLocation)=0;
129
136 virtual bool onPointerLeave()=0;
137friend class IUsePointer;
138};
139
140// inline bool IUsePointer::rightClickOn(IRightClickable& clickable, glm::vec4 clickLocation) { return clickable.onPointerRightClick(clickLocation); }
141// inline bool IUsePointer::rightReleaseOn(IRightClickable& clickable, glm::vec4 clickLocation) { return clickable.onPointerRightRelease(clickLocation); }
142
143inline bool IUsePointer::leftClickOn(ILeftClickable& clickable, glm::vec4 clickLocation) { return clickable.onPointerLeftClick(clickLocation); }
144inline bool IUsePointer::leftReleaseOn(ILeftClickable& clickable, glm::vec4 clickLocation) { return clickable.onPointerLeftRelease(clickLocation); }
145
146inline bool IUsePointer::pointerEnter(IHoverable& hoverable, glm::vec4 hoverLocation) { return hoverable.onPointerEnter(hoverLocation); }
147inline bool IUsePointer::pointerLeave(IHoverable& hoverable) { return hoverable.onPointerLeave(); }
148
149#endif
The interface implemented by aspects which wish to respond to pointer hover related events.
Definition interface_pointer_callback.hpp:120
virtual bool onPointerLeave()=0
Virtual method called by a subclass of IUsePointer to signal that a pointer has just left this object...
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...
The interface used by aspects which wish to respond to mouse left click events (or equivalent).
Definition interface_pointer_callback.hpp:88
virtual bool onPointerLeftClick(glm::vec4 clickLocation)=0
Virtual method called by a subclass of IUsePointer to signal that a left mousebutton press event has ...
virtual bool onPointerLeftRelease(glm::vec4 clickLocation)=0
Virtual method called by a subclass of IUsePointer to signal that a left mousebutton release event ha...
The interface used by aspects, objects, which cast pointer rays to interact with objects present in t...
Definition interface_pointer_callback.hpp:35
bool pointerLeave(IHoverable &hoverable)
Callback for when a pointer leaves a region containing an object.
Definition interface_pointer_callback.hpp:147
bool leftClickOn(ILeftClickable &clickable, glm::vec4 clickLocation)
Calls the left mouse button press (or equivalent) callback on an object.
Definition interface_pointer_callback.hpp:143
bool pointerEnter(IHoverable &hoverable, glm::vec4 hoverLocation)
Callback for when a pointer enters a region containing an object.
Definition interface_pointer_callback.hpp:146
~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:144