/// Update all the objects and render /// @param dt the time to increment by void SimContext::ProcessTick(float32_t dt) { // This will cause Irrlicht to render the objects UpdateRenderSystem(dt); // clear our lineset LineSet::instance().ClearSegments(); // This will look at any input from the user that happened since the // previous call and run the corresponding (Python) actions. This can // potentially change a lot of things such as which mod we want to run. UpdateInputSystem(dt); // Call the ProcessTick method of the global AI manager AIManager::instance().ProcessTick(dt); // This will loop through all the objects in the simulation, calling // their ProcessTick method. We need to know the actual position of // each object before this, and we will know the desired position after this. UpdateSimulation(dt); // This will trigger scheduled events in the Python script, // as well as ModTick(dt) if it is defined UpdateScriptingSystem(dt); }
bool FrameFunc() { // Process keys switch(hge->Input_GetKey()) { case HGEK_0: speed=0.0f; break; case HGEK_1: speed=0.1f; break; case HGEK_2: speed=0.2f; break; case HGEK_3: speed=0.4f; break; case HGEK_4: speed=0.8f; break; case HGEK_5: speed=1.6f; break; case HGEK_6: speed=3.2f; break; case HGEK_7: speed=6.4f; break; case HGEK_8: speed=12.8f; break; case HGEK_9: speed=25.6f; break; case HGEK_ESCAPE: return true; } // Update scene UpdateSimulation(); return false; }
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { MSG msg; HANDLE hAccelTable; if (!hPrevInstance) { if (!InitApplication(hInstance)) { return (FALSE); } } if (!InitInstance(hInstance, nCmdShow)) { return (FALSE); } hAccelTable = LoadAccelerators (hInstance, APPNAME); while (1) { while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { if (msg.message == WM_QUIT) { return msg.wParam; } TranslateMessage(&msg); DispatchMessage(&msg); } if(Initialized) UpdateSimulation(); } return (msg.wParam); lpCmdLine; }