CObject.h 799 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #pragma once
  2. #include <string>
  3. #include <irrlicht/irrlicht.h>
  4. #include "WallpaperEngine/Core/CObject.h"
  5. #include "CScene.h"
  6. namespace WallpaperEngine::Render
  7. {
  8. class CScene;
  9. class CObject
  10. {
  11. public:
  12. template<class T> const T* As () const { assert (Is<T> ()); return (const T*) this; }
  13. template<class T> T* As () { assert (Is<T> ()); return (T*) this; }
  14. template<class T> bool Is () { return this->m_type == T::Type; }
  15. virtual void render () = 0;
  16. CScene* getScene () const;
  17. CContainer* getContainer () const;
  18. protected:
  19. CObject (CScene* scene, std::string type, Core::CObject *object);
  20. ~CObject ();
  21. private:
  22. std::string m_type;
  23. CScene* m_scene;
  24. Core::CObject* m_object;
  25. };
  26. }