Go to the documentation of this file.
9 #ifndef EAGINE_APPLICATION_STATE_HPP
10 #define EAGINE_APPLICATION_STATE_HPP
12 #include "../main_ctx_object.hpp"
13 #include "../valid_if/positive.hpp"
31 if(EAGINE_UNLIKELY(_fixed_fps)) {
32 _frame_time.advance(1.F /
extract(_fixed_fps));
35 std::chrono::duration<float>(
run_time()).count());
45 _new_user_idle =
false;
51 generate(dest, [
this] {
return _dist_uniform_byte(_rand_eng); });
56 generate(dest, [
this] {
return _dist_uniform_float_01(_rand_eng); });
61 generate(dest, [
this] {
return _dist_normal_float(_rand_eng); });
67 std::chrono::duration<float> _sim_activity_for;
70 std::default_random_engine::result_type _rand_init;
72 std::default_random_engine _rand_eng;
73 std::uniform_int_distribution<byte> _dist_uniform_byte{0x00, 0xFF};
74 std::uniform_real_distribution<float> _dist_uniform_float_01{0.F, 1.F};
75 std::normal_distribution<float> _dist_normal_float{0.F, 1.F};
80 #include <eagine/application/state.inl>
Application harness / wrapper code is placed in this namespace.
Definition: eagine.hpp:72
Helper class used to initialize main context objects.
Definition: main_ctx_object.hpp:45
Read-only view of application context state values.
Definition: state_view.hpp:34
Base class for main context objects.
Definition: main_ctx_object.hpp:71
static constexpr auto extract(api_result_value< Result, api_result_validity::never > &) noexcept -> Result &
Overload of extract for api_result_value.
Definition: c_api_wrap.hpp:270
void random_uniform(span< byte > dest)
Generates random uniformly-distributed bytes.
Definition: state.hpp:50
Primary template for conditionally valid values.
Definition: decl.hpp:49
auto update_activity() noexcept -> context_state &
Updates the user activity tracking.
Class managing application context variables.
Definition: state.hpp:22
static auto generate(basic_span< T, P, S > spn, Generator gen) -> basic_span< T, P, S >
Fills a span with elements generated by a generator callable.
Definition: span_algo.hpp:584
void random_normal(span< float > dest)
Generates random normally-distributed floats.
Definition: state.hpp:60
auto run_time() const noexcept -> clock_type::duration
Returns the application run time duration.
Definition: state_view.hpp:40
void random_uniform_01(span< float > dest)
Generates random uniformly-distributed floats in range <0, 1>.
Definition: state.hpp:55
auto advance_time() noexcept -> auto &
Advances the simulation time.
Definition: state.hpp:30
auto notice_user_active() noexcept -> auto &
Notice that the user generated some input.
Definition: state.hpp:44