componentSystem.h 490 B

123456789101112131415161718192021222324252627282930
  1. #pragma once
  2. #include "console/engineAPI.h"
  3. template<typename T>
  4. class SystemInterface
  5. {
  6. public:
  7. bool mIsEnabled;
  8. bool mIsServer;
  9. static Vector<T*> all;
  10. SystemInterface()
  11. {
  12. all.push_back((T*)this);
  13. }
  14. virtual ~SystemInterface()
  15. {
  16. for (U32 i = 0; i < all.size(); i++)
  17. {
  18. if (all[i] == (T*)this)
  19. {
  20. all.erase(i);
  21. return;
  22. }
  23. }
  24. }
  25. };
  26. template<typename T> Vector<T*> SystemInterface<T>::all(0);