void GameLogicProcessor::FrameStart() { // LOG(EngineLog, BE_LOG_VERBOSE) << "GameLogicProcessor::FrameStart\n"; // Initialize all components not yet initialized for (ComponentHandle hdl : m_notInitialized) { auto& pieces = gameLogicHolder->getComponent(hdl)->m_gamelogics; for (size_t i = 0; i < pieces.size(); ++i) { GameLogic* logic = pieces[i]; GameLogic::RunEvents ev = logic->getRunEvents(); if (ev & GameLogic::RunEvents::EFrameStart){ m_onFrameStart.emplace_back(logic); } if (ev & GameLogic::RunEvents::EFrameMiddle){ m_onFrameMiddle.emplace_back(logic); } if (ev & GameLogic::RunEvents::EFrameEnd){ m_onFrameEnd.emplace_back(logic); } if (!logic->init()){ LOG(EngineLog, BE_LOG_ERROR) << "GameLogicProcessor: GameLogicComponent " << hdl << " logic " << i << " failed to Init! "; } } } m_notInitialized.clear(); // Run FrameStart on all components for (GameLogic* l : m_onFrameStart){ l->frameStart(); } }
int main() { GameLogic logic; logic.init(); return logic.exec(); }