|
MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
|
Fluent builder that wires an entity into Fabric's scheduling infrastructure. More...
#include <Wiring.hpp>
Collaboration diagram for MayaFlux::Nexus::Wiring:Classes | |
| struct | EventTrigger |
| struct | KeyTrigger |
| struct | MouseTrigger |
| struct | MoveStep |
| struct | NetworkTrigger |
Public Types | |
| using | ComplexFactory = std::function< Vruta::ComplexRoutine(Vruta::TaskScheduler &)> |
| using | EventFactory = std::function< Vruta::Event(Vruta::TaskScheduler &)> |
| using | GraphicsFactory = std::function< Vruta::GraphicsRoutine(Vruta::TaskScheduler &)> |
| using | PositionFn = std::function< glm::vec3()> |
| using | SoundFactory = std::function< Vruta::SoundRoutine(Vruta::TaskScheduler &)> |
Public Member Functions | |
| Wiring & | bind () |
| Call the entity's influence function once immediately. | |
| Wiring & | bind (std::function< void()> attach, std::function< void()> detach) |
Call attach immediately; call detach after for_duration expires or on explicit cancel(). | |
| Wiring & | bind (std::function< void()> fn) |
| Call a custom function once immediately instead of the entity's own. | |
| Wiring & | bind (std::string attach_name, std::function< void()> attach, std::string detach_name, std::function< void()> detach) |
| Call named attach/detach functions. | |
| Wiring & | bind (std::string fn_name, std::function< void()> fn) |
| Call a named custom function once immediately. | |
| const std::string & | bind_attach_name () const |
| Name of the bind attach function, empty if anonymous or none. | |
| const std::string & | bind_detach_name () const |
| Name of the bind detach function, empty if anonymous or none. | |
| void | cancel () |
| Cancel an active wiring and release any owned coroutine. | |
| std::optional< double > | duration () const |
Active duration in seconds, if for_duration was called. | |
| uint32_t | entity_id () const |
| Stable id of the wired entity. | |
| const EFactory & | event_factory () const |
Active event-factory, if use(EventFactory) was called. | |
| Wiring & | every (double interval_seconds) |
| Fire the entity on a recurring interval. | |
| const Factory & | factory () const |
Active factory variant set by use for non-Event factories. | |
| const std::string & | factory_name () const |
| Name of the active factory, empty if anonymous or none. | |
| void | finalise () |
| Apply the configured wiring. | |
| Wiring & | for_duration (double seconds) |
| Limit a recurring registration to a fixed duration then cancel. | |
| bool | has_bind () const |
True if any bind overload was called. | |
| bool | has_bind_detach () const |
True if bind(attach, detach) was called. | |
| bool | has_position_fn () const |
True if position_from was called. | |
| std::optional< double > | interval () const |
Recurring interval in seconds, if every was called. | |
| const std::vector< MoveStep > & | move_steps () const |
Choreography steps from move_to calls. | |
| Wiring & | move_to (const glm::vec3 &pos, double delay_seconds=0.0) |
| Choreograph a position move as an EventChain step. | |
| Wiring & | on (std::shared_ptr< Core::Window > window, IO::Keys key) |
| Fire the entity on a key event from a window. | |
| Wiring & | on (std::shared_ptr< Core::Window > window, IO::MouseButtons button) |
| Fire the entity on a mouse button event from a window. | |
| Wiring & | on (Vruta::EventSource &source, Vruta::EventFilter filter={}) |
| Fire the entity on each matching window event. | |
| Wiring & | on (Vruta::NetworkSource &source) |
| Fire the entity on each incoming message from a network source. | |
| Wiring & | operator= (const Wiring &)=delete |
| Wiring & | operator= (Wiring &&)=delete |
| const std::string & | position_fn_name () const |
| Name of the position function, empty if anonymous. | |
| Wiring & | position_from (PositionFn fn) |
Drive position from a callable evaluated on each every() tick. | |
| Wiring & | position_from (std::string fn_name, PositionFn fn) |
Drive position from a named callable evaluated on each every() tick. | |
| Wiring & | times (size_t count) |
| Repeat the configured sequence or choreography N times. | |
| size_t | times_count () const |
Repetition count set by times, default 1. | |
| const Trigger & | trigger () const |
Active trigger variant set by on. | |
| Wiring & | use (ComplexFactory factory) |
| Wiring & | use (EventFactory factory) |
| Wiring & | use (GraphicsFactory factory) |
| Wiring & | use (SoundFactory factory) |
| Delegate coroutine creation entirely to the caller. | |
| Wiring & | use (std::string fn_name, ComplexFactory factory) |
| Wiring & | use (std::string fn_name, EventFactory factory) |
| Wiring & | use (std::string fn_name, GraphicsFactory factory) |
| Wiring & | use (std::string fn_name, SoundFactory factory) |
| Register a named factory. | |
| Wiring (const Wiring &)=delete | |
| Wiring (Wiring &&) noexcept=default | |
| ~Wiring ()=default | |
Private Types | |
| using | EFactory = std::optional< EventFactory > |
| using | Factory = std::variant< std::monostate, SoundFactory, GraphicsFactory, ComplexFactory > |
| using | Trigger = std::variant< std::monostate, KeyTrigger, MouseTrigger, NetworkTrigger, EventTrigger > |
Private Member Functions | |
| std::string | make_name (const char *prefix) const |
| Wiring (Fabric &fabric, uint32_t entity_id) | |
Private Attributes | |
| std::optional< std::function< void()> > | m_bind_attach |
| std::string | m_bind_attach_name |
| std::optional< std::function< void()> > | m_bind_detach |
| std::string | m_bind_detach_name |
| std::optional< double > | m_duration |
| uint32_t | m_entity_id |
| EFactory | m_event_factory |
| Fabric & | m_fabric |
| Factory | m_factory |
| std::string | m_factory_name |
| bool | m_has_scheduling {} |
| std::optional< double > | m_interval |
| std::vector< MoveStep > | m_move_steps |
| std::optional< PositionFn > | m_position_fn |
| std::string | m_position_fn_name |
| size_t | m_times { 1 } |
| Trigger | m_trigger |
Friends | |
| class | Fabric |
Fluent builder that wires an entity into Fabric's scheduling infrastructure.
Obtained via Fabric::wire. Describes when and how the object's function is invoked. Call finalise() to apply the configuration.
No coroutine is created unless a scheduling modifier is set. bind() performs an immediate single call with no coroutine. Any scheduling modifier (every, on, move_to, position_from, use) creates and registers a coroutine owned by Fabric.
Definition at line 39 of file Wiring.hpp.