virtual bool OnInit() { if (!wxApp::OnInit()) return false; // check for memory leaks #if defined(_DEBUG) && defined(_MSC_VER) // Track all memory leaks at the operating system level. // make sure no Newton tool or utility leaves leaks behind. _CrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF|_CrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF)); #endif // wxJoystick stick(wxJOYSTICK1); // if (!stick.IsOk()) { // wxMessageBox(wxT("No joystick detected!")); // return false; // } // Set the memory allocation function before creation the newton world // this is the only function that can be called before the creation of the newton world. // it should be called once, and the the call is optional NewtonSetMemorySystem (PhysicsAlloc, PhysicsFree); int version = NewtonWorldGetVersion(); wxString title; title.Printf (wxT ("Newton %d.%02d SDK demos"), version / 100, version % 100); NewtonDemos* const frame = new NewtonDemos(title, wxDefaultPosition, wxSize(DEMO_WIDTH, DEMO_HEIGHT)); frame->Show(true); SetTopWindow(frame); // initialize opengl graphics if (frame->m_scene) { frame->m_scene->InitGraphicsSystem(); } // load the default Scene wxMenuEvent loadDemo (wxEVT_COMMAND_MENU_SELECTED, NewtonDemos::ID_RUN_DEMO + DEFAULT_SCENE); frame->GetEventHandler()->ProcessEvent(loadDemo); // select solve mode wxMenuEvent solverMode (wxEVT_COMMAND_MENU_SELECTED, NewtonDemos::ID_SOLVER_MODE + 3); frame->GetEventHandler()->ProcessEvent(solverMode); return true; }
/*--------------------------------------------*/ void SaveLoad_Class::loadRoutine() { loadDemo(); }