17#ifndef FOOLSENGINE_INPUTSYSTEMDATA_H
18#define FOOLSENGINE_INPUTSYSTEMDATA_H
25#include <nlohmann/json.hpp>
111 struct InputAttributesType {
112 InputAttributesType() =
default;
190 return !(*
this < other) && !(other < *
this);
226 operator bool()
const {
299 return !(*
this < other) && !(other < *
this);
329 operator bool()
const {
404 operator bool()
const {
416 return !(*
this < other) && !(other < *
this);
518 mName{contextActionNamePair.second},
519 mContext{contextActionNamePair.first}
565 return !(*
this < other) && !(other < *
this);
727 ActionType::BUTTON, ActionType::ONE_AXIS,
728 ActionType::TWO_AXIS, ActionType::THREE_AXIS
853 {AxisFilter::X_POS,
"+x"},
854 {AxisFilter::X_NEG,
"-x"},
855 {AxisFilter::Y_POS,
"+y"},
856 {AxisFilter::Y_NEG,
"-y"},
857 {AxisFilter::Z_POS,
"+z"},
858 {AxisFilter::Z_NEG,
"-z"},
859 {AxisFilter::X_CHANGE_POS,
"+dx"},
860 {AxisFilter::X_CHANGE_NEG,
"-dx"},
861 {AxisFilter::Y_CHANGE_POS,
"+dy"},
862 {AxisFilter::Y_CHANGE_NEG,
"-dy"},
863 {AxisFilter::Z_CHANGE_POS,
"+dz"},
864 {AxisFilter::Z_CHANGE_NEG,
"-dz"},
872 {InputCombo::Trigger::ON_PRESS,
"on-press"},
873 {InputCombo::Trigger::ON_RELEASE,
"on-release"},
874 {InputCombo::Trigger::ON_CHANGE,
"on-change"},
875 {InputCombo::Trigger::ON_BUTTON_PRESS,
"on-button-press"},
876 {InputCombo::Trigger::ON_BUTTON_RELEASE,
"on-button-release"},
877 {InputCombo::Trigger::ON_BUTTON_CHANGE,
"on-button-change"},
885 {ActionValueType::STATE,
"state"},
886 {ActionValueType::CHANGE,
"change"},
893 void to_json(nlohmann::json& json,
const ToyMaker::InputAttributesType& inputAttributes);
899 void from_json(
const nlohmann::json& json, ToyMaker::InputAttributesType& inputAttributes);
905 void to_json(nlohmann::json& json,
const ToyMaker::InputSourceDescription& inputSourceDescription);
911 void from_json(
const nlohmann::json& json, ToyMaker::InputSourceDescription& inputSourceDescription);
917 void to_json(nlohmann::json& json,
const ToyMaker::InputFilter& inputFilter);
923 void from_json(
const nlohmann::json& json, ToyMaker::InputFilter& inputFilter);
929 void to_json(nlohmann::json& json,
const ToyMaker::InputCombo& inputCombo);
935 void from_json(
const nlohmann::json& json, ToyMaker::InputCombo& inputCombo);
941 void to_json(nlohmann::json& json,
const ToyMaker::ActionDefinition& actionDefinition);
947 void from_json(
const nlohmann::json& json, ToyMaker::ActionDefinition& actionDefinition);
955 (( (hash<uint32_t>{}(definition.
mControl))
956 ^ (hash<uint8_t>{}(definition.
mDevice) << 1) >> 1)
957 ^ (hash<uint8_t>{}(
static_cast<uint8_t
>(definition.
mDeviceType)) << 1) >> 1)
958 ^ (hash<uint8_t>{}(
static_cast<uint8_t
>(definition.
mControlType) << 1))
966 return hash<std::string>{}(definition.
mName);
974 (hash<ToyMaker::InputSourceDescription>{}(inputFilter.
mControl)
984 (((hash<ToyMaker::InputFilter>{}(inputBind.
mMainControl)
985 ^ (hash<ToyMaker::InputFilter>{}(inputBind.
mModifier1) << 1) >> 1)
986 ^ (hash<ToyMaker::InputFilter>{}(inputBind.
mModifier2) << 1) >> 1)
987 ^ (hash<ToyMaker::InputCombo::Trigger>{}(inputBind.
mTrigger) << 1) >> 1)
Namespace containing all class definitions and functions related to the ToyMaker engine.
Definition camera_system.hpp:20
The definition of a single action, including whether it represents state or change,...
Definition input_data.hpp:511
ActionDefinition()=default
Construct a new (empty) action definition object.
bool operator==(const ActionDefinition &other) const
Compares two action definitions for equality.
Definition input_data.hpp:564
::std::string mContext
The name of the context the action belongs to.
Definition input_data.hpp:553
ActionDefinition(const QualifiedActionName &contextActionNamePair)
Construct a new action definition object.
Definition input_data.hpp:517
::std::string mName
The name of the action.
Definition input_data.hpp:531
bool operator<(const ActionDefinition &other) const
Provides an implementation of the less than operator, mainly for use by the equality operator.
Definition input_data.hpp:575
ActionValueType mValueType
I'm not yet sure where this is used, since mAttributes already exists.
Definition input_data.hpp:547
InputAttributesType mAttributes
The same as in an InputSource, describes the type of data (normalized) this action is expected to hav...
Definition input_data.hpp:539
A struct containing meta-info that will be present for all types of actions.
Definition input_data.hpp:619
ActionType mType
The type of value associated with this action.
Definition input_data.hpp:649
ActionTrigger mTriggeredBy
The condition which caused this action to be signalled.
Definition input_data.hpp:624
bool mActivated
I'm not sure about this one.
Definition input_data.hpp:643
uint32_t mDuration
Unused for now, but presumably the duration an active input has been active.
Definition input_data.hpp:636
uint32_t mTimestamp
The time at which the action was signalled.
Definition input_data.hpp:630
Actions that have just one axis of data, eg., the accelerator on a car.
Definition input_data.hpp:664
double mValue
The actual value of the axis of this action.
Definition input_data.hpp:675
CommonActionData mCommonData
Common metadata belonging to this action.
Definition input_data.hpp:669
Actions described by 3 axes (I can't think of any examples for this)
Definition input_data.hpp:702
glm::dvec3 mValue
Three float values, normalized (or not, for values representing location)
Definition input_data.hpp:713
CommonActionData mCommonData
Common action metadata.
Definition input_data.hpp:707
Actions that have two axes of data. (Pointer locations, movement direction input, pitch+roll,...
Definition input_data.hpp:683
CommonActionData mCommonData
Common action metadata.
Definition input_data.hpp:688
glm::dvec2 mValue
Two float values, normalized (or not, for location states)
Definition input_data.hpp:694
ActionData(TwoAxisActionData twoAxisActionData)
Construct a new action data object based on already existing TwoAxisActionData.
Definition input_data.hpp:771
ActionData(ActionType actionType)
Construct a new action data object of a particular type. Called prior to all other ActionData constru...
Definition input_data.hpp:736
TwoAxisActionData mTwoAxisActionData
Two axis action data.
Definition input_data.hpp:813
static constexpr ActionType toType[4]
Array of action types so that 0 - BUTTON, 1 - ONE_AXIS, and so on.
Definition input_data.hpp:726
ActionData(uint8_t nAxes)
Construct a new Action Data object with nAxes axes.
Definition input_data.hpp:788
ActionData(ThreeAxisActionData threeAxisActionData)
Construct a new THREE_AXIS action data object based on already existing ThreeAxisActionData.
Definition input_data.hpp:779
OneAxisActionData mOneAxisActionData
One axis action data.
Definition input_data.hpp:807
ActionData(SimpleActionData simpleData)
Construct a new SIMPLE action data object, based on already existing SimpleActionData.
Definition input_data.hpp:753
ThreeAxisActionData mThreeAxisActionData
Three axis action data.
Definition input_data.hpp:819
CommonActionData mCommonData
Common or simple data.
Definition input_data.hpp:795
ActionData()
Construct a new SIMPLE action data object.
Definition input_data.hpp:746
SimpleActionData mSimpleData
Common or simple data.
Definition input_data.hpp:801
ActionData(OneAxisActionData oneAxisActionData)
Construct a new ONE_AXIS action data object based on already existing OneAxisActionData.
Definition input_data.hpp:762