| 4639 | } |
| 4640 | |
| 4641 | void PixelGameEngine::EngineThread() |
| 4642 | { |
| 4643 | // Allow platform to do stuff here if needed, since its now in the |
| 4644 | // context of this thread |
| 4645 | if (platform->ThreadStartUp() == olc::FAIL) return; |
| 4646 | |
| 4647 | // Do engine context specific initialisation |
| 4648 | olc_PrepareEngine(); |
| 4649 | |
| 4650 | // Create user resources as part of this thread |
| 4651 | for (auto& ext : vExtensions) ext->OnBeforeUserCreate(); |
| 4652 | if (!OnUserCreate()) bAtomActive = false; |
| 4653 | for (auto& ext : vExtensions) ext->OnAfterUserCreate(); |
| 4654 | |
| 4655 | while (bAtomActive) |
| 4656 | { |
| 4657 | // Run as fast as possible |
| 4658 | while (bAtomActive) { olc_CoreUpdate(); } |
| 4659 | |
| 4660 | // Allow the user to free resources if they have overrided the destroy function |
| 4661 | if (!OnUserDestroy()) |
| 4662 | { |
| 4663 | // User denied destroy for some reason, so continue running |
| 4664 | bAtomActive = true; |
| 4665 | } |
| 4666 | } |
| 4667 | |
| 4668 | platform->ThreadCleanUp(); |
| 4669 | } |
| 4670 | |
| 4671 | void PixelGameEngine::olc_PrepareEngine() |
| 4672 | { |
nothing calls this directly
no test coverage detected