VR-Engage  2.2
Loading...
Searching...
No Matches
inputDevice.h
Go to the documentation of this file.
1/******************************************************************************
2** Copyright (c) 2025 MAK Technologies, Inc.
3** All rights reserved.
4******************************************************************************/
5
6//! \file
7//! \brief Abstract base class for input device implementations
8
9#pragma once
10
11#include "vreInput/export.h"
12
13namespace makVre
14{
15//! Forward declarations
17
18//! \brief Abstract base class for hardware input device implementations
19//!
20//! This class provides a common interface for all input devices (gamepad, joystick, keyboard, etc.).
21//! Instances are owned by a DtVreInputManager. Derived classes receive input from specific hardware
22//! device APIs, map these inputs to DtInputData structures, and then call processInput() in the
23//! DtVreInputManager to handle the input events.
25{
26public:
27 //! \brief Default constructor
29 //! \brief Virtual destructor
30 virtual ~DtInputDevice() {};
31
32 //! \brief Copy constructor (deleted)
33 //!
34 //! Input devices cannot be copied due to hardware abstraction requirements
35 DtInputDevice(const DtInputDevice& mapping) = delete;
36
37 //! \brief Assignment operator (deleted)
38 //!
39 //! Input devices cannot be assigned due to hardware abstraction requirements
41
42 //! \brief Initialize the device with a reference to the input manager
43 //!
44 //! Sets up the device and prepares it to receive input events from hardware.
45 //!
46 //! \param mgr Reference to the input manager that owns this device
47 //! \return True if initialization succeeded, false if the device failed (e.g., hardware not present)
48 virtual bool init(DtVreInputManager& mgr) = 0;
49
50 //! \brief Update method called each frame by the input manager
51 //!
52 //! Allows the device to poll for input, handle timing-related events,
53 //! and perform any per-frame processing needed.
54 //!
55 //! \param dt Delta time in seconds since the last frame
56 virtual void tick(double dt) = 0;
57
58 //! \brief Shutdown the device and release hardware resources
59 //!
60 //! Disconnects from the hardware device and stops receiving input events.
61 //! Should clean up any resources allocated during initialization.
62 virtual void shutdown() = 0;
63
64 //! \brief Report the current state of all buttons, axes, and other inputs
65 //!
66 //! Sends input events for the current state of all device controls without
67 //! requiring actual hardware input. Useful for initializing the system with
68 //! the current device state or for testing.
69 virtual void reportCurrentState() = 0;
70
71protected:
72 //! \brief Pointer to the input manager that owns this device
73 //!
74 //! Used to send input events to the manager for processing
76};
77
78} // namespace makVre
virtual void reportCurrentState()=0
Report the current state of all buttons, axes, and other inputs.
virtual void shutdown()=0
Shutdown the device and release hardware resources.
virtual void tick(double dt)=0
Update method called each frame by the input manager.
DtInputDevice(const DtInputDevice &mapping)=delete
Copy constructor (deleted)
DtInputDevice()
Default constructor.
Definition inputDevice.h:28
virtual bool init(DtVreInputManager &mgr)=0
Initialize the device with a reference to the input manager.
virtual ~DtInputDevice()
Virtual destructor.
Definition inputDevice.h:30
DtInputDevice & operator=(const DtInputDevice &)=delete
Assignment operator (deleted)
DtVreInputManager * myManager
Pointer to the input manager that owns this device.
Definition inputDevice.h:75
Central manager for input device handling, action mapping, and input processing.
Definition vreInputManager.h:81
Defines DLL export/import macros for the vreInput library.
#define VREINPUT_DLL
DLL export/import macro for the vreInput library.
Definition export.h:25
Include export definitions for this library.
Definition glsVreMessageUtil.h:49