// IDE Version: 16.793
// SETCURRENTDIR("Media") // go to media files
ALLOWESCAPE TRUE
GLOBAL fps_time% = 0,fps_temp% = 0
GLOBAL frametime% = 10000 // millisecs
SETSCREEN 800,600,0
GLOBAL dip1% = TRUE, dip2% = TRUE
//--------------------------------------------------------------
SETLOOPSUB "MainLoop"
SUB MainLoop:
fps_time = GETTIMERALL()
IF (fps_time-fps_temp)> 1000 AND frametime > 0
frametime = frametime - 1000
fps_temp = fps_time
ENDIF
IF frametime = 0 THEN dip1 = FALSE
IF dip1 = TRUE
DRAWRECT 100,100,100,100,RGB(0x00, 0x80, 0x00)
PRINT frametime/1000,110,110
ENDIF
IF MOUSEAXIS(3)
frametime = 10000
dip1 = TRUE
ENDIF
PRINT getfps()+" FPS",10,10
PRINT "left mousebutton reset", 10,40
SHOWSCREEN
ENDSUB
//-------------------------------------------------------------
FUNCTION getfps:
STATIC fps_time%,fps_counter%,fps%,fps_temp%
fps_time = GETTIMERALL()
fps_counter = fps_counter + 1
IF (fps_time-fps_temp)>1000
fps_temp = fps_time
fps = fps_counter
fps_counter = 0
ENDIF
RETURN fps
ENDFUNCTION