Toast Engine
Loading...
Searching...
No Matches
input::ITrigger Class Referenceabstract

Polymorphic base for all triggers. More...

#include <trigger.hpp>

Inheritance diagram for input::ITrigger:

Classes

struct  Result
 Outcome of evaluating a trigger for one frame. More...

Public Member Functions

 ITrigger (const ITrigger &)=default
auto operator= (const ITrigger &) -> ITrigger &=default
virtual auto evaluate (const InputSample &sample, const EvalContext &ctx) -> Result=0
 Evaluates the trigger against the current input sample.
virtual auto name () const -> std::string_view=0

Static Public Member Functions

static auto fromToml (const toml::table &table, ValueType vt) -> std::shared_ptr< ITrigger >
 Builds a trigger from a TOML table keyed by its "name" field.

Detailed Description

Polymorphic base for all triggers.

Member Function Documentation

◆ evaluate()

virtual auto input::ITrigger::evaluate ( const InputSample & sample,
const EvalContext & ctx ) -> Result
pure virtual

Evaluates the trigger against the current input sample.

Parameters
sampleRaw input for the bound keycode this frame
ctxFrame context including delta time and viewport metrics
Returns
The contributed value and any discrete events fired

Implemented in input::Axis1DTrigger, input::Axis2DTrigger, input::CursorTrigger, input::HoldTrigger, input::PulseTrigger, input::ReleaseTrigger, and input::StartTrigger.

◆ fromToml()

auto input::ITrigger::fromToml ( const toml::table & table,
ValueType vt ) -> std::shared_ptr< ITrigger >
static

Builds a trigger from a TOML table keyed by its "name" field.

Parameters
tableThe [[trigger]] table
vtThe value domain of the owning action, used to coerce value fields
Returns
A new trigger, or nullptr when the name is unknown
Here is the caller graph for this function:

The documentation for this class was generated from the following files:
  • engine/src/toast/input/trigger.hpp
  • engine/src/toast/input/trigger.cpp