|
Gainput
v1.0.0
|
A recorded sequence of input changes. More...
#include <GainputInputRecording.h>
Public Member Functions | |
| InputRecording (Allocator &allocator=GetDefaultAllocator()) | |
| Initializes the recording in an empty state. More... | |
| InputRecording (InputManager &manager, void *data, size_t size, Allocator &allocator=GetDefaultAllocator()) | |
| Initializes the recording from the given serialized data. More... | |
| void | AddChange (uint64_t time, DeviceId deviceId, DeviceButtonId buttonId, bool value) |
| Appends a device button change to the recording. More... | |
| void | AddChange (uint64_t time, DeviceId deviceId, DeviceButtonId buttonId, float value) |
| Appends a device button change to the recording. More... | |
| void | Clear () |
| Removes all state changes. | |
| bool | GetNextChange (uint64_t time, RecordedDeviceButtonChange &outChange) |
| Gets the next button change before and including the given time and returns it. More... | |
| void | Reset () |
| Resets the playback position. More... | |
| uint64_t | GetDuration () const |
| Returns what time frame this recording spans. | |
| size_t | GetSerializedSize () const |
| Returns the size required to serialize this recording. | |
| void | GetSerialized (InputManager &manager, void *data) const |
| Serializes this recording to the given buffer. More... | |
A recorded sequence of input changes.
The recording can be recorded to, played, or serialized/deserialized.
In order for input recording to be available, Gainput must have been built with GAINPUT_ENABLE_RECORDER defined.
| gainput::InputRecording::InputRecording | ( | Allocator & | allocator = GetDefaultAllocator() | ) |
Initializes the recording in an empty state.
| allocator | The allocator to be used for all memory allocations. |
| gainput::InputRecording::InputRecording | ( | InputManager & | manager, |
| void * | data, | ||
| size_t | size, | ||
| Allocator & | allocator = GetDefaultAllocator() |
||
| ) |
Initializes the recording from the given serialized data.
The recording is reconstructed from a previously serialized recording obtained through GetSerialized().
| manager | Used to resolve device and button references in the recording. |
| data | The serialized recording as obtained from GetSerialized(). |
| size | The length of the serialized recording as obtained from GetSerializedSize(). |
| allocator | The allocator to be used for all memory allocations. |
| void gainput::InputRecording::AddChange | ( | uint64_t | time, |
| DeviceId | deviceId, | ||
| DeviceButtonId | buttonId, | ||
| bool | value | ||
| ) |
Appends a device button change to the recording.
The changes must be added in chronological order, i.e. time must always greater or equal to the time AddChange() was last called with.
| time | The time elapsed before the change occurred. |
| deviceId | The ID of the device owning the button that changed. |
| buttonId | The ID of the button that changed. |
| value | The new value of the button. |
| void gainput::InputRecording::AddChange | ( | uint64_t | time, |
| DeviceId | deviceId, | ||
| DeviceButtonId | buttonId, | ||
| float | value | ||
| ) |
Appends a device button change to the recording.
The changes must be added in chronological order, i.e. time must always greater or equal to the time AddChange() was last called with.
| time | The time elapsed before the change occurred. |
| deviceId | The ID of the device owning the button that changed. |
| buttonId | The ID of the button that changed. |
| value | The new value of the button. |
| bool gainput::InputRecording::GetNextChange | ( | uint64_t | time, |
| RecordedDeviceButtonChange & | outChange | ||
| ) |
Gets the next button change before and including the given time and returns it.
| time | The time up to which to return changes. | |
| [out] | outChange | The change properties will be written to this if this function returns true. |
| void gainput::InputRecording::GetSerialized | ( | InputManager & | manager, |
| void * | data | ||
| ) | const |
Serializes this recording to the given buffer.
This function serializes this recording so that it can be saved and read back in and deserialized later.
| manager | Used to resolve device and button references in the recording. |
| data | A buffer of (at least) a size as returned by GetSerializedSize(). |
|
inline |
Resets the playback position.
After calling this function, GetNextChange() will return changes from the beginning of the recorded sequence of changes again.
1.8.13