spawning objects

This commit is contained in:
DanielProl1xy 2024-02-19 10:10:53 +03:00
parent f717e1c109
commit cce4bfb637
2 changed files with 5 additions and 2 deletions

View File

@ -17,9 +17,9 @@ public:
~Object() { destroyed(); } ~Object() { destroyed(); }
public: public:
virtual void spawned() { } virtual void spawned() { }
virtual void update(float delta) { } virtual void update(float delta) { }
virtual void destroyed() { } virtual void destroyed() { }
}; };
#endif /* OBJECT_H */ #endif /* OBJECT_H */

View File

@ -48,6 +48,9 @@ public:
World* getWorld(); World* getWorld();
// Spawns object of class T and returns pointer to it.
// @param T class that derives the Object class
// @param args pass arguments needed for T class constructor
template<class T, typename... Args> template<class T, typename... Args>
std::shared_ptr<T> spawnObject(Args&&... args); std::shared_ptr<T> spawnObject(Args&&... args);
}; };