main.cpp 922 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. //#define EXAMPLE_CONSOLE_ONLY
  2. #ifdef EXAMPLE_CONSOLE_ONLY
  3. #include "EmptyBrowser.h"
  4. typedef EmptyBrowser DefaultBrowser;
  5. #else
  6. #include "OpenGLExampleBrowser.h"
  7. typedef OpenGLExampleBrowser DefaultBrowser;
  8. #endif //EXAMPLE_CONSOLE_ONLY
  9. #include "Bullet3Common/b3CommandLineArgs.h"
  10. #include "../Utils/b3Clock.h"
  11. #include "ExampleEntries.h"
  12. #include "Bullet3Common/b3Logging.h"
  13. int main(int argc, char* argv[])
  14. {
  15. b3CommandLineArgs args(argc,argv);
  16. b3Clock clock;
  17. ExampleEntries examples;
  18. examples.initExampleEntries();
  19. ExampleBrowserInterface* exampleBrowser = new DefaultBrowser(&examples);
  20. bool init = exampleBrowser->init(argc,argv);
  21. clock.reset();
  22. if (init)
  23. {
  24. do
  25. {
  26. float deltaTimeInSeconds = clock.getTimeMicroseconds()/1000000.f;
  27. clock.reset();
  28. exampleBrowser->update(deltaTimeInSeconds);
  29. } while (!exampleBrowser->requestedExit());
  30. }
  31. delete exampleBrowser;
  32. return 0;
  33. }