to make a mainloop and monitor the fps