Updated source code :
#include "windows.h"
#include "DarkSDK.h"
#include "stdio.h"
LARGE_INTEGER gameSpeed,oldGameSpeed;
void DarkSDK ( void )
{
register int x,y,totalR,totalFps,fps;
float rot=0.0;
dbMaximiseWindow();
totalR=0;
totalFps=0;
fps=0;
if (QueryPerformanceFrequency(&gameSpeed)==false)
{
MessageBox(NULL,
"Sorry. This computer doesn't have a high-frequency timer.",
"* No Timer *",
MB_OK | MB_ICONEXCLAMATION);
return;
}
dbSyncOn();
dbSyncRate(0);
dbLoadImage("ship_light.png",1,1);
dbSprite(1,0,0,1);
dbScaleSprite(1,10);
QueryPerformanceCounter(&oldGameSpeed);
QueryPerformanceCounter(&gameSpeed);
while (LoopSDK())
{
if (dbEscapeKey())
{
printf("Screen FPS:[%d]",totalFps/(totalR-50));
return;
}
for (x=0; x<20; x++)
{
for (y=0; y<20; y++)
{
dbPasteSprite(1,x*50,y*50);
dbRotateSprite(1,rot);
rot+=3.0;
}
}
dbSync();
dbCLS();
fps=(int) (gameSpeed.QuadPart-oldGameSpeed.QuadPart)/100;
oldGameSpeed=gameSpeed;
QueryPerformanceCounter(&gameSpeed);
totalR++;
if (totalR>50)
{
totalFps+=fps;
}
}
}
Beware the cat... The alien... The heretic...