wavelength
1.0.0
Loading...
Searching...
No Matches
inputmap.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <vector>
4
5
#include "
os/binstream.h
"
6
#include "
script/dataarray.h
"
7
15
class
InputMap
{
16
public
:
18
static
constexpr
int
kButtonCount
= 24;
19
21
static
constexpr
int
kStickCount
= 2;
22
29
InputMap
();
30
38
InputMap
(
const
InputMap
&other);
39
44
~InputMap
();
45
54
InputMap
&
operator=
(
const
InputMap
&other);
55
64
int
GetButtonAction
(
int
nButton);
65
74
void
SetButtonAction
(
int
nButton,
int
nAction);
75
84
void
SetStickAction
(
int
nStick,
int
nAction);
85
94
int
GetStickAction
(
int
nStick);
95
104
int
FindStick
(
int
nAction);
105
116
void
Load
(
const
DataArray
*pConfig);
117
124
void
LoadDefaults
();
125
134
void
Save
(
BinStream
&stream)
const
;
135
146
void
Load
(
BinStream
&stream);
147
148
private
:
149
std::vector<int> mButtons;
// The action of each button, indexed by button.
150
std::vector<int> mSticks;
// The action of each stick, indexed by stick.
151
};
152
162
BinStream
&
operator<<
(
BinStream
&stream,
const
InputMap
&map);
163
173
BinStream
&
operator>>
(
BinStream
&stream,
InputMap
&map);
binstream.h
BinStream
Stream of raw bytes, the base of the memory, file, and network streams.
Definition
binstream.h:22
DataArray
Reference-counted array of script data nodes.
Definition
dataarray.h:20
InputMap
The actions a player's controller buttons and analogue sticks are bound to.
Definition
inputmap.h:15
InputMap::Load
void Load(BinStream &stream)
Read the bindings Save() wrote.
InputMap::kStickCount
static constexpr int kStickCount
The number of analogue sticks the map binds.
Definition
inputmap.h:21
InputMap::InputMap
InputMap(const InputMap &other)
Construct a copy of another map.
InputMap::kButtonCount
static constexpr int kButtonCount
The number of controller buttons the map binds.
Definition
inputmap.h:18
InputMap::GetButtonAction
int GetButtonAction(int nButton)
Report the action a controller button is bound to.
InputMap::SetButtonAction
void SetButtonAction(int nButton, int nAction)
Bind a controller button to an action.
InputMap::Save
void Save(BinStream &stream) const
Write the number of buttons, the button bindings, the number of sticks, and the stick bindings.
InputMap::operator=
InputMap & operator=(const InputMap &other)
Copy the button and stick bindings of another map.
InputMap::~InputMap
~InputMap()
InputMap::SetStickAction
void SetStickAction(int nStick, int nAction)
Bind an analogue stick to an action.
InputMap::Load
void Load(const DataArray *pConfig)
Load the bindings a configuration array lists.
InputMap::GetStickAction
int GetStickAction(int nStick)
Report the action an analogue stick is bound to.
InputMap::InputMap
InputMap()
Build a map with every button and stick binding cleared.
InputMap::FindStick
int FindStick(int nAction)
Find the analogue stick bound to an action.
InputMap::LoadDefaults
void LoadDefaults()
Load the bindings the "input_map" entry of the "db" configuration section lists.
dataarray.h
operator>>
BinStream & operator>>(BinStream &stream, InputMap &map)
Read a map as InputMap::Load() does.
operator<<
BinStream & operator<<(BinStream &stream, const InputMap &map)
Write a map as InputMap::Save() does.
src
game
inputmap.h
Generated by
1.15.0