libultraship
Reimplementations of libultra (N64 SDK) functions for modern hardware
Loading...
Searching...
No Matches
ControllerAxisDirectionMapping.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4#include <string>
5#include <memory>
6
8
9#define MAX_AXIS_RANGE 85.0f
10
11namespace Ship {
12class ControlDeck;
13
16
19
28 public:
36 ControllerAxisDirectionMapping(PhysicalDeviceType physicalDeviceType, uint8_t portIndex, StickIndex stickIndex,
37 Direction direction, std::shared_ptr<ControlDeck> controlDeck = nullptr);
39
45
50 virtual int8_t GetMappingType();
51
56 virtual std::string GetAxisDirectionMappingId() = 0;
57
59 virtual void SaveToConfig() = 0;
60
62 virtual void EraseFromConfig() = 0;
63
69
74 void SetPortIndex(uint8_t portIndex);
75
76 std::shared_ptr<ControlDeck> GetControlDeck() const;
77
78 protected:
79 uint8_t mPortIndex;
82 std::shared_ptr<ControlDeck> mControlDeck;
83};
84} // namespace Ship
Maps a physical input to a virtual analog stick direction.
Definition ControllerAxisDirectionMapping.h:27
virtual int8_t GetMappingType()
Returns the mapping type identifier (e.g. gamepad, keyboard).
uint8_t mPortIndex
Definition ControllerAxisDirectionMapping.h:79
virtual void EraseFromConfig()=0
Removes this mapping from the application configuration.
StickIndex mStickIndex
Definition ControllerAxisDirectionMapping.h:80
Direction mDirection
Definition ControllerAxisDirectionMapping.h:81
std::shared_ptr< ControlDeck > mControlDeck
Definition ControllerAxisDirectionMapping.h:82
std::shared_ptr< ControlDeck > GetControlDeck() const
Direction GetDirection()
Returns the direction this mapping represents.
void SetPortIndex(uint8_t portIndex)
Sets the controller port index for this mapping.
virtual void SaveToConfig()=0
Persists this mapping to the application configuration.
virtual float GetNormalizedAxisDirectionValue()=0
Returns the current axis value normalised to [0, MAX_AXIS_RANGE].
ControllerAxisDirectionMapping(PhysicalDeviceType physicalDeviceType, uint8_t portIndex, StickIndex stickIndex, Direction direction, std::shared_ptr< ControlDeck > controlDeck=nullptr)
Constructs a ControllerAxisDirectionMapping.
virtual std::string GetAxisDirectionMappingId()=0
Returns a unique string identifier for this axis direction mapping.
Base class for controller mappings that represent a physical input.
Definition ControllerInputMapping.h:16
Core namespace for the libultraship engine framework.
Definition gfx_direct3d_common.h:14
PhysicalDeviceType
Identifies the category of a physical input device.
Definition PhysicalDeviceType.h:11
Direction
Identifies the direction component of an axis mapping.
Definition ControllerAxisDirectionMapping.h:18
@ UP
Definition ControllerAxisDirectionMapping.h:18
@ LEFT
Definition ControllerAxisDirectionMapping.h:18
@ DOWN
Definition ControllerAxisDirectionMapping.h:18
@ RIGHT
Definition ControllerAxisDirectionMapping.h:18
StickIndex
Identifies which analog stick an axis mapping applies to.
Definition ControllerAxisDirectionMapping.h:15
@ RIGHT_STICK
Definition ControllerAxisDirectionMapping.h:15
@ LEFT_STICK
Definition ControllerAxisDirectionMapping.h:15