summaryrefslogtreecommitdiff
path: root/hge
diff options
context:
space:
mode:
Diffstat (limited to 'hge')
-rw-r--r--hge/hge_impl.h4
-rw-r--r--hge/system.cpp14
-rw-r--r--hge/timer.cpp5
3 files changed, 21 insertions, 2 deletions
diff --git a/hge/hge_impl.h b/hge/hge_impl.h
index 7361274..c823b85 100644
--- a/hge/hge_impl.h
+++ b/hge/hge_impl.h
@@ -150,6 +150,7 @@ public:
virtual float CALL Timer_GetTime();
virtual float CALL Timer_GetDelta();
virtual int CALL Timer_GetFPS();
+ virtual float CALL Timer_GetFPSf();
virtual HEFFECT CALL Effect_Load(const char *filename, DWORD size=0);
virtual void CALL Effect_Free(HEFFECT eff);
@@ -387,8 +388,11 @@ public:
// Timer
float fTime;
float fDeltaTime;
+ float fUpdateFPSDelay;
+ float nFPSf;
DWORD nFixedDelta;
int nFPS;
+ int Fcnt;
DWORD t0, t0fps, dt;
int cfps;
diff --git a/hge/system.cpp b/hge/system.cpp
index b914566..b32783b 100644
--- a/hge/system.cpp
+++ b/hge/system.cpp
@@ -200,6 +200,9 @@ bool CALL HGE_Impl::System_Initiate()
t0=t0fps=SDL_GetTicks();
dt=cfps=0;
nFPS=0;
+ nFPSf=0.0f;
+ Fcnt=0;
+ fUpdateFPSDelay=0.0f;
// Show splash
@@ -320,6 +323,13 @@ bool CALL HGE_Impl::System_Start()
nFPS=cfps; cfps=0; t0fps=t0;
_UpdatePowerStatus();
}
+ ++Fcnt;fUpdateFPSDelay+=fDeltaTime;
+ if(fUpdateFPSDelay>1)
+ {
+ nFPSf=Fcnt/fUpdateFPSDelay;
+ fUpdateFPSDelay=0.0f;
+ Fcnt=0;
+ }
// Do user's stuff
@@ -636,7 +646,6 @@ bool CALL HGE_Impl::System_Launch(const char *url)
CFRelease(cfurl);
return (err == noErr);
#else
- //STUBBED("launch URL");
char command[1024];sprintf(command,"xdg-open %s",url);
system(command);
return false;
@@ -722,8 +731,11 @@ HGE_Impl::HGE_Impl()
nHGEFPS=HGEFPS_UNLIMITED;
fTime=0.0f;
+ fUpdateFPSDelay=0.0f;
fDeltaTime=0.0f;
nFPS=0;
+ nFPSf=0.0f;
+ Fcnt=0;
procFrameFunc=0;
procRenderFunc=0;
diff --git a/hge/timer.cpp b/hge/timer.cpp
index af75315..13711c7 100644
--- a/hge/timer.cpp
+++ b/hge/timer.cpp
@@ -20,9 +20,12 @@ float CALL HGE_Impl::Timer_GetDelta()
return fDeltaTime;
}
-
int CALL HGE_Impl::Timer_GetFPS()
{
return nFPS;
}
+float CALL HGE_Impl::Timer_GetFPSf()
+{
+ return nFPSf;
+}