Nuclide
Software Development Kit for id Technology
NSXRInput.h
1/*
2 * Copyright (c) 2016-2022 Vera Visions LLC.
3 *
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
13 * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
14 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15*/
16
25typedef enum
26{
27 XR_INPUT_UNKNOWN,
28 XR_INPUT_HEAD,
30 XR_INPUT_LEFT,
31 XR_INPUT_RIGHT
32} xrinput_t;
33
35#define XR_STATUS_ORG (1u<<0)
37#define XR_STATUS_ANG (1u<<1)
39#define XR_STATUS_VEL (1u<<2)
41#define XR_STATUS_AVEL (1u<<3)
42
58class NSXRInput {
59 public:
60 void NSXRInput( void );
61
63 virtual void SetType( xrinput_t );
64
66 virtual void SetParentSpace( NSXRSpace );
67
69 virtual vector GetOrigin( void );
70
72 virtual vector GetAngles( void );
73
75 virtual vector GetVelocity( void );
76
78 virtual vector GetAngularVelocity( void );
79
81 virtual unsigned int GetStatus( void );
82
84 virtual unsigned int GetWeapon( void );
85
87 virtual xrinput_t GetType( void );
88
90 virtual bool IsAvailable( void );
91
93 virtual void InputFrame( void );
94
96 virtual void PrintInfo( void );
97
98 private:
100 NSXRSpace m_xrSpace;
101 vector m_vecOrigin;
102 vector m_vecAngles;
103 vector m_vecVelocity;
104 vector m_vecAVelocity;
105 unsigned int m_iStatus;
106 unsigned int m_iWeapon;
107
108 xrinput_t m_inputType;
109};
This class represents an input device in the world.
Definition: NSXRInput.h:58
virtual vector GetAngularVelocity(void)
Returns the rotational movement of this NSXRInput.
Definition: NSXRInput.qc:63
virtual void PrintInfo(void)
Debug function that can be called every single frame.
Definition: NSXRInput.qc:154
virtual bool IsAvailable(void)
Returns if this NSXRInput is available/active.
Definition: NSXRInput.qc:135
virtual vector GetAngles(void)
Returns the direction this NSXRInput is facing.
Definition: NSXRInput.qc:42
virtual unsigned int GetStatus(void)
Returns the status of the NSXRInput.
Definition: NSXRInput.qc:69
virtual vector GetOrigin(void)
Returns the world space position of this NSXRInput.
Definition: NSXRInput.qc:31
virtual void InputFrame(void)
Run every single input event.
Definition: NSXRInput.qc:87
virtual void SetParentSpace(NSXRSpace)
Sets which NSXRSpace this input belongs to.
Definition: NSXRInput.qc:148
virtual xrinput_t GetType(void)
Returns the type of NSXRInput, check xrinput_t for details.
Definition: NSXRInput.qc:81
void NSXRInput(void)
Definition: NSXRInput.qc:18
virtual void SetType(xrinput_t)
Sets the NSXRInput type.
Definition: NSXRInput.qc:142
virtual unsigned int GetWeapon(void)
Returns the weapon this NSXRInput is wielding.
Definition: NSXRInput.qc:75
virtual vector GetVelocity(void)
Returns the current velocity of this NSXRInput.
Definition: NSXRInput.qc:57
This class represents a local client space in the world.
Definition: NSXRSpace.h:30