Game of Ur 0.3.3
This is a computer adaptation of Game of Ur, written in C++ mainly using SDL and OpenGL.
Loading...
Searching...
No Matches
input_data.hpp File Reference

A collection of types used by the input system and any entities that have to interact with it. More...

#include <set>
#include <map>
#include <string>
#include <functional>
#include <nlohmann/json.hpp>
#include <glm/glm.hpp>

Go to the source code of this file.

Classes

struct  ToyMaker::InputAttributesType
 A class that, perhaps just as unnecessarily, stores a value of InputAttributesValueType. More...
 
struct  ToyMaker::InputSourceDescription
 Identifies a single control, such as a button, trigger, or joystick, on a single device. More...
 
struct  ToyMaker::InputFilter
 Filter that uniquely defines ONE axis of one control of one input belonging to one device. More...
 
struct  ToyMaker::InputCombo
 An input combo that whose value is recorded and mapped to an (axis of an) action value of some kind. More...
 
struct  ToyMaker::UnmappedInputValue
 An input state that hasn't yet been mapped to its corresponding action. More...
 
struct  ToyMaker::ActionDefinition
 The definition of a single action, including whether it represents state or change, whether it supports negative values, and the number of axes it has. More...
 
struct  ToyMaker::CommonActionData
 A struct containing meta-info that will be present for all types of actions. More...
 
struct  ToyMaker::OneAxisActionData
 Actions that have just one axis of data, eg., the accelerator on a car. More...
 
struct  ToyMaker::TwoAxisActionData
 Actions that have two axes of data. (Pointer locations, movement direction input, pitch+roll, etc.) More...
 
struct  ToyMaker::ThreeAxisActionData
 Actions described by 3 axes (I can't think of any examples for this) More...
 
union  ToyMaker::ActionData
 A union that may contain any one of SimpleActionData, OneAxisActionData, TwoAxisActionData, ThreeAxisActionData. More...
 
struct  std::hash< ToyMaker::InputSourceDescription >
 
struct  std::hash< ToyMaker::ActionDefinition >
 
struct  std::hash< ToyMaker::InputFilter >
 
struct  std::hash< ToyMaker::InputCombo >
 

Namespaces

namespace  ToyMaker
 Namespace containing all class definitions and functions related to the ToyMaker engine.
 
namespace  std
 STL namespace.
 

Typedefs

using ToyMaker::ActionName = ::std::string
 The name of an action whose meaning is known within a specific context.
 
using ToyMaker::ContextName = ::std::string
 The name of a context which contains definitions for actions that are valid within it.
 
typedef uint8_t ToyMaker::AxisFilterType
 A type with multiple uses.
 
typedef uint8_t ToyMaker::InputAttributesValueType
 A type that is quite possibly unnecessary now that DeviceType and ControlType exist.
 
typedef ::std::pair< DeviceType, ControlTypeToyMaker::InputSourceType
 A composite type which uniquely identifies a control attached to the platform running this application.
 
using ToyMaker::QualifiedActionName = ::std::pair<ContextName, ActionName>
 An identifier that fully names one action present in the project.
 
typedef CommonActionData ToyMaker::SimpleActionData
 Actions that ultimately act like a single button value, where mActivated is the state of the button.
 

Enumerations

enum class  ToyMaker::DeviceType : uint8_t {
  ToyMaker::DeviceType::NA , ToyMaker::DeviceType::MOUSE , ToyMaker::DeviceType::KEYBOARD , ToyMaker::DeviceType::CONTROLLER ,
  ToyMaker::DeviceType::TOUCH
}
 The type of input device that was responsible for creating the signal which will be mapped to an action. More...
 
enum class  ToyMaker::ControlType : uint8_t {
  ToyMaker::ControlType::NA , ToyMaker::ControlType::AXIS , ToyMaker::ControlType::MOTION , ToyMaker::ControlType::POINT ,
  ToyMaker::ControlType::BUTTON , ToyMaker::ControlType::RADIO
}
 A single device may have multiple buttons and other controls, each of which will correspond to a type of input listed here. More...
 
enum  ToyMaker::InputAttributes : InputAttributesValueType {
  ToyMaker::N_AXES =0x3 , ToyMaker::HAS_NEGATIVE =0x4 , ToyMaker::HAS_CHANGE_VALUE =0x8 , ToyMaker::HAS_BUTTON_VALUE =0x10 ,
  ToyMaker::HAS_STATE_VALUE =0x20 , ToyMaker::STATE_IS_LOCATION =0x40
}
 A collection of a few important input attribute value type values and masks. More...
 
enum  ToyMaker::AxisFilter : AxisFilterType {
  ToyMaker::SIMPLE =0x0 , X_POS =0x1 , X_NEG =0x5 , Y_POS =0x2 ,
  Y_NEG =0x6 , Z_POS =0x3 , Z_NEG =0x7 , X_CHANGE_POS =0x9 ,
  X_CHANGE_NEG =0xD , Y_CHANGE_POS =0xA , Y_CHANGE_NEG =0xE , Z_CHANGE_POS =0xB ,
  Z_CHANGE_NEG =0xF
}
 Enumeration of all possible axis filter values. More...
 
enum  ToyMaker::AxisFilterMask : AxisFilterType { ID =0x3 , SIGN =0x4 , CHANGE =0x8 }
 Important values used with AxisFilterType for determining the type, direction, and sign, of an input.
 
enum class  ToyMaker::ActionValueType : uint8_t { STATE , CHANGE }
 The type of value associated with this action.
 
enum class  ToyMaker::ActionType { BUTTON , ONE_AXIS , TWO_AXIS , THREE_AXIS }
 A seemingly redundant type that is a part of the ActionData struct and not the ActionDefinition struct.
 
enum class  ToyMaker::ActionTrigger : uint8_t { UPDATE , RESET }
 Helps describe what InputCombo related event was responsible for signaling this action.
 

Functions

 ToyMaker::NLOHMANN_JSON_SERIALIZE_ENUM (DeviceType, { {DeviceType::NA, "na"}, {DeviceType::MOUSE, "mouse"}, {DeviceType::KEYBOARD, "keyboard"}, {DeviceType::TOUCH, "touch"}, {DeviceType::CONTROLLER, "controller"}, })
 
 ToyMaker::NLOHMANN_JSON_SERIALIZE_ENUM (ControlType, { {ControlType::NA, "na"}, {ControlType::AXIS, "axis"}, {ControlType::MOTION, "motion"}, {ControlType::POINT, "point"}, {ControlType::BUTTON, "button"}, {ControlType::RADIO, "radio"}, })
 
 ToyMaker::NLOHMANN_JSON_SERIALIZE_ENUM (AxisFilter, { {AxisFilter::SIMPLE, "simple"}, {AxisFilter::X_POS, "+x"}, {AxisFilter::X_NEG, "-x"}, {AxisFilter::Y_POS, "+y"}, {AxisFilter::Y_NEG, "-y"}, {AxisFilter::Z_POS, "+z"}, {AxisFilter::Z_NEG, "-z"}, {AxisFilter::X_CHANGE_POS, "+dx"}, {AxisFilter::X_CHANGE_NEG, "-dx"}, {AxisFilter::Y_CHANGE_POS, "+dy"}, {AxisFilter::Y_CHANGE_NEG, "-dy"}, {AxisFilter::Z_CHANGE_POS, "+dz"}, {AxisFilter::Z_CHANGE_NEG, "-dz"}, })
 
 ToyMaker::NLOHMANN_JSON_SERIALIZE_ENUM (InputCombo::Trigger, { {InputCombo::Trigger::ON_PRESS, "on-press"}, {InputCombo::Trigger::ON_RELEASE, "on-release"}, {InputCombo::Trigger::ON_CHANGE, "on-change"}, {InputCombo::Trigger::ON_BUTTON_PRESS, "on-button-press"}, {InputCombo::Trigger::ON_BUTTON_RELEASE, "on-button-release"}, {InputCombo::Trigger::ON_BUTTON_CHANGE, "on-button-change"}, })
 
 ToyMaker::NLOHMANN_JSON_SERIALIZE_ENUM (ActionValueType, { {ActionValueType::STATE, "state"}, {ActionValueType::CHANGE, "change"}, })
 
void ToyMaker::to_json (nlohmann::json &json, const ToyMaker::InputAttributesType &inputAttributes)
 
void ToyMaker::from_json (const nlohmann::json &json, ToyMaker::InputAttributesType &inputAttributes)
 
void ToyMaker::to_json (nlohmann::json &json, const ToyMaker::InputSourceDescription &inputSourceDescription)
 
void ToyMaker::from_json (const nlohmann::json &json, ToyMaker::InputSourceDescription &inputSourceDescription)
 
void ToyMaker::to_json (nlohmann::json &json, const ToyMaker::InputFilter &inputFilter)
 
void ToyMaker::from_json (const nlohmann::json &json, ToyMaker::InputFilter &inputFilter)
 
void ToyMaker::to_json (nlohmann::json &json, const ToyMaker::InputCombo &inputCombo)
 
void ToyMaker::from_json (const nlohmann::json &json, ToyMaker::InputCombo &inputCombo)
 
void ToyMaker::to_json (nlohmann::json &json, const ToyMaker::ActionDefinition &actionDefinition)
 
void ToyMaker::from_json (const nlohmann::json &json, ToyMaker::ActionDefinition &actionDefinition)
 

Variables

const ::std::map< InputSourceType, InputAttributesTypeToyMaker::kInputSourceTypeAttributes
 A mapping from each type of input control to the attributes associated with it.
 

Detailed Description

A collection of types used by the input system and any entities that have to interact with it.

Author
Zoheb Shujauddin (zoheb.nosp@m.2424.nosp@m.@gmai.nosp@m.l.co.nosp@m.m)
Version
0.3.2
Date
2025-08-31

The input system, in a nutshell, breaks up all inputs from every source into their constituent single axis values. Each such value is then remapped to one axis of one action.