aboutsummaryrefslogtreecommitdiff
path: root/simloop/include
diff options
context:
space:
mode:
Diffstat (limited to 'simloop/include')
-rw-r--r--simloop/include/simloop.h21
1 files changed, 9 insertions, 12 deletions
diff --git a/simloop/include/simloop.h b/simloop/include/simloop.h
index 4e3ed20..6a83b23 100644
--- a/simloop/include/simloop.h
+++ b/simloop/include/simloop.h
@@ -2,7 +2,7 @@
2 2
3#include <stdint.h> 3#include <stdint.h>
4 4
5typedef uint64_t simloop_time_t; 5typedef uint64_t simloop_time_t; ///< Time delta in nanoseconds.
6 6
7typedef struct SimloopArgs { 7typedef struct SimloopArgs {
8 int update_fps; ///< Update frame rate. Must be >0. 8 int update_fps; ///< Update frame rate. Must be >0.
@@ -11,13 +11,12 @@ typedef struct SimloopArgs {
11 11
12typedef struct SimloopOut { 12typedef struct SimloopOut {
13 uint64_t frame; ///< Frame counter. 13 uint64_t frame; ///< Frame counter.
14 simloop_time_t render_elapsed; ///< Amount of time elapsed in the rendering.
15 simloop_time_t update_elapsed; ///< Amount of time elapsed in the simulation. 14 simloop_time_t update_elapsed; ///< Amount of time elapsed in the simulation.
16 simloop_time_t update_dt; ///< Delta time for simulation updates. 15 simloop_time_t update_dt; ///< Delta time for simulation updates.
17 double percent_frame; ///< Percent progress between this frame and 16 simloop_time_t throttle; ///< Render throttle if max render fps is given.
18 ///< the next. Used for smooth animation. 17 double percent_frame; ///< Percent progress between this frame and
19 bool should_update; ///< Whether the simulation should update. 18 ///< the next. Used for smooth animation.
20 bool should_render; ///< Whether the simulation should be rendered. 19 bool should_update; ///< Whether the simulation should update.
21} SimloopOut; 20} SimloopOut;
22 21
23typedef struct SimloopTimeline { 22typedef struct SimloopTimeline {
@@ -26,12 +25,10 @@ typedef struct SimloopTimeline {
26} SimloopTimeline; 25} SimloopTimeline;
27 26
28typedef struct Simloop { 27typedef struct Simloop {
29 simloop_time_t clock; ///< Tracks simulation time. 28 simloop_time_t clock; ///< Tracks simulation time.
30 uint64_t frame; ///< Frame counter, number of updates done. 29 uint64_t frame; ///< Frame counter, number of updates done.
31 SimloopTimeline update; ///< Update timeline. 30 SimloopTimeline update; ///< Update timeline.
32 SimloopTimeline render; ///< Render timeline. 31 simloop_time_t render_ddt; ///< Desired render delta time.
33 double percent_frame;
34 bool first_iter;
35} Simloop; 32} Simloop;
36 33
37/// Create a simulation loop. 34/// Create a simulation loop.