PhysicsSystem.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #pragma once
  2. #include "ErrorHandlerLocator.h"
  3. #include "System.h"
  4. #include "PhysicsScene.h"
  5. class PhysicsSystem : public SystemBase
  6. {
  7. public:
  8. PhysicsSystem()
  9. {
  10. m_physicsScene = nullptr;
  11. m_systemName = GetString(Systems::Physics);
  12. }
  13. ~PhysicsSystem() { }
  14. ErrorCode init()
  15. {
  16. ErrorCode returnCode = ErrorCode::Success;
  17. ErrHandlerLoc::get().log(ErrorCode::Initialize_success, ErrorSource::Source_Physics);
  18. return returnCode;
  19. }
  20. ErrorCode setup(const PropertySet &p_properties)
  21. {
  22. ErrorCode returnCode = ErrorCode::Success;
  23. return returnCode;
  24. }
  25. virtual ErrorCode preload()
  26. {
  27. ErrorCode returnCode = ErrorCode::Success;
  28. return returnCode;
  29. }
  30. void loadInBackground() { }
  31. Systems::TypeID getSystemType() { return Systems::Physics; }
  32. SystemScene *createScene(SceneLoader *p_sceneLoader)
  33. {
  34. if(m_physicsScene == nullptr)
  35. {
  36. // Create new scene
  37. m_physicsScene = new PhysicsScene(this, p_sceneLoader);
  38. ErrorCode sceneError = m_physicsScene->init();
  39. // Check if it initialized correctly (cannot continue without the scene)
  40. if(sceneError != ErrorCode::Success)
  41. {
  42. ErrHandlerLoc::get().log(sceneError);
  43. }
  44. }
  45. return m_physicsScene;
  46. }
  47. SystemScene *getScene() { return m_physicsScene; }
  48. protected:
  49. PhysicsScene *m_physicsScene;
  50. };