AnnDefaultEventListener.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "systemMacro.h"
4 #include "AnnEvents.hpp"
5 #include "AnnEventManager.hpp"
6 
7 namespace Annwvyn
8 {
11  {
12  //The default event listener that make WASD controls move the player
13  //The mouse turns the player's body
14  //Shift to "run"
15  //F1 and F2 to switch between Debug Mode
16  //F12 to recenter the rift
17  // or ~ or ` (depending on keyboard layout) to open the on-screen-console
18  //Xbox controller with main stick for walking and 2nd stick for turning your body
19 
20  public:
24  void KeyEvent(AnnKeyEvent e) override;
26  void MouseEvent(AnnMouseEvent e) override;
28  void ControllerEvent(AnnControllerEvent e) override;
29  static void reclampDegreeToPositiveRange(float& degree);
31  void HandControllerEvent(AnnHandControllerEvent e) override;
32 
34  void setKeys(KeyCode::code fw,
35  KeyCode::code bw,
36  KeyCode::code sl,
37  KeyCode::code sr,
38  KeyCode::code jmp,
39  KeyCode::code rn);
40  enum turnStickMode { NORMAL,
41  WHEEL };
43 
44  protected:
59 
61  float deadzone;
63  float maxWheelAngle, minWheelAngle;
67  enum { ax_walk,
70  ax_size };
71  ControllerAxisID axes[ax_size];
73  enum { b_jump,
77  b_size };
78  ButtonId buttons[b_size];
79 
80  float lastAngle;
81 
83  size_t OpenVRController, OculusTouchController;
84  };
85 }
file for defining macros used for symbol export regarding the way the OS does things.
KeyCode::code backward
S by default.
KeyCode::code recenter
F12 by default.
KeyCode::code straffleft
A by default.
Namespace containing the totality of Annwvyn components.
Definition: AnnGetter.cpp:8
A joystick event.
Definition: AnnEvents.hpp:240
size_t OpenVRController
Hash of controller type strings.
KeyCode::code run
shift by default
int ControllerAxisID
Definition: AnnEvents.hpp:155
A hand controller event.
Definition: AnnEvents.hpp:300
int ButtonId
A joystick event.
Definition: AnnEvents.hpp:154
KeyCode::code straffright
D by default.
event management for Annwvyn
A keyboard event.
Definition: AnnEvents.hpp:37
#define AnnDllExport
Definition: systemMacro.h:24
Base class for all event listener.
A mouse event information object.
Definition: AnnEvents.hpp:124
float deadzone
value used for trimming low joysticks value
KeyCode::code jump
Space by default.