diff --git a/src/FxEngine/FxEngine.c b/src/FxEngine/FxEngine.c index c3bd34e..006ab72 100644 --- a/src/FxEngine/FxEngine.c +++ b/src/FxEngine/FxEngine.c @@ -1,14 +1,21 @@ #include "FxEngine.h" - +#include #include - -static int time_last_frame=0; -static int frame_interval=0; - +static uint32_t frame_interval=0; // in milliseconds +static bool loaded_before=false; void FE_new_frame() { + if (loaded_before) + prof_leave(0); + else + { + prof_init(1,0); + loaded_before=true; + } + frame_interval=prof_time(0); + prof_enter(0); // add frame changing -- with timeGR, wait answer on Planete Casio FE_move(); // Not implemented yet ! @@ -18,6 +25,9 @@ void FE_new_frame() dclear(); } +int FE_get_fps() +{return 1000/frame_interval;} + static void FE_move() // call at each frame { // TODO with math functions, not implemented yet ! diff --git a/src/FxEngine/FxEngine.h b/src/FxEngine/FxEngine.h index cf0f8b5..3cdcb64 100644 --- a/src/FxEngine/FxEngine.h +++ b/src/FxEngine/FxEngine.h @@ -8,6 +8,7 @@ extern float FE_dh,FE_dv,FE_roulis; extern FE_Position FE_user={0,0,0}; void FE_new_frame(); // calls move function -// int FE_get_fps(); +int FE_get_fps(); + #endif \ No newline at end of file