add utils

This commit is contained in:
Mylloon 2023-05-08 13:10:39 +02:00
parent a07c3ddd47
commit 5b53048505
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
3 changed files with 19 additions and 0 deletions

View file

@ -5,6 +5,7 @@
#include "audio.h" #include "audio.h"
#include "font.h" #include "font.h"
#include "utils.h"
// Dimensions de la fenêtre // Dimensions de la fenêtre
extern GLuint _dims[]; extern GLuint _dims[];

9
includes/utils.h Normal file
View file

@ -0,0 +1,9 @@
#ifndef DEMO_UTILS_H
#define DEMO_UTILS_H 1
#include <GL4D/gl4dummies.h>
// Récupère un delta-temps
double get_dt(void);
#endif

9
src/utils.c Normal file
View file

@ -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;
}