// here comes the main control function: it initialises the dyna system // and then creates a chain of cubes void main(){ int i; MyCube* cube[NCUBES]; My_dyna_system_callbacks *dsc=new My_dyna_system_callbacks(); DL_m_integrator* my_int=new DL_rungekutta2(); DL_dyna_system dsystem(dsc,my_int); DL_constraint_manager *constraints=new DL_constraint_manager(); constraints->max_error=0.0001; DL_point pos(0.75*NCUBES,1.75*NCUBES,4*NCUBES); DL_vector vec(-2,-2,-2); for (i=0;i<NCUBES;i++){ cube[i]=new MyCube(pos); pos.plusis(&vec); } cube[0]->ConnectTo(NULL); for (i=1;i<NCUBES;i++) cube[i]->ConnectTo(cube[i-1]); vec.init(0,-1,0); dsystem.set_gravity(&vec); my_int->set_stepsize(0.02); InitRender(dsystem,cube,NCUBES); // everything initialised. Now let the animation run: #ifdef USINGDIRECTX while (RenderCubes(cube)) { dsystem.dynamics(); if (fabs(dsystem.time()-70)<0.01) cube[NCUBES/2]->Disconnect(); } #else RenderCubes(); #endif // USINGDIRECTX // all done: clean up: for (i=0;i<NCUBES;i++) delete cube[i]; delete constraints; delete my_int; delete dsc; }
void BiosFlasher_OnSupportedPressed(GUI_Widget *widget) { dsystem("bflash -l"); ShowConsole(); }