VR-Engage  2.2
Loading...
Searching...
No Matches
zoomControl.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4*******************************************************************************/
5//! \file zoomControl.h
6//! \brief Component that provides magnification control to the player's view
7//! \ingroup vreCommonComponents
8
9#pragma once
10
13
14#include "vreUtil/initializer.h"
15
16namespace makVre
17{
18class DtVreMessage;
19
21
23{
24//! \ingroup RoleConfigParams
25//! \defgroup ZoomControlRoleParams Zoom Control Role Parameters
26//! \roleInherits{EntityControlLogicRoleParams}
27//! Configuration Options for zoom control role.
28//! @{
29
30//! \vreRoleParamRequired{zoomLevels,table,zoomControl,"{1,2,4,8,16,32}",Array of magnification levels available for zooming.}
31constexpr const char* zoomLevels = "zoomLevels";
32
33//! @}
34} // namespace ZoomControlConfig
35
36//! \brief Type identifier for DtZoomControl component
37constexpr const char* DtZoomControlType = "DtZoomControl";
38
39//! \brief Component that provides zoom control functionality for player views
40//!
41//! DtZoomControl manages view magnification through a set of configurable zoom levels.
42//! It provides input handlers for zooming in and out, updates state attributes to
43//! reflect current zoom levels, and adjusts aim input scaling proportionally to the zoom
44//! level to maintain consistent aiming sensitivity at different magnifications.
46{
47public:
48 //! \brief Constructor for DtZoomControl
49 //!
50 //! Initializes the zoom control component and checks out the VR-Engage ground feature license
52
53 //! \brief Virtual destructor for DtZoomControl
54 virtual ~DtZoomControl() override;
55
56 //! \brief Initializes the zoom control component
57 //! \param player Pointer to the player station this component belongs to
58 //! \param config Configuration table containing zoom settings
59 //! \return True if initialization succeeded, false otherwise
60 //!
61 //! Sets up zoom levels from configuration or uses default levels if not specified,
62 //! initializes state attributes, and configures input handlers for zoom controls
63 virtual bool initialize(DtPlayerStation* player, DtInitTable& config) override;
64 //! \brief Shuts down the zoom control component
65 //!
66 //! Cleans up input logic and performs base class shutdown operations
67 virtual void shutdown() override;
68
69 //! \brief Returns the type identifier for this component
70 //! \return The type string for DtZoomControl
71 virtual const char* type() const override;
72
73 //! \brief Input handler for zooming in
74 //! \param val Input value (non-zero to trigger zoom)
75 //!
76 //! Increases the zoom index to the next higher magnification level and updates
77 //! state attributes with the new zoom value and adjusted aim sensitivity
78 virtual void zoomIn(double val);
79
80 //! \brief Input handler for zooming out
81 //! \param val Input value (non-zero to trigger zoom)
82 //!
83 //! Decreases the zoom index to the next lower magnification level and updates
84 //! state attributes with the new zoom value and adjusted aim sensitivity
85 virtual void zoomOut(double val);
86
87 //! \brief Input handler for incremental zooming
88 //! \param val Input value (positive to zoom in, negative to zoom out)
89 //!
90 //! Calls either zoomIn or zoomOut based on the sign of the input value
91 virtual void zoom(float val);
92
93protected:
94 //! \brief Input logic that handles mapping of input actions to zoom functions
96
97 //! \brief Collection of available zoom magnification levels
98 std::vector<double> myZoomLevels;
99
100 //! \brief Current index into the zoom levels array
102};
103} // namespace makVre
DtEntityControlLogic()
Constructor.
Table-based access to Lua state for configuration data.
Definition initializer.h:38
Class for managing input configuration and handling in VR-Engage.
Definition inputLogic.h:35
virtual DtPlayerStation & player()
Gets the player station.
Class for managing the user interface for engaged roles.
Definition playerStation.h:51
Abstract base class for all VREngage messages.
Definition vreMessage.h:50
Component for managing weapon resources, equipment, and related state attributes.
Definition weaponResourceLogic.h:45
virtual void zoomIn(double val)
Input handler for zooming in.
virtual void shutdown() override
Shuts down the zoom control component.
DtInputLogic myInputLogic
Input logic that handles mapping of input actions to zoom functions.
Definition zoomControl.h:95
virtual void zoom(float val)
Input handler for incremental zooming.
int myZoomIndex
Current index into the zoom levels array.
Definition zoomControl.h:101
virtual void zoomOut(double val)
Input handler for zooming out.
std::vector< double > myZoomLevels
Collection of available zoom magnification levels.
Definition zoomControl.h:98
virtual ~DtZoomControl() override
Virtual destructor for DtZoomControl.
DtZoomControl()
Constructor for DtZoomControl.
virtual const char * type() const override
Returns the type identifier for this component.
virtual bool initialize(DtPlayerStation *player, DtInitTable &config) override
Initializes the zoom control component.
Defines the logic for controlling entities in VR-Engage.
constexpr const char * zoomLevels
\vreRoleParamRequired{zoomLevels,table,zoomControl,"{1,2,4,8,16,32}",Array of magnification levels av...
Definition zoomControl.h:31
Defines export/import macros for the vreCommonComponents library.
#define VRECOMMONCOMPONENTS_DLL
DLL export/import macro for the vreCommonComponents library.
Definition export.h:28
Provides configuration initialization for VREngage components.
Definition zoomControl.h:23
Include export definitions for this library.
Definition glsVreMessageUtil.h:49
constexpr const char * DtZoomControlType
Type identifier for DtZoomControl component.
Definition zoomControl.h:37