diff options
Diffstat (limited to 'src/crepe/api/Script.h')
-rw-r--r-- | src/crepe/api/Script.h | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/crepe/api/Script.h b/src/crepe/api/Script.h index 49e625f..d543df8 100644 --- a/src/crepe/api/Script.h +++ b/src/crepe/api/Script.h @@ -11,6 +11,7 @@ namespace crepe { class BehaviorScript; class Script { + //! ScriptSystem calls \c update() friend class crepe::ScriptSystem; protected: @@ -22,17 +23,25 @@ protected: // added event. protected: + //! Retrieve component from component manager (utility) template <typename T> T & get_component(); + //! Retrieve components from component manager (utility) template <typename T> std::vector<std::reference_wrapper<T>> get_components(); -private: - friend class crepe::BehaviorScript; - BehaviorScript * parent = nullptr; +protected: + // NOTE: Script must have a constructor without arguments so the game + // programmer doesn't need to manually add `using Script::Script` to their + // concrete script class. + Script() = default; + //! Only \c BehaviorScript instantiates Script + friend class BehaviorScript; + BehaviorScript * parent_ref = nullptr; }; } // namespace crepe #include "Script.hpp" + |