aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar chirs241097@gmail.com <chirs241097@gmail.com@c17bf020-1265-9734-9302-a83f62007ddb> 2014-04-03 03:19:21 +0000
committerGravatar chirs241097@gmail.com <chirs241097@gmail.com@c17bf020-1265-9734-9302-a83f62007ddb> 2014-04-03 03:19:21 +0000
commitd812e93dec4bcb81c2b5226b14c54dacf4fb860d (patch)
treea7758c924c669b794330987f3387d471eadb5ca2
parent85923eb8a5d3f070618c3d6f94bea715c11a4227 (diff)
downloadbullet-lab-remix-d812e93dec4bcb81c2b5226b14c54dacf4fb860d.tar.xz
Remove "high FPS mode", it won't reach 500 FPS on my computer any
more. Replace it with Vsync mode. Add float HGE::Timer_GetFPSf(). The return value will be updated every 1000ms.
-rwxr-xr-xCHANGELOG.TXT8
-rwxr-xr-xVERSION.TXT2
-rw-r--r--global.h2
-rw-r--r--hge/hge_impl.h4
-rw-r--r--hge/system.cpp14
-rw-r--r--hge/timer.cpp5
-rwxr-xr-xhgewin/hge_impl.h4
-rwxr-xr-xhgewin/system.cpp14
-rwxr-xr-xhgewin/timer.cpp5
-rw-r--r--include/hge.h1
-rw-r--r--main.cpp22
-rw-r--r--menus.h30
12 files changed, 78 insertions, 33 deletions
diff --git a/CHANGELOG.TXT b/CHANGELOG.TXT
index 82d31b5..9031a04 100755
--- a/CHANGELOG.TXT
+++ b/CHANGELOG.TXT
@@ -1,6 +1,6 @@
===================================================================
Next version:
-0.9.x-x_PR (r??)
+?
Todo's:
Complete the game system.
Menu rewrite...
@@ -8,6 +8,12 @@ Random segmentation fault in "Hyper-threading".(seen only once,
can not reproduce now...)
Pre-Released versions:
+0.9.1-0_PR (r80)
+Remove "high FPS mode", it won't reach 500 FPS on my computer any
+more. Replace it with Vsync mode.
+Add float HGE::Timer_GetFPSf(). The return value will be updated
+every 1000ms.
+
0.9.0-1_PR (b79/r79)
Bump version!
BLR will use revision number instead of build number one day...
diff --git a/VERSION.TXT b/VERSION.TXT
index 370c4c3..fa00a85 100755
--- a/VERSION.TXT
+++ b/VERSION.TXT
@@ -1 +1 @@
-0.9.0-1_PR (r79) \ No newline at end of file
+0.9.1-0_PR (r80) \ No newline at end of file
diff --git a/global.h b/global.h
index 15466cb..6a59827 100644
--- a/global.h
+++ b/global.h
@@ -289,7 +289,7 @@ fFristStartUp,fFast;
int startLvl,startPrt,fFullScreen;
char alterLog[64];
//static const char* GLOBAL_H_FN="global.h";
-static const char* BLRVERSION="0.9.0-1_PR (r79)";
+static const char* BLRVERSION="0.9.1-0_PR (r80)";
void Throw(char *Filename,char *Info)
{
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;
+}
diff --git a/hgewin/hge_impl.h b/hgewin/hge_impl.h
index e438b00..b3f0fe5 100755
--- a/hgewin/hge_impl.h
+++ b/hgewin/hge_impl.h
@@ -117,6 +117,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);
@@ -335,8 +336,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/hgewin/system.cpp b/hgewin/system.cpp
index 1e49d65..9dfda86 100755
--- a/hgewin/system.cpp
+++ b/hgewin/system.cpp
@@ -167,6 +167,9 @@ bool CALL HGE_Impl::System_Initiate()
t0=t0fps=timeGetTime();
dt=cfps=0;
nFPS=0;
+ nFPSf=0.0f;
+ Fcnt=0;
+ fUpdateFPSDelay=0.0f;
// Show splash
@@ -305,7 +308,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
if(procFrameFunc()) break;
@@ -685,8 +694,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/hgewin/timer.cpp b/hgewin/timer.cpp
index af75315..13711c7 100755
--- a/hgewin/timer.cpp
+++ b/hgewin/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;
+}
diff --git a/include/hge.h b/include/hge.h
index daed571..ef4597e 100644
--- a/include/hge.h
+++ b/include/hge.h
@@ -361,6 +361,7 @@ public:
virtual float CALL Timer_GetTime() = 0;
virtual float CALL Timer_GetDelta() = 0;
virtual int CALL Timer_GetFPS() = 0;
+ virtual float CALL Timer_GetFPSf() = 0;
virtual HEFFECT CALL Effect_Load(const char *filename, DWORD size=0) = 0;
virtual void CALL Effect_Free(HEFFECT eff) = 0;
diff --git a/main.cpp b/main.cpp
index 405a9d7..81466e6 100644
--- a/main.cpp
+++ b/main.cpp
@@ -73,10 +73,10 @@ void Expand(const char *source,const char *dist)
void firststartup()
{
if (MessageBoxA(NULL,"It seems that you are running BLR for the First time!\nLet's do some \
-basic settings first!\n\nEnable Low FPS Mode?","First Start Up",0x00000024)==6)
- fpslvl=1;
- else
+basic settings first!\n\nUse vsync??","First Start Up",0x00000024)==6)
fpslvl=0;
+ else
+ fpslvl=1;
if (MessageBoxA(NULL,"Enable Fullscreen?","First Start Up",0x00000024)==6)
tfs=1;
else
@@ -91,7 +91,7 @@ basic settings first!\n\nEnable Low FPS Mode?","First Start Up",0x00000024)==6)
#ifndef WIN32
void firststartup()
{
- fpslvl=0;
+ fpslvl=1;
tfs=0;
diffkey=false;
plrspd=3;plrslospd=3;clrbns=clrmode=0;
@@ -360,7 +360,7 @@ void RefreshScore()
score-=scminus*mult;
score+=2000*dsmc*mult;
++frms;
- averfps=(averfps*(frms-1)+hge->Timer_GetFPS())/(double)frms;
+ averfps=(averfps*(frms-1)+hge->Timer_GetFPSf())/(double)frms;
}
void CallLevels()
{
@@ -774,12 +774,10 @@ bool FrameFunc()
if (Current_Position==13)OptionsGUI->Render();
if (Current_Position==14)PlayerProfGUI->Render();
fnt->SetColor(0xFFFFFFFF);
- //fnt->printf(680, 575, HGETEXT_LEFT, "FPS: %d", hge->Timer_GetFPS());
- rbPanelFont.UpdateString(L" FPS: %d",hge->Timer_GetFPS());
+ rbPanelFont.UpdateString(L" FPS: %.2f",hge->Timer_GetFPSf());
rbPanelFont.Render(785,595,0xFFFFFFFF,1);
if (Current_Position==1||Current_Position==2)
{
- //fnt->printf(670,560, HGETEXT_LEFT, "AF: %.2f", averfps);
rbPanelFont.UpdateString(L"AF: %.2f",averfps);
rbPanelFont.Render(785,575,0xFFFFFFFF,1);
if (playerpos.x<220&&playerpos.y<200)
@@ -953,6 +951,8 @@ int main(int argc,char *argv[])
tch=getchar();
if (tch!='L'){}
fpslvl=0;
+ LOWFPS=true;//always LowFPS, deprecate 1000 FPS mode...
+ hge->System_SetState(HGE_FPS,HGEFPS_VSYNC);//try vsync first
tch=getchar();//LOWFPS
if (tch==1)
{
@@ -971,10 +971,10 @@ int main(int argc,char *argv[])
hge->System_SetState(HGE_WINDOWED, false),tfs=true;
if(fFullScreen==2)hge->System_SetState(HGE_WINDOWED, false),tfs=true;
if(fFullScreen==1)hge->System_SetState(HGE_WINDOWED, true),tfs=false;
- tch=getchar();//LockFPS
- if (tch==1&&!LOWFPS)
+ tch=getchar();//vsync
+ if (tch==1)
{
- hge->System_SetState(HGE_FPS,1000);
+ hge->System_SetState(HGE_FPS,HGEFPS_VSYNC);
fpslvl=2;
}
tch=getchar();//Key binding
diff --git a/menus.h b/menus.h
index 00757cc..f42ae34 100644
--- a/menus.h
+++ b/menus.h
@@ -647,9 +647,9 @@ void OptionsGUI_Init()
OptionsGUI->AddCtrl(new hgeGUIMenuItem(1,fnt,snd,400,200,0.0f,opt[0]));
switch (fpslvl)
{
- case 0:sprintf(opt[1],"FPS Level: Natural");break;
- case 1:sprintf(opt[1],"FPS Level: Low FPS");break;
- case 2:sprintf(opt[1],"FPS Level: Highest");break;
+ case 0:sprintf(opt[1],"FPS Level: 60");break;
+ case 1:sprintf(opt[1],"FPS Level: ?");break;
+ case 2:sprintf(opt[1],"FPS Level: Vsync");break;
}
OptionsGUI->AddCtrl(new hgeGUIMenuItem(2,fnt,snd,400,240,0.1f,opt[1]));
if (diffkey)
@@ -781,7 +781,7 @@ void OptionsGUI_FrameFnk()
switch (fpslvl)
{
case 0:
- fpslvl=1;LOWFPS=true;
+ fpslvl=2;LOWFPS=true;
hge->System_SetState(HGE_FPS,61);
TenSeconds=600;
TwentySeconds=1200;
@@ -790,29 +790,29 @@ void OptionsGUI_FrameFnk()
if(fFast)TenSeconds/=2,TwentySeconds/=2,ThirtySeconds/=2,AMinute/=2;
break;
case 1:
- fpslvl=2;LOWFPS=false;
+ /*fpslvl=2;LOWFPS=false;
hge->System_SetState(HGE_FPS,1000);
TenSeconds=10000;
TwentySeconds=20000;
ThirtySeconds=30000;
AMinute=60000;
if(fFast)TenSeconds/=2,TwentySeconds/=2,ThirtySeconds/=2,AMinute/=2;
- break;
+ break;*/
case 2:
- fpslvl=0;LOWFPS=false;
- hge->System_SetState(HGE_FPS,0);
- TenSeconds=10000;
- TwentySeconds=20000;
- ThirtySeconds=30000;
- AMinute=60000;
+ fpslvl=0;LOWFPS=true;
+ hge->System_SetState(HGE_FPS,HGEFPS_VSYNC);
+ TenSeconds=600;
+ TwentySeconds=1200;
+ ThirtySeconds=1800;
+ AMinute=3600;
if(fFast)TenSeconds/=2,TwentySeconds/=2,ThirtySeconds/=2,AMinute/=2;
break;
}
switch (fpslvl)
{
- case 0:sprintf(opt[1],"FPS Level: Natural");break;
- case 1:sprintf(opt[1],"FPS Level: Low FPS");break;
- case 2:sprintf(opt[1],"FPS Level: Highest");break;
+ case 0:sprintf(opt[1],"FPS Level: 60");break;
+ case 1:sprintf(opt[1],"FPS Level: ?");break;
+ case 2:sprintf(opt[1],"FPS Level: Vsync");break;
}
((hgeGUIMenuItem*)OptionsGUI->GetCtrl(2))->RePos(400,240);
break;