vkmEngine 1.0.15
A C++ game engine · vkmengine.com
Loading...
Searching...
No Matches
input_command.h
1#pragma once
2
3#include <array>
4#include <cstdint>
5
6#include <glm/gtc/quaternion.hpp>
7
8namespace Vkm::Engine {
9
16inline constexpr uint32_t MAX_INPUT_ACTIONS = 32;
17
19inline constexpr uint32_t MAX_COMMAND_PAYLOAD = 16;
20
29 uint32_t sequence = 0;
30 uint32_t tick = 0;
31
33 std::array<float, MAX_INPUT_ACTIONS> axis{};
34
35 uint32_t pressed = 0;
36 uint32_t released = 0;
37
38 static_assert(
39 MAX_INPUT_ACTIONS <= 32,
40 "pressed / released carry one bit per action in a uint32_t, "
41 "so an action past bit 31 has nowhere to be recorded"
42 );
43
50 glm::quat view{1.0f, 0.0f, 0.0f, 0.0f};
51
55 std::array<uint8_t, MAX_COMMAND_PAYLOAD> payload{};
56 uint8_t payloadSize = 0;
57};
58
59} // namespace Vkm::Engine
Everything one simulation tick was told to do, as a value.
Definition input_command.h:28
std::array< float, MAX_INPUT_ACTIONS > axis
Per-action value, -1..1, indexed by InputMap::indexOf.
Definition input_command.h:33
uint32_t pressed
Bit per action: became active since the last command.
Definition input_command.h:35
uint32_t sequence
Monotonic command number; what an ack names.
Definition input_command.h:29
std::array< uint8_t, MAX_COMMAND_PAYLOAD > payload
Definition input_command.h:55
glm::quat view
Where the player was looking when this input was taken.
Definition input_command.h:50
uint32_t tick
Simulation tick this command drives.
Definition input_command.h:30
uint32_t released
Bit per action: stopped being active since the last command.
Definition input_command.h:36