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 System

Files

file  input_system.hpp
 

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...
 
class  ToyMaker::InputManager
 The class that acts as the main interface between the rest of the project and the input system. More...
 
class  ToyMaker::IActionHandler
 Class interface for systems that wish to be notified when action events occur in an action context. More...
 
class  ToyMaker::ActionContext
 A container for actions that make sense within a given context. More...
 
class  ToyMaker::ActionDispatch
 An object responsible for tracking action listeners for a given project. More...
 
class  ToyMaker::FixedActionBinding
 A class representing the connection between an Action generated by the InputManager, and a BaseSimObjectAspect method that is interested in handling the action. More...
 

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.
 

Variables

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

Detailed Description

Typedef Documentation

◆ ActionName

using ToyMaker::ActionName = ::std::string

The name of an action whose meaning is known within a specific context.

See also
ContextName

◆ AxisFilterType

typedef uint8_t ToyMaker::AxisFilterType

A type with multiple uses.

The bits of this type signify a single axis, in the positive or negative direction. They also determine whether the value is that of a change, or of a state.

Some examples,

  • State: Trigger value, tablet pen pressure, pointer location on an axis
  • Change: Mouse movement on an axis, button pressed or unpressed, touch drag

◆ InputAttributesValueType

A type that is quite possibly unnecessary now that DeviceType and ControlType exist.

But either way. Lists various attributes of the control that it is associated with. (State/change? Axis/button? Simple? One-axis? Two-axes?)

Enumeration Type Documentation

◆ AxisFilter

Enumeration of all possible axis filter values.

Enumerator
SIMPLE 

V- lines up with the bit representing sign in actionAttributes.

◆ ControlType

enum class ToyMaker::ControlType : uint8_t
strong

A single device may have multiple buttons and other controls, each of which will correspond to a type of input listed here.

Enumerator
NA 

No valid (or known) input device control

AXIS 

Control that emits continuous values b/w 0 and 1, or -1 and 1 (like analog sticks, or controller triggers)

MOTION 

Control indicating a change in position of something (like a mouse movement, or a touch drag)

POINT 

Control that maps to a point on the screen, or on the input device itself (like a touch screen tap, or a mouse click)

BUTTON 

Button, which may either be pressed or not pressed (like a keyboard key)

RADIO 

A collection of buttons where only one may be active at a time (like a d-pad)

◆ DeviceType

enum class ToyMaker::DeviceType : uint8_t
strong

The type of input device that was responsible for creating the signal which will be mapped to an action.

Enumerator
NA 

No valid input device

MOUSE 

A continuous pointer device

KEYBOARD 

A collection of buttons

CONTROLLER 

Various button, axis, touch inputs

TOUCH 

As in touch screen devices

◆ InputAttributes

A collection of a few important input attribute value type values and masks.

Each value corresponds to some aspect that an input control might have. The input attributes value, filtered through these enums, tells you of the capabilities of the control.

Enumerator
N_AXES 

The number of axes present on the control (or 0 for buttons), retrieved using this as a mask

HAS_NEGATIVE 

Lines up with the bit representing sign in AxisFilter, indicates that a control has negative values

HAS_CHANGE_VALUE 

Does the control report changes? (mouse motion, touch pad drag)

HAS_BUTTON_VALUE 

Does the control also act as a button sometimes?

HAS_STATE_VALUE 

Does the control have a state? (gyros don't, mouse pointers, touch pads, triggers, analog sticks, buttons all do.)

STATE_IS_LOCATION 

Does the control sometimes indicate a location? (like mouse pointers, touch pads, tablet pen hovers)