void GameLogic::run() { enable2D(); m_backgroundMusic.play(); m_platform.fetchUser(); while (!m_shutdown) { // platform handle input m_platform.processEvents(); m_backgroundMusic.tick(); switch (m_state) { case FetchUser: renderFetchUser(); break; case GamePlay: update(); renderGame(); break; case LeaderBoard: renderLeadBoard(); break; } } }
int _tmain(int argc, char** argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); glutInitWindowSize(width, height); glutCreateWindow("noobtuts.com Pong"); glutDisplayFunc(draw); glutTimerFunc(interval, update, 0); enable2D(width, height); glColor3f(1.0f, 1.0f, 1.0f); glutMainLoop(); return 0; }