This isnt the greatest example yet because I havent remade it yet but it generally gets the job done
while (LoopGDK())
{
TEST_SPEED += 1;
Pre_Engine();
if(System_Key_Check("Enter",1,0) == 1)
{
System_Play_Music("2","Theme");
}
if(System_Key_Check("R - Shift",1,0) == 1)
{
System_Play_Music("1","Battle");
}
if(System_Key_Check("Space",2,17) == 1)
{
System_Stop_Music(1);
}
if(System_Key_Check("Up",0,0) == 1)
{
CAM_X = CAM_X +System_Calculate_Frame_Time(1);
CAM_CHANGE = 1;
}
if(System_Key_Check("Down",0,0) == 1)
{
CAM_X = CAM_X - System_Calculate_Frame_Time(1);
CAM_CHANGE = 1;
}
if(CAM_CHANGE == 1)
{
dbPositionCamera(CAM_X,CAM_Y,CAM_Z);
CAM_CHANGE = 0;
}
Post_Engine();
if(SYSTEM_TIME >= TEST_TIMEWAIT)
{
sprintf(SCREEN_FPS, "Frame Rate: %d",FRAME_RATE);
dbText(0,0,SCREEN_FPS);
sprintf(FRAME, "Frame Time: %f",FRAME_TIME);
dbText(0,15,FRAME);
sprintf(RANDOMNUM, "Random Number: %d",Random_Range(50,60));
dbText(0,30,RANDOMNUM);
//TEST_FRAMERATE = (TEST_SPEED / ((SYSTEM_TIME - TEST_STARTTIME))); /// 1000));
sprintf(TEST_TRUE_FRAME, "True Frame Rate: %d",TEST_FRAMERATE);
dbText(0,45,TEST_TRUE_FRAME);
dbSync();
TEST_TIMEWAIT = SYSTEM_TIME + 17;
}
TIME_ELAPSED = SYSTEM_TIME - TEST_STARTTIME;
if(TIME_ELAPSED > 1000)
{
TEST_FRAMERATE = TEST_SPEED;//(TEST_SPEED / TIME_ELAPSED);
TEST_STARTTIME = SYSTEM_TIME;
TIME_ELAPSED = 0;
TEST_SPEED = 0;
}
Of course now that it is done like this, you will want to put anything that is draw in it's own section and call it the same time you call the sync command
Making dreams possible, one line at a time...