| 455 | } |
| 456 | |
| 457 | void selectDemo(int demoIndex) |
| 458 | { |
| 459 | bool resetCamera = (sCurrentDemoIndex != demoIndex); |
| 460 | sCurrentDemoIndex = demoIndex; |
| 461 | sCurrentHightlighted = demoIndex; |
| 462 | int numDemos = gAllExamples->getNumRegisteredExamples(); |
| 463 | |
| 464 | if (demoIndex > numDemos) |
| 465 | { |
| 466 | demoIndex = 0; |
| 467 | } |
| 468 | deleteDemo(); |
| 469 | |
| 470 | CommonExampleInterface::CreateFunc* func = gAllExamples->getExampleCreateFunc(demoIndex); |
| 471 | if (func) |
| 472 | { |
| 473 | if (s_parameterInterface) |
| 474 | { |
| 475 | s_parameterInterface->removeAllParameters(); |
| 476 | } |
| 477 | int option = gAllExamples->getExampleOption(demoIndex); |
| 478 | s_guiHelper = new OpenGLGuiHelper(s_app, sUseOpenGL2); |
| 479 | s_guiHelper->setVisualizerFlagCallback(OpenGLExampleBrowserVisualizerFlagCallback); |
| 480 | |
| 481 | CommonExampleOptions options(s_guiHelper, option); |
| 482 | options.m_sharedMem = sSharedMem; |
| 483 | sCurrentDemo = (*func)(options); |
| 484 | if (sCurrentDemo) |
| 485 | { |
| 486 | if (gui2) |
| 487 | { |
| 488 | gui2->setStatusBarMessage("Status: OK", false); |
| 489 | } |
| 490 | b3Printf("Selected demo: %s", gAllExamples->getExampleName(demoIndex)); |
| 491 | if (gui2) |
| 492 | { |
| 493 | gui2->setExampleDescription(gAllExamples->getExampleDescription(demoIndex)); |
| 494 | } |
| 495 | |
| 496 | sCurrentDemo->initPhysics(); |
| 497 | if (resetCamera) |
| 498 | { |
| 499 | sCurrentDemo->resetCamera(); |
| 500 | } |
| 501 | } |
| 502 | } |
| 503 | } |
| 504 | |
| 505 | #include <stdio.h> |
| 506 |
no test coverage detected