Toast Engine
Loading...
Searching...
No Matches
trigger.hpp File Reference

Triggers turn a raw input sample into an action value and discrete events. More...

#include "parse_util.hpp"
#include "value.hpp"
#include <cmath>
#include <glm/glm.hpp>
#include <string_view>
#include <toml++/toml.hpp>
Include dependency graph for trigger.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  input::ITrigger
 Polymorphic base for all triggers. More...
struct  input::ITrigger::Result
 Outcome of evaluating a trigger for one frame. More...
class  input::StartTrigger
 Fires once when the input goes from off to on. More...
class  input::ReleaseTrigger
 Fires once when the input goes from on to off. More...
class  input::HoldTrigger
 Reports a hold every frame while the input is on. More...
class  input::PulseTrigger
 Like a hold, but reports a hold once every rate seconds instead of every frame. More...
class  input::Axis1DTrigger
 Continuous 1D axis input. More...
class  input::Axis2DTrigger
 Continuous 2D axis input. More...
class  input::CursorTrigger
 Mouse cursor position or delta. More...

Functions

auto input::detail::levelOf (const InputSample &sample) -> float
auto input::detail::toNDC (glm::vec2 screen, const EvalContext &ctx) -> glm::vec2
auto input::detail::deltaToNDC (glm::vec2 screen_delta, const EvalContext &ctx) -> glm::vec2
auto input::detail::applyAxisThreshold (float value, glm::vec2 range, bool normalize) -> float

Detailed Description

Triggers turn a raw input sample into an action value and discrete events.

Author
Xein
Date
21 Jun 2026

There are seven trigger events: start, release, hold, pulse, axis1d, axis2d and cursor