Go to the documentation of this file.
9 #ifndef EAGINE_APPLICATION_STATE_VIEW_HPP
10 #define EAGINE_APPLICATION_STATE_VIEW_HPP
12 #include "../quantities.hpp"
13 #include "../value_with_history.hpp"
41 return clock_type::now() - _start_time;
49 return clock_type::now() - _user_active_time;
55 return seconds_(_frame_time.value());
61 return seconds_(_frame_time.delta());
67 return !_new_user_idle || _has_activity;
76 return {_new_user_idle, _old_user_idle};
100 const clock_type::time_point _start_time{clock_type::now()};
101 clock_type::time_point _user_active_time{clock_type::now()};
102 state_variable<float> _frame_time{0.0F};
104 bool _has_activity{
false};
105 bool _old_user_idle{
false};
106 bool _new_user_idle{
false};
Application harness / wrapper code is placed in this namespace.
Definition: eagine.hpp:72
auto user_idle_time() const noexcept -> clock_type::duration
Returns for how long was the user idle.
Definition: state_view.hpp:48
Read-only view of application context state values.
Definition: state_view.hpp:34
auto frame_duration() const noexcept -> seconds_t< float >
Returns the duration of the previos frame.
Definition: state_view.hpp:60
auto user_became_active() const noexcept -> bool
Indicates that the used became active (generated input events).
Definition: state_view.hpp:89
auto frame_time() const noexcept -> seconds_t< float >
Returns the simulation time of the current frame.
Definition: state_view.hpp:54
Class for read-only values with history.
Definition: value_with_history.hpp:141
static constexpr auto seconds_(T value) noexcept -> seconds_t< T >
Creates a tagged quantity storing value in seconds.
Definition: quantities.hpp:33
auto user_became_idle() const noexcept -> bool
Indicates that the used became idle.
Definition: state_view.hpp:82
auto user_is_idle() const noexcept -> value_with_history< bool, 2 >
Indicates if the user is idle (does not generate input events).
Definition: state_view.hpp:75
auto is_active() const noexcept -> bool
Indicates if the example or the user is active in some way.
Definition: state_view.hpp:66
auto run_time() const noexcept -> clock_type::duration
Returns the application run time duration.
Definition: state_view.hpp:40
auto user_idle_too_long() const noexcept -> bool
Indicates that the user became idle for too long (may depend on config).
Definition: state_view.hpp:94
std::chrono::steady_clock clock_type
The clock type for run-time duration measurements.
Definition: state_view.hpp:37
Class for mutable variables with history.
Definition: value_with_history.hpp:291
Value of type T with a specified unit or tag type U.
Definition: tagged_quantity.hpp:27