Annwvyn::AnnDefaultEventListener Class Reference

Default event listener. More...

#include <AnnDefaultEventListener.hpp>

Inheritance diagram for Annwvyn::AnnDefaultEventListener:
Collaboration diagram for Annwvyn::AnnDefaultEventListener:

Public Types

enum  turnStickMode { NORMAL, WHEEL }
 

Public Member Functions

 AnnDefaultEventListener ()
 Construct the default listener. More...
 
void KeyEvent (AnnKeyEvent e) override
 Get events from keyboards. More...
 
void MouseEvent (AnnMouseEvent e) override
 Get events from the mouse. More...
 
void ControllerEvent (AnnControllerEvent e) override
 Get events from the joystick. More...
 
void HandControllerEvent (AnnHandControllerEvent e) override
 Get events from an hand controller. More...
 
void setKeys (KeyCode::code fw, KeyCode::code bw, KeyCode::code sl, KeyCode::code sr, KeyCode::code jmp, KeyCode::code rn)
 Set all the key-codes for the controls. More...
 
- Public Member Functions inherited from Annwvyn::AnnEventListener
 AnnEventListener (const AnnEventListener &)=delete
 
AnnEventListeneroperator= (AnnEventListener &)=delete
 
 AnnEventListener (const AnnEventListener &&o) noexcept
 
AnnEventListeneroperator= (AnnEventListener &&o) noexcept
 
virtual ~AnnEventListener ()=default
 
 AnnEventListener ()
 Construct a listener. More...
 
virtual void TimeEvent (AnnTimeEvent e)
 Event from a timer. More...
 
virtual void TriggerEvent (AnnTriggerEvent e)
 Event from a trigger. More...
 
virtual void CollisionEvent (AnnCollisionEvent e)
 Event from detected collisions. More...
 
virtual void PlayerCollisionEvent (AnnPlayerCollisionEvent e)
 Event from detected player collisions. More...
 
virtual void EventFromUserSubsystem (AnnUserSpaceEvent &e, AnnUserSpaceEventLauncher *origin)
 Events from code outside of Annwvyn itself. More...
 
virtual void tick ()
 This method is called at each frame. Useful for updating player's movement command for example. More...
 
std::shared_ptr< AnnEventListenergetSharedListener ()
 return a shared_ptr to this listener More...
 
- Public Member Functions inherited from std::enable_shared_from_this< AnnEventListener >
enable_shared_from_this (T... args)
 
operator= (T... args)
 
shared_from_this (T... args)
 
~enable_shared_from_this (T... args)
 

Static Public Member Functions

static void reclampDegreeToPositiveRange (float &degree)
 
- Static Public Member Functions inherited from Annwvyn::AnnEventListener
static float trim (float value, float deadzone)
 Utility function for applying a dead-zone on a joystick axis. More...
 

Public Attributes

turnStickMode turnMode
 

Protected Types

enum  { ax_walk, ax_straff, ax_rotate, ax_size }
 Axes. More...
 
enum  {
  b_jump, b_run, b_console, b_debug,
  b_size
}
 Buttons. More...
 

Protected Attributes

KeyCode::code forward
 W by default. More...
 
KeyCode::code backward
 S by default. More...
 
KeyCode::code straffleft
 A by default. More...
 
KeyCode::code straffright
 D by default. More...
 
KeyCode::code jump
 Space by default. More...
 
KeyCode::code run
 shift by default More...
 
KeyCode::code recenter
 F12 by default. More...
 
float deadzone
 value used for trimming low joysticks value More...
 
float wheelStickSensitivity
 
float maxWheelAngle
 
float minWheelAngle
 
float stickCurrentAngleDegree
 
float computedWheelValue
 
ControllerAxisID axes [ax_size]
 
ButtonId buttons [b_size]
 
float lastAngle
 
size_t OpenVRController
 Hash of controller type strings. More...
 
size_t OculusTouchController
 
- Protected Attributes inherited from Annwvyn::AnnEventListener
AnnPlayerBodyplayer
 Pointer to the player. Set by the constructor, provide easy access to the AnnPlayerBody. More...
 

Detailed Description

Default event listener.

Definition at line 10 of file AnnDefaultEventListener.hpp.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
protected

Axes.

Enumerator
ax_walk 
ax_straff 
ax_rotate 
ax_size 

Definition at line 67 of file AnnDefaultEventListener.hpp.

◆ anonymous enum

anonymous enum
protected

Buttons.

Enumerator
b_jump 
b_run 
b_console 
b_debug 
b_size 

Definition at line 73 of file AnnDefaultEventListener.hpp.

◆ turnStickMode

Enumerator
NORMAL 
WHEEL 

Definition at line 40 of file AnnDefaultEventListener.hpp.

Constructor & Destructor Documentation

◆ AnnDefaultEventListener()

AnnDefaultEventListener::AnnDefaultEventListener ( )

Construct the default listener.

Definition at line 10 of file AnnDefaultEventListener.cpp.

Member Function Documentation

◆ ControllerEvent()

void AnnDefaultEventListener::ControllerEvent ( AnnControllerEvent  e)
overridevirtual

Get events from the joystick.

Reimplemented from Annwvyn::AnnEventListener.

Definition at line 121 of file AnnDefaultEventListener.cpp.

Here is the call graph for this function:

◆ HandControllerEvent()

void AnnDefaultEventListener::HandControllerEvent ( AnnHandControllerEvent  e)
overridevirtual

Get events from an hand controller.

Reimplemented from Annwvyn::AnnEventListener.

Definition at line 148 of file AnnDefaultEventListener.cpp.

Here is the call graph for this function:

◆ KeyEvent()

void AnnDefaultEventListener::KeyEvent ( AnnKeyEvent  e)
overridevirtual

Get events from keyboards.

Reimplemented from Annwvyn::AnnEventListener.

Definition at line 62 of file AnnDefaultEventListener.cpp.

Here is the call graph for this function:

◆ MouseEvent()

void AnnDefaultEventListener::MouseEvent ( AnnMouseEvent  e)
overridevirtual

Get events from the mouse.

Reimplemented from Annwvyn::AnnEventListener.

Definition at line 115 of file AnnDefaultEventListener.cpp.

Here is the call graph for this function:

◆ reclampDegreeToPositiveRange()

void AnnDefaultEventListener::reclampDegreeToPositiveRange ( float &  degree)
static

Definition at line 142 of file AnnDefaultEventListener.cpp.

Here is the caller graph for this function:

◆ setKeys()

void AnnDefaultEventListener::setKeys ( KeyCode::code  fw,
KeyCode::code  bw,
KeyCode::code  sl,
KeyCode::code  sr,
KeyCode::code  jmp,
KeyCode::code  rn 
)

Set all the key-codes for the controls.

Definition at line 42 of file AnnDefaultEventListener.cpp.

Member Data Documentation

◆ axes

ControllerAxisID Annwvyn::AnnDefaultEventListener::axes[ax_size]
protected

Definition at line 71 of file AnnDefaultEventListener.hpp.

◆ backward

KeyCode::code Annwvyn::AnnDefaultEventListener::backward
protected

S by default.

Definition at line 48 of file AnnDefaultEventListener.hpp.

◆ buttons

ButtonId Annwvyn::AnnDefaultEventListener::buttons[b_size]
protected

Definition at line 78 of file AnnDefaultEventListener.hpp.

◆ computedWheelValue

float Annwvyn::AnnDefaultEventListener::computedWheelValue
protected

Definition at line 65 of file AnnDefaultEventListener.hpp.

◆ deadzone

float Annwvyn::AnnDefaultEventListener::deadzone
protected

value used for trimming low joysticks value

Definition at line 61 of file AnnDefaultEventListener.hpp.

◆ forward

KeyCode::code Annwvyn::AnnDefaultEventListener::forward
protected

W by default.

Definition at line 46 of file AnnDefaultEventListener.hpp.

◆ jump

KeyCode::code Annwvyn::AnnDefaultEventListener::jump
protected

Space by default.

Definition at line 54 of file AnnDefaultEventListener.hpp.

◆ lastAngle

float Annwvyn::AnnDefaultEventListener::lastAngle
protected

Definition at line 80 of file AnnDefaultEventListener.hpp.

◆ maxWheelAngle

float Annwvyn::AnnDefaultEventListener::maxWheelAngle
protected

Definition at line 63 of file AnnDefaultEventListener.hpp.

◆ minWheelAngle

float Annwvyn::AnnDefaultEventListener::minWheelAngle
protected

Definition at line 63 of file AnnDefaultEventListener.hpp.

◆ OculusTouchController

size_t Annwvyn::AnnDefaultEventListener::OculusTouchController
protected

Definition at line 83 of file AnnDefaultEventListener.hpp.

◆ OpenVRController

size_t Annwvyn::AnnDefaultEventListener::OpenVRController
protected

Hash of controller type strings.

Definition at line 83 of file AnnDefaultEventListener.hpp.

◆ recenter

KeyCode::code Annwvyn::AnnDefaultEventListener::recenter
protected

F12 by default.

Definition at line 58 of file AnnDefaultEventListener.hpp.

◆ run

KeyCode::code Annwvyn::AnnDefaultEventListener::run
protected

shift by default

Definition at line 56 of file AnnDefaultEventListener.hpp.

◆ stickCurrentAngleDegree

float Annwvyn::AnnDefaultEventListener::stickCurrentAngleDegree
protected

Definition at line 64 of file AnnDefaultEventListener.hpp.

◆ straffleft

KeyCode::code Annwvyn::AnnDefaultEventListener::straffleft
protected

A by default.

Definition at line 50 of file AnnDefaultEventListener.hpp.

◆ straffright

KeyCode::code Annwvyn::AnnDefaultEventListener::straffright
protected

D by default.

Definition at line 52 of file AnnDefaultEventListener.hpp.

◆ turnMode

turnStickMode Annwvyn::AnnDefaultEventListener::turnMode

Definition at line 42 of file AnnDefaultEventListener.hpp.

◆ wheelStickSensitivity

float Annwvyn::AnnDefaultEventListener::wheelStickSensitivity
protected

Definition at line 62 of file AnnDefaultEventListener.hpp.


The documentation for this class was generated from the following files: