handle deltatime in main loop