add get_fps and frame_interval

This commit is contained in:
util1 2019-07-20 16:47:37 +02:00
parent 65ff6e5436
commit 2e40a5ae94
2 changed files with 17 additions and 6 deletions

View File

@ -1,14 +1,21 @@
#include "FxEngine.h"
#include <libprof.h>
#include <display.h>
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 !

View File

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