Toast Engine
Loading...
Searching...
No Matches
input_action.hpp
Go to the documentation of this file.
1
8
9#pragma once
10#include <string>
11#include <toast/assets/data.hpp>
12
13namespace assets {
14// clang-format off
15
19enum class ActionValueType : uint8_t { action_0d, action_1d, action_2d };
20
27enum class AccumulationType : uint8_t { highest, average };
28
29// clang-format on
30
34class TOAST_API Action : public Data {
35public:
36 explicit Action(const toml::table& table, Handle<Schema> schema = {});
37
38 [[nodiscard]]
39 auto type() const -> std::string_view override {
40 return "input_action";
41 }
42
44 [[nodiscard]]
45 auto get() const -> toml::table;
46 [[nodiscard]]
47 auto name() const noexcept -> std::string_view;
48 [[nodiscard]]
49 auto functionName() const noexcept -> std::string_view;
50 [[nodiscard]]
51 auto description() const noexcept -> std::string_view;
52 [[nodiscard]]
53 auto valueType() const noexcept -> ActionValueType;
54 [[nodiscard]]
55 auto accumulation() const noexcept -> AccumulationType;
56
57protected:
58 void onReloaded() override;
59
60private:
61 void readFields();
62
63 std::string m_name;
64 std::string m_function_name;
65 std::string m_description;
66 ActionValueType m_value_type = ActionValueType::action_0d;
67 AccumulationType m_accumulation = AccumulationType::highest;
68};
69
70}
auto accumulation() const noexcept -> AccumulationType
Definition input_assets.cpp:77
auto valueType() const noexcept -> ActionValueType
Definition input_assets.cpp:73
auto description() const noexcept -> std::string_view
Definition input_assets.cpp:69
auto get() const -> toml::table
Definition input_assets.cpp:57
auto functionName() const noexcept -> std::string_view
Definition input_assets.cpp:65
auto name() const noexcept -> std::string_view
Definition input_assets.cpp:61
Type-safe smart pointer for assets.
Definition core_types.hpp:149
Typed data asset backed by schema-driven TOML.
ActionValueType
Value domain an action operates in.
Definition input_action.hpp:19
AccumulationType
How an action combines values coming from several binds.
Definition input_action.hpp:27