void Level::handleEvents(Application &App) { const sf::Input& Input = App.GetInput(); sf::Event Event; while(App.GetEvent(Event)) { // Window closed (By clicking on the big red X on the top right of the window) if (Event.Type == sf::Event::Closed) { App.Close(); m_exit = true; return; } } // If escape key is pressed close the window (application). if(Input.IsKeyDown(sf::Key::Escape)) { App.Close(); m_exit = true; return; } // If there is NOT(!) an active menu go ahead and take input for the panels if(!m_active_menu) { m_gui.handleEvent(Input); } // If there is an active menu, only take input for it if(m_active_menu) { // Get input for pop up menu m_active_menu->handleEvent(Input); } }
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { #ifdef _DEBUG _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); #endif Application* application = new Application; if(application->Init(&__argc,__argv,hInstance,hPrevInstance,lpCmdLine,nCmdShow)){ application->Run(); } application->Close(); delete application; printf("Push any key to Exit\n"); _getch(); return 0; }