AnnEventListener.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "systemMacro.h"
4 #include "AnnEvents.hpp"
5 
6 namespace Annwvyn
7 {
8  class AnnPlayerBody;
9 
12  {
13  //Base Event listener class. Technically not abstract since it provides a default implementation for all
14  //virtual members. But theses definitions are pointless because they actually don't do anything.
15  //You need to subclass it to create an EventListener
16 
17  public:
18  AnnEventListener(const AnnEventListener&) = delete;
19  AnnEventListener& operator=(AnnEventListener&) = delete;
20  AnnEventListener(const AnnEventListener&& o) noexcept;
21  AnnEventListener& operator=(AnnEventListener&& o) noexcept;
22 
23  virtual ~AnnEventListener() = default;
24 
28  virtual void KeyEvent(AnnKeyEvent e) {}
30  virtual void MouseEvent(AnnMouseEvent e) {}
34  virtual void TimeEvent(AnnTimeEvent e) {}
36  virtual void TriggerEvent(AnnTriggerEvent e) {}
46  virtual void tick() {}
48  static float trim(float value, float deadzone);
50  std::shared_ptr<AnnEventListener> getSharedListener();
51 
52  protected:
55  };
56 
59 }
file for defining macros used for symbol export regarding the way the OS does things.
Collision between the player and another object.
Definition: AnnEvents.hpp:395
Class that can send a user space event to the event manager.
AnnPlayerBody * player
Pointer to the player. Set by the constructor, provide easy access to the AnnPlayerBody.
virtual void KeyEvent(AnnKeyEvent e)
Event from the keyboard.
Namespace containing the totality of Annwvyn components.
Definition: AnnGetter.cpp:8
virtual void TimeEvent(AnnTimeEvent e)
Event from a timer.
A joystick event.
Definition: AnnEvents.hpp:240
A timer timeout event.
Definition: AnnEvents.hpp:342
class that represent the player. This is the user&#39;s "Virtual body" in the world. It&#39;s the object that...
A hand controller event.
Definition: AnnEvents.hpp:300
virtual void EventFromUserSubsystem(AnnUserSpaceEvent &e, AnnUserSpaceEventLauncher *origin)
Events from code outside of Annwvyn itself.
A keyboard event.
Definition: AnnEvents.hpp:37
#define AnnDllExport
Definition: systemMacro.h:24
virtual void ControllerEvent(AnnControllerEvent e)
Event for a Joystick.
virtual void CollisionEvent(AnnCollisionEvent e)
Event from detected collisions.
Base class for all event listener.
A mouse event information object.
Definition: AnnEvents.hpp:124
Trigger in/out event.
Definition: AnnEvents.hpp:409
virtual void HandControllerEvent(AnnHandControllerEvent e)
Event from an HandController.
virtual void TriggerEvent(AnnTriggerEvent e)
Event from a trigger.
Collision event between 2 game objects.
Definition: AnnEvents.hpp:362
virtual void MouseEvent(AnnMouseEvent e)
Event from the mouse.
virtual void PlayerCollisionEvent(AnnPlayerCollisionEvent e)
Event from detected player collisions.
Base class of an event created by user space code.
virtual void tick()
This method is called at each frame. Useful for updating player&#39;s movement command for example...