Deep Learning Visualizer
Interactive visualization of basic applications of deep learning
Loading...
Searching...
No Matches
engine::input::event_bus Class Reference

An event dispatcher for input events. More...

#include <event_bus.h>

Public Member Functions

void emit (key key, action action)
 Informs all subscribers of a new keyboard event.
 
void emit (mouse mouse, action action)
 Informs all subscribers of a new mouse button event.
 
void emit (const Eigen::Vector2f &cursor_pos)
 Informs all subscribers of a new cursor movement event.
 
void subscribe (std::function< void(key, action)> func)
 Attaches a subscriber to new keyboard events.
 
void subscribe (std::function< void(mouse, action)> func)
 Attaches a subscriber to new mouse button events.
 
void subscribe (std::function< void(Eigen::Vector2f)> func)
 Attaches a subscriber to new cursor movement events.
 

Detailed Description

An event dispatcher for input events.

Member Function Documentation

◆ emit() [1/3]

void engine::input::event_bus::emit ( const Eigen::Vector2f &  cursor_pos)
inline

Informs all subscribers of a new cursor movement event.

Parameters
cursor_posThe new cursor position.

◆ emit() [2/3]

void engine::input::event_bus::emit ( key  key,
action  action 
)
inline

Informs all subscribers of a new keyboard event.

Parameters
keyThe key whose status is changed.
actionThe specific action that is performed.

◆ emit() [3/3]

void engine::input::event_bus::emit ( mouse  mouse,
action  action 
)
inline

Informs all subscribers of a new mouse button event.

Parameters
mouseThe mouse button whose status is changed.
actionThe specific action that is performed.

◆ subscribe() [1/3]

void engine::input::event_bus::subscribe ( std::function< void(Eigen::Vector2f)>  func)
inline

Attaches a subscriber to new cursor movement events.

Parameters
funcA function to be called when an event is emitted.

◆ subscribe() [2/3]

void engine::input::event_bus::subscribe ( std::function< void(key, action)>  func)
inline

Attaches a subscriber to new keyboard events.

Parameters
funcA function to be called when an event is emitted.

◆ subscribe() [3/3]

void engine::input::event_bus::subscribe ( std::function< void(mouse, action)>  func)
inline

Attaches a subscriber to new mouse button events.

Parameters
funcA function to be called when an event is emitted.

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