CommonExampleInterface.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #ifndef COMMON_EXAMPLE_INTERFACE_H
  2. #define COMMON_EXAMPLE_INTERFACE_H
  3. struct CommonExampleOptions
  4. {
  5. struct GUIHelperInterface* m_guiHelper;
  6. //Those are optional, some examples will use them others don't. Each example should work with them being 0.
  7. int m_option;
  8. const char* m_fileName;
  9. CommonExampleOptions(struct GUIHelperInterface* helper, int option=0)
  10. :m_guiHelper(helper),
  11. m_option(option),
  12. m_fileName(0)
  13. {
  14. }
  15. };
  16. class CommonExampleInterface
  17. {
  18. public:
  19. typedef class CommonExampleInterface* (CreateFunc)(CommonExampleOptions& options);
  20. virtual ~CommonExampleInterface()
  21. {
  22. }
  23. virtual void initPhysics()=0;
  24. virtual void exitPhysics()=0;
  25. virtual void stepSimulation(float deltaTime)=0;
  26. virtual void renderScene()=0;
  27. virtual void physicsDebugDraw(int debugFlags)=0;//for now we reuse the flags in Bullet/src/LinearMath/btIDebugDraw.h
  28. //reset camera is only called when switching demo. this way you can restart (initPhysics) and watch in a specific location easier
  29. virtual void resetCamera(){};
  30. virtual bool mouseMoveCallback(float x,float y)=0;
  31. virtual bool mouseButtonCallback(int button, int state, float x, float y)=0;
  32. virtual bool keyboardCallback(int key, int state)=0;
  33. };
  34. #endif //COMMON_EXAMPLE_INTERFACE_H