libultraship
Reimplementations of libultra (N64 SDK) functions for modern hardware
Loading...
Searching...
No Matches
ControllerButtonMapping.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4#include <string>
5#include <memory>
6
8
9namespace Ship {
10class ControlDeck;
11
12#ifndef CONTROLLERBUTTONS_T
13#define CONTROLLERBUTTONS_T uint16_t
14#endif
15
24 public:
31 ControllerButtonMapping(PhysicalDeviceType physicalDeviceType, uint8_t portIndex, CONTROLLERBUTTONS_T bitmask,
32 std::shared_ptr<ControlDeck> controlDeck = nullptr);
34
39 virtual std::string GetButtonMappingId() = 0;
40
46
51 virtual void UpdatePad(CONTROLLERBUTTONS_T& padButtons) = 0;
52
57 virtual int8_t GetMappingType();
58
63 void SetPortIndex(uint8_t portIndex);
64 std::shared_ptr<ControlDeck> GetControlDeck() const;
65
67 virtual void SaveToConfig() = 0;
68
70 virtual void EraseFromConfig() = 0;
71
72 protected:
73 uint8_t mPortIndex;
75 std::shared_ptr<ControlDeck> mControlDeck;
76};
77} // namespace Ship
#define CONTROLLERBUTTONS_T
Definition ControllerButtonMapping.h:13
Maps a physical input to a virtual controller button.
Definition ControllerButtonMapping.h:23
void SetPortIndex(uint8_t portIndex)
Sets the controller port index for this mapping.
virtual void UpdatePad(CONTROLLERBUTTONS_T &padButtons)=0
Reads the physical input state and sets the corresponding bits in padButtons.
std::shared_ptr< ControlDeck > GetControlDeck() const
std::shared_ptr< ControlDeck > mControlDeck
Definition ControllerButtonMapping.h:75
ControllerButtonMapping(PhysicalDeviceType physicalDeviceType, uint8_t portIndex, CONTROLLERBUTTONS_T bitmask, std::shared_ptr< ControlDeck > controlDeck=nullptr)
Constructs a ControllerButtonMapping.
virtual void EraseFromConfig()=0
Removes this mapping from the application configuration.
CONTROLLERBUTTONS_T mBitmask
Definition ControllerButtonMapping.h:74
CONTROLLERBUTTONS_T GetBitmask()
Returns the button bitmask this mapping is bound to.
uint8_t mPortIndex
Definition ControllerButtonMapping.h:73
virtual int8_t GetMappingType()
Returns the mapping type identifier (e.g. gamepad, keyboard).
virtual std::string GetButtonMappingId()=0
Returns a unique string identifier for this button mapping.
virtual void SaveToConfig()=0
Persists this mapping to the application configuration.
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