pause while not in focus

moved layer codes
added FPS tracking
added pausing while having lost focus