27#include "guillaume/ecs/component.hpp"
58 std::function<void(
void)>;
61 bool _visible {
false };
63 bool _dismissOnOutsideClick {
67 bool _dismissOnEscape {
true };
68 float _autoDismiss { 0.0f };
69 float _elapsed { 0.0f };
Overlay & setModal(bool modal)
Declare the overlay modal (it must be answered before the rest of the interface is used) or not.
Overlay & setDismissOnOutsideClick(bool dismiss)
Choose whether a click outside the overlay dismisses it.
bool dismissesOnEscape(void) const
Tell whether the Escape key dismisses the overlay.
Overlay & setDismissOnEscape(bool dismiss)
Choose whether the Escape key dismisses the overlay.
std::function< void(void)> DismissHandler
Callback run on dismissal.
Overlay & setVisible(bool visible)
Show or hide the overlay.
Overlay(void)=default
Create a hidden, modal overlay that is dismissed on Escape and on an outside click,...
Overlay & setElapsed(float elapsed)
Store the time counted towards auto-dismissal.
Overlay & setOnDismissHandler(const DismissHandler &handler)
Set the callback run when systems::Overlay dismisses the overlay.
bool dismissesOnOutsideClick(void) const
Tell whether a click outside the overlay dismisses it.
bool hasAutoDismiss(void) const
Tell whether the overlay is dismissed by itself after a delay.
bool isModal(void) const
Tell whether the overlay is modal.
DismissHandler getOnDismissHandler(void) const
Get the callback run when the overlay is dismissed.
float getElapsed(void) const
Get how long the overlay has been counting towards its auto-dismissal.
Overlay & setAutoDismiss(float delay)
Set how long the overlay stays shown before it is dismissed by itself.
~Overlay(void)=default
Default destructor.
bool isVisible(void) const
Tell whether the overlay is shown.
float getAutoDismiss(void) const
Get how long the overlay stays shown before it is dismissed by itself.
Base class of every component: a piece of state attached to an entity, plus a "changed" flag.
State. Every class here is plain data attached to an entity.