mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 02:51:49 +00:00
refactor: extract post-runnables to a separate class
This commit is contained in:
parent
e98132f4da
commit
357e4f8607
3 changed files with 35 additions and 21 deletions
|
|
@ -184,7 +184,7 @@ void Engine::run() {
|
|||
|
||||
void Engine::postUpdate() {
|
||||
network->update();
|
||||
processPostRunnables();
|
||||
postRunnables.run();
|
||||
}
|
||||
|
||||
void Engine::updateFrontend() {
|
||||
|
|
@ -213,15 +213,6 @@ void Engine::renderFrame() {
|
|||
gui->draw(ctx, *assets);
|
||||
}
|
||||
|
||||
void Engine::processPostRunnables() {
|
||||
std::lock_guard<std::recursive_mutex> lock(postRunnablesMutex);
|
||||
while (!postRunnables.empty()) {
|
||||
postRunnables.front()();
|
||||
postRunnables.pop();
|
||||
}
|
||||
scripting::process_post_runnables();
|
||||
}
|
||||
|
||||
void Engine::saveSettings() {
|
||||
logger.info() << "saving settings";
|
||||
files::write_string(paths.getSettingsFile(), toml::stringify(settingsHandler));
|
||||
|
|
@ -517,11 +508,6 @@ std::shared_ptr<Screen> Engine::getScreen() {
|
|||
return screen;
|
||||
}
|
||||
|
||||
void Engine::postRunnable(const runnable& callback) {
|
||||
std::lock_guard<std::recursive_mutex> lock(postRunnablesMutex);
|
||||
postRunnables.push(callback);
|
||||
}
|
||||
|
||||
SettingsHandler& Engine::getSettingsHandler() {
|
||||
return settingsHandler;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue