#pragma once #include #include #include #include "CSingleton.h" #include "CComponentsManager.h" #include "CConsole.h" #include "CRendererBase.h" #include "CResource.h" #include "CEntity.h" #include "CNetMessage.h" #include "CEntityComponent.h" #include "CBuildInfo.h" #include "CTime.h" #include "CPhysicsEngine.h" #define COMPONENT_CALL(type, call) try { auto comp = CEngine::GetInstance()->Components.GetComponentTyped(); if(comp) { comp->call; } } \ catch (const std::exception& e) { } \ catch (...) { } #define COMPONENT_CALL_GET(_var, type, call) try { auto comp = CEngine::GetInstance()->Components.GetComponentTyped(); if(comp) { _var = comp->call; } } \ catch (const std::exception& e) { } \ catch (...) { } #define COMPONENT_CALL_INTERNAL(type, call, name) try { auto comp = Components.GetComponentTyped(name); if(comp) { comp->call; } } \ catch (const std::exception& e) { } \ catch (...) { } #define COMPONENT_CALL_NAMED(type, name, call) try { auto comp = CEngine::GetInstance()->Components.GetComponentTyped(name); if(comp) { comp->call; } } \ catch (const std::exception& e) { } \ catch (...) { } class CEngine : public CSingleton { public: CEngine(const std::string& cmdline); ~CEngine(); void Init(); void Update(); void DeInit(); static void Run(const std::string& cmdline); static void ProcessEarlyInitters(); static void ProcessInitters(); void Quit(); bool GetStopFlag() const; CObjectFactory ComponentsFactory; CObjectFactory ConsoleFactory; CObjectFactory RenderersFactory; CObjectFactory ResourcesFactory; CObjectFactory EntitiesFactory; CObjectFactory EntityComponentsFactory; CObjectFactory NetMessagesFactory; CObjectFactory PhysicsEnginesFactory; CBuildInfo BuildInfo; CTime Time; CComponentsManager Components; std::string CommandLine; /* CLogger Logger; CTimeSystem TimeSystem; CResourceManager ResourceManager; CInputSystem InputSystem; CRenderer Renderer; CAudioSystem AudioSystem; CPhysicsSystem PhysicsSystem; CSceneManager SceneManager; */ class CHookProxy { public: CEngine& Engine; }; private: std::atomic_bool m_stopFlag = false; };