world converter threading

This commit is contained in:
MihailRis
2024-04-15 19:44:21 +03:00
parent ab110dcdf5
commit cc58ea29bc
10 changed files with 122 additions and 63 deletions
+4 -8
View File
@@ -116,7 +116,7 @@ void show_process_panel(Engine* engine, std::shared_ptr<Task> task, std::wstring
auto label = std::make_shared<Label>(L"0%");
panel->add(label);
uint initialWork = task->getWorkRemaining();
uint initialWork = task->getWorkTotal();
panel->listenInterval(0.01f, [=]() {
task->update();
@@ -134,25 +134,21 @@ void show_process_panel(Engine* engine, std::shared_ptr<Task> task, std::wstring
menu->setPage("process", false);
}
std::shared_ptr<WorldConverter> create_converter(
std::shared_ptr<Task> create_converter(
Engine* engine,
fs::path folder,
const Content* content,
std::shared_ptr<ContentLUT> lut,
runnable postRunnable)
{
auto converter = std::make_shared<WorldConverter>(folder, content, lut);
converter->setOnComplete([=](){
converter->write();
return WorldConverter::startTask(folder, content, lut, [=](){
auto menu = engine->getGUI()->getMenu();
menu->reset();
menu->setPage("main", false);
engine->getGUI()->postRunnable([=]() {
postRunnable();
});
});
return converter;
}, true);
}
void show_convert_request(