Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/game/StarInput.hpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2023-07-02 08:16:14 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2023-07-02 08:16:14 +1000
commit3fc7a85a525ad98e44268fed3f3852ba4e6e7336 (patch)
treeb451b4d72e8d2dcaf5cd629c2b4b639fde11f987 /source/game/StarInput.hpp
parent15b0e9946049946133c9c932ef23d06a665f63fb (diff)
More work on the Input system
Diffstat (limited to 'source/game/StarInput.hpp')
-rw-r--r--source/game/StarInput.hpp20
1 files changed, 7 insertions, 13 deletions
diff --git a/source/game/StarInput.hpp b/source/game/StarInput.hpp
index f329cc2..efe68fb 100644
--- a/source/game/StarInput.hpp
+++ b/source/game/StarInput.hpp
@@ -20,12 +20,6 @@ namespace Star {
class Input {
public:
- struct NoBind {
- String error;
-
- NoBind(String err);
- };
-
struct KeyBind {
Key key = Key::Zero;
KeyMod mods = KeyMod::NoMod;
@@ -51,27 +45,27 @@ namespace Star {
ControllerButton button = ControllerButton::Invalid;
};
- typedef Variant<NoBind, KeyBind, MouseBind, ControllerBind> Bind;
+ typedef MVariant<KeyBind, MouseBind, ControllerBind> Bind;
static Bind bindFromJson(Json const& json);
static Json bindToJson(Bind const& bind);
- struct Category;
+ struct BindCategory;
struct BindEntry {
// The internal ID of this entry.
String id;
- // The category this entry belongs to.
- String category;
// The user-facing name of this entry.
String name;
+ // The category this entry belongs to.
+ BindCategory const* category;
// The default binds.
List<Bind> defaultBinds;
// The user-configured binds.
List<Bind> customBinds;
- BindEntry(Json const& config, Category const& category);
+ BindEntry(String entryId, Json const& config, BindCategory const& parentCategory);
};
struct BindRef {
@@ -91,11 +85,11 @@ namespace Star {
struct BindCategory {
String id;
String name;
- Json meta;
+ Json config;
StringMap<BindEntry> entries;
- BindCategory(Json const& data);
+ BindCategory(String categoryId, Json const& categoryConfig);
};
struct InputState {