11#include <glm/gtc/quaternion.hpp>
13#include "platform/input/input_command.h"
14#include "platform/input/input_handle.h"
16namespace Vkm::Engine {
32 inline constexpr const char*
UI_CLICK =
"UI/Click";
41enum class InputSource : uint8_t {
52 InputSource source = InputSource::Key;
67 ~InputMap() =
default;
69 InputMap(
const InputMap& other) =
delete;
70 InputMap& operator=(
const InputMap& other) =
delete;
72 InputMap(InputMap && other) =
delete;
73 InputMap& operator=(InputMap && other) =
delete;
106 const std::vector<InputBinding>&
bindings(std::string_view action)
const;
173 void setView(
const glm::quat& view) { m_view = view; }
205 bool held(std::string_view action)
const;
229 float axis(std::string_view action)
const;
287 const glm::vec2&
pointer()
const {
return m_pointer; }
305 float wheel()
const {
return m_wheel; }
324 std::u32string_view
text()
const {
return m_text; }
335 bool typed(
int key)
const {
return key >= 0 && key <= MAX_KEY && m_typed[static_cast<size_t>(key)]; }
358 std::vector<InputBinding> bindings;
362 bool wasActive =
false;
369 enum class Holder : uint8_t {
389 void defineEngineActions();
397 const Action* find(std::string_view action)
const;
407 Action& mutableAction(std::string_view action);
415 void assignSlot(Action& entry, std::string_view action);
431 bool heldElsewhere(
const InputBinding& binding,
bool down,
bool hostHas,
bool uiHas,
bool forUI);
439 std::map<std::string, Action, std::less<>> m_actions;
441 glm::vec2 m_pointer{0.0f};
442 glm::vec2 m_pointerDelta{0.0f};
443 float m_wheel = 0.0f;
444 float m_uiWheel = 0.0f;
446 std::u32string m_text;
447 std::bitset<MAX_KEY + 1> m_typed;
449 InputCommand m_command;
450 glm::quat m_view{1.0f, 0.0f, 0.0f, 0.0f};
451 uint32_t m_pendingPressed = 0;
452 uint32_t m_pendingReleased = 0;
453 uint32_t m_nextSequence = 1;
454 uint32_t m_nextSlot = 0;
456 bool m_pointerOverUI =
false;
463 std::vector<HeldPress> m_heldPresses;
What an authoring host tells the engine about the frame it draws over.
Definition host_chrome.h:18