PollEvents before main loop and beautifies codes in CCApplication.cpp/.mm.
Merge pull request #5803 from dumganhar/develop

PollEvents should invoked before main loop and little improvement in CCApplication.cpp/.mm.