4#include <foundation/Common.h>
5#include <foundation/WindowsKeycode.h>
7#include <unordered_map>
9#include "DrawContext.h"
10#include "foundation/KeyToName.h"
37struct std::hash<Andromenda::ActionInputMapping>
44 using Callback = std::function<void()>;
64 explicit Action() :
Text(L
"") {}
80 std::unordered_map<ActionInputMapping, Action> m_ActionMap;
85 const Action *getByMouseButton(MouseButton button);
88 ActionRegistry() =
default;
94 void Register(
const Keycode &keycode,
const WideString &actionText,
const Callback &callback,
95 MouseButton button = MouseButton::None);
108 void Handle(
const int32 &key)
const;
void DrawActionsAt(DrawContext &context, const Int2 &position) const
Draws helper text with availible actions and corresponding keycode.
Definition ActionRegistry.cpp:47
void Register(const Keycode &keycode, const WideString &actionText, const Callback &callback, MouseButton button=MouseButton::None)
Registers given text and callback to given key.
Definition ActionRegistry.cpp:18
void Handle(const int32 &key) const
Lookups action with given key and calls action's callback.
Definition ActionRegistry.cpp:29
void HandleMouse(const MouseButton &button)
Lookups action with given mouse button and calls action's callback.
Definition ActionRegistry.cpp:38
void Clear()
Deletes all actions.
Definition ActionRegistry.cpp:27
Represents a mutable sequence of utf-16 characters, providing various member functions for string man...
Definition WideString.h:14
Represents key to callback named object.
Definition ActionRegistry.h:51
Callback OnAction
Callback that will be called when action is performed.
Definition ActionRegistry.h:62
WideString Text
Action text.
Definition ActionRegistry.h:56
A utility which contains all essential class instances and functions for rendering objects.
Definition DrawContext.h:14
Represents a two component vector. Components are 32-bit and they are signed.
Definition Int2.h:11