added an fps control in main, and a global function get_fps in globals