2 #ifndef KJY_ANIM_ENGINE_SCENE_HPP_     3 #define KJY_ANIM_ENGINE_SCENE_HPP_     6 #include "util/Timeline.hpp"     7 #include "components/inheritable/drawable.hpp"     8 #include "components/inheritable/poseable.hpp"     9 #include "components/inheritable/camera.hpp"    10 #include "Entities/TypicalEntities.inl"    15     void pauseAll() {mGlobalTime.pause(); mAnimationTime.pause(); mEffectTime.pause(); }
    16     void unpauseAll() {mGlobalTime.unpause(); mAnimationTime.unpause(); mEffectTime.unpause(); }
    17     void togglePauseAll() {mGlobalTime.togglePause(); mAnimationTime.togglePause(); mEffectTime.togglePause(); }
    19     void addEntity(
Entity* entity);
    27     template<
typename DynamicType = Entity*>
    35     template<
typename DynamicType = Entity*>
    45     template<
typename DynamicType = Entity*>
    55     template<
typename DynamicType = Entity*>
    58     bool mShouldExit = 
false;
    60     std::vector<BaseCameraEntity*> cameras;
    61     size_t mActiveCameraIndex = 0;
    63     AnimatorCollection animators;
    65     std::unordered_map<ent_uuid_t, Entity*> entities;
    71     double mFrameTime = 0.0;
    73     double mStartTime = 0.0;
    74     double mEndTime = -1.0;
    76     std::string mSceneSpecialization;
    78     std::unordered_map<ent_uuid_t, Entity*> _all_entities;
    81     void _traverse_entity_for_bookeeping(
Entity* entity);
    84 template<
typename DynamicType>
    86     static_assert(std::is_pointer<DynamicType>::value, 
"Error: Type parameter given to findEntityByUUID must be a pointer to a type derived from Entity*");
    88     auto foundEnt = _all_entities.find(aId);
    89     if(foundEnt != _all_entities.end()){
    90         return(dynamic_cast<DynamicType>(foundEnt->second));
    95 template<
typename DynamicType>
    97     static_assert(std::is_pointer<DynamicType>::value, 
"Error: Type parameter given to findEntityByUUID must be a pointer to a type derived from Entity*");
    99     auto foundEnt = _all_entities.find(aId);
   100     if(foundEnt != _all_entities.end()){
   101         return(dynamic_cast<const DynamicType>(foundEnt->second));
   106 template<
typename DynamicType>
   108     static_assert(std::is_pointer<DynamicType>::value, 
"Error: Type parameter given to findEntityByName must be a pointer to a type derived from Entity*");
   109     for(
auto& [uuid, entity] : _all_entities){
   110         if(entity->getName() == aName){
   111             return(dynamic_cast<DynamicType>(entity));
   117 template<
typename DynamicType>
   119     static_assert(std::is_pointer<DynamicType>::value, 
"Error: Type parameter given to findEntityByName must be a pointer to a type derived from Entity*");
   120     for(
auto& [uuid, entity] : _all_entities){
   121         if(entity->getName() == aName){
   122             return(dynamic_cast<const DynamicType>(entity));
 DynamicType findEntityByName(const std::string &aName)
Definition: Scene.hpp:107
Definition: Timeline.hpp:9
Definition: EntitiesBase.hpp:18
const DynamicType findConstEntityByUUID(ent_uuid_t aId) const
Definition: Scene.hpp:96
const DynamicType findConstEntityByName(const std::string &aName) const
Definition: Scene.hpp:118
DynamicType findEntityByUUID(ent_uuid_t aId)
Definition: Scene.hpp:85