1 /*
2     Copyright © 2020, Inochi2D Project
3     Distributed under the 2-Clause BSD License, see LICENSE file.
4     
5     Authors: Luna Nielsen
6 */
7 module inochi2d;
8 //public import inochi2d.inochi2d;
9 public import inochi2d.math;
10 public import inochi2d.phys;
11 public import inochi2d.fmt;
12 public import inochi2d.core;
13 public import inochi2d.ver;
14 
15 private double currentTime_ = 0;
16 private double lastTime_ = 0;
17 private double deltaTime_ = 0;
18 private double function() tfunc_;
19 
20 /**
21     Initializes Inochi2D
22     Run this after OpenGL context has been set current
23 */
24 void inInit(double function() timeFunc) {
25     initRenderer();
26     tfunc_ = timeFunc;
27 }
28 
29 /**
30     Run this at the start of your render/game loop
31 */
32 void inUpdate() {
33     currentTime_ = tfunc_();
34     deltaTime_ = currentTime_-lastTime_;
35     lastTime_ = currentTime_;
36 }
37 
38 /**
39     Gets the time difference between the last frame and the current frame
40 */
41 double deltaTime() {
42     return deltaTime_;
43 }
44 
45 /**
46     Gets the last frame's time step
47 */
48 double lastTime() {
49     return lastTime_;
50 }
51 
52 /**
53     Gets the current time step
54 */
55 double currentTime() {
56     return currentTime_;
57 }