diff --git a/includes/animations.h b/includes/animations.h index 958dc9b..68659e3 100644 --- a/includes/animations.h +++ b/includes/animations.h @@ -5,6 +5,7 @@ #include "audio.h" #include "font.h" +#include "utils.h" // Dimensions de la fenêtre extern GLuint _dims[]; diff --git a/includes/utils.h b/includes/utils.h new file mode 100644 index 0000000..43f0afe --- /dev/null +++ b/includes/utils.h @@ -0,0 +1,9 @@ +#ifndef DEMO_UTILS_H +#define DEMO_UTILS_H 1 + +#include + +// Récupère un delta-temps +double get_dt(void); + +#endif diff --git a/src/utils.c b/src/utils.c new file mode 100644 index 0000000..e9c181c --- /dev/null +++ b/src/utils.c @@ -0,0 +1,9 @@ +#include "../includes/utils.h" + +double get_dt(void) { + static double t0 = 0.0f; + double t = gl4dGetElapsedTime(), dt = (t - t0) / 1000.0; + t0 = t; + + return dt; +}