added a max fps mechanism with thread sleeping in App.cpp, refactoring