MCPcopy Create free account
hub / github.com/Illation/ETEngine / Run

Method Run

Engine/source/EtRuntime/AbstractFramework.cpp:62–170  ·  view source on GitHub ↗

------------------------ AbstractFramework::Run Bootstrap the engine and start the main loop

Source from the content-addressed store, hash-verified

60// Bootstrap the engine and start the main loop
61//
62void AbstractFramework::Run()
63{
64 core::Logger::Initialize();//Init logger first because all output depends on it from the start
65 //Logger::StartFileLogging("debug_log.log");
66
67 LOG(FS("E.T.Engine"));
68 LOG(FS("//////////"));
69 LOG("");
70 LOG(FS(" - version: %s", et::build::Version::s_Name.c_str()));
71 LOG("");
72
73 fw::Config* const cfg = fw::Config::GetInstance();
74 cfg->Initialize();
75
76 // init unified scene, systems etc
77 fw::UnifiedScene::Instance().GetEventDispatcher().Register(fw::E_SceneEvent::RegisterSystems,
78 fw::T_SceneEventCallback([this](fw::T_SceneEventFlags const flags, fw::SceneEventData const* const eventData)
79 {
80 UNUSED(flags);
81 UNUSED(eventData);
82
83 OnSystemInit();
84 }));
85
86 // ensure we show the splash screen every time the scene switches
87 // Callback ID not required as we destroy the scene manager here before destroying this class
88 fw::UnifiedScene::Instance().GetEventDispatcher().Register(fw::E_SceneEvent::SceneSwitch | fw::E_SceneEvent::Activated,
89 fw::T_SceneEventCallback([this](fw::T_SceneEventFlags const flags, fw::SceneEventData const* const evnt)
90 {
91 UNUSED(evnt);
92
93 switch (static_cast<fw::E_SceneEvent>(flags))
94 {
95 case fw::E_SceneEvent::SceneSwitch:
96 m_Viewport->SetRenderer(m_SplashScreenRenderer);
97
98 m_Viewport->SetTickDisabled(true);
99 m_RenderArea.Update(); // update manually incase we don't run the game loop before the new scene is activated
100 m_Viewport->SetTickDisabled(false);
101 break;
102
103 case fw::E_SceneEvent::Activated:
104 m_Viewport->SetRenderer(m_SceneRenderer); // update will happen anyway during the loop
105 break;
106
107 default:
108 ET_ASSERT(true, "Unexpected scene event type!");
109 break;
110 }
111 }));
112
113 fw::UnifiedScene::Instance().Init();
114
115 // init rendering target
116 m_Viewport = new render::Viewport(&m_RenderArea);
117 m_SplashScreenRenderer = new render::SplashScreenRenderer();
118 m_Viewport->SetRenderer(m_SplashScreenRenderer);
119 m_RenderArea.Initialize(); // also initializes the viewport and its renderer

Callers 1

mainFunction · 0.80

Calls 12

RegisterMethod · 0.80
SetRendererMethod · 0.80
SetTickDisabledMethod · 0.80
SynchDimensionsMethod · 0.80
RedrawMethod · 0.80
GetRootPackageMethod · 0.80
InitRenderConfigMethod · 0.80
InitRenderingSystemsMethod · 0.80
LoadSceneMethod · 0.80
InitializeMethod · 0.45
UpdateMethod · 0.45
InitMethod · 0.45

Tested by

no test coverage detected