guillaume 2026.6.1
A C++ UI framework designed for modern desktop and extended reality (XR) applications.
Loading...
Searching...
No Matches
guillaume::components::InteractionBase< EventType > Class Template Reference

The part shared by every Interaction: one callback to run when the input the component stands for reaches the entity. More...

#include <headers/guillaume/components/interaction.hpp>

Inheritance diagram for guillaume::components::InteractionBase< EventType >:
Collaboration diagram for guillaume::components::InteractionBase< EventType >:

Public Types

using EventHandler
 Callback run when the input reaches the entity.

Public Member Functions

 InteractionBase (void)
 Construct an interaction without handler.
void setOnEventHandler (const EventHandler &handler)
 Store the callback to run when the input reaches the entity.
EventHandler getOnEventHandler (void) const
 Get the callback run when the input reaches the entity.
Public Member Functions inherited from guillaume::ecs::Component
bool hasChanged (void) const
 Tell whether a value of the component changed since the flags were last reset (the end of the previous frame).
void setHasChanged (bool hasChanged)
 Raise or lower the changed flag.
 Component (void)=default
 Create a component that is not marked as changed.
virtual ~Component (void)=default
 Virtual destructor, so components can be destroyed through the base class.

Public Attributes

EventHandler _onEventHandler

Detailed Description

template<typename EventType>
class guillaume::components::InteractionBase< EventType >

The part shared by every Interaction: one callback to run when the input the component stands for reaches the entity.

User code (or a widget system) stores the handler; the input system of the matching event calls it during the Event phase.

Template Parameters
EventTypeThe event the component reacts to. It only makes each interaction a distinct component type; the handler receives nothing.
See also
Interaction

Definition at line 54 of file interaction.hpp.

Member Typedef Documentation

◆ EventHandler

template<typename EventType>
using guillaume::components::InteractionBase< EventType >::EventHandler
Initial value:
std::function<void(
void)>

Callback run when the input reaches the entity.

Definition at line 57 of file interaction.hpp.

Member Function Documentation

◆ getOnEventHandler()

template<typename EventType>
EventHandler guillaume::components::InteractionBase< EventType >::getOnEventHandler ( void ) const

Get the callback run when the input reaches the entity.

Returns
A copy of the handler; empty (nullptr) when none was set.

◆ setOnEventHandler()

template<typename EventType>
void guillaume::components::InteractionBase< EventType >::setOnEventHandler ( const EventHandler & handler)

Store the callback to run when the input reaches the entity.

Always marks the component changed.

Parameters
handlerThe callback, or nullptr to remove the current one.

Member Data Documentation

◆ _onEventHandler

template<typename EventType>
EventHandler guillaume::components::InteractionBase< EventType >::_onEventHandler
Initial value:
{
nullptr
}

Callback run when the input reaches the entity; empty by default.

Definition at line 80 of file interaction.hpp.


The documentation for this class was generated from the following file: