| 6 | std::once_flag of; |
| 7 | |
| 8 | void MainLoop() |
| 9 | { |
| 10 | std::call_once(of, []() |
| 11 | { |
| 12 | WFP::onGameInitEvent().executeAll(); |
| 13 | }); |
| 14 | |
| 15 | WFP::onGameProcessEvent().executeAll(); |
| 16 | |
| 17 | static bool oldMenuState = GameFlowManager::IsPaused(); |
| 18 | bool curMenuState = GameFlowManager::IsPaused(); |
| 19 | if (curMenuState != oldMenuState) |
| 20 | { |
| 21 | if (curMenuState) |
| 22 | WFP::onMenuEnterEvent().executeAll(); |
| 23 | else |
| 24 | WFP::onMenuExitEvent().executeAll(); |
| 25 | } |
| 26 | oldMenuState = curMenuState; |
| 27 | if (curMenuState) |
| 28 | WFP::onMenuDrawingEvent().executeAll(); |
| 29 | } |
| 30 | |
| 31 | void Init() |
| 32 | { |