move it to a thread

This commit is contained in:
briaguya 2022-06-03 02:55:45 -04:00
commit f07ad0c117

View file

@ -2071,6 +2071,11 @@ void GenerateRandomizerImgui() {
} }
void DrawRandoEditor(bool& open) { void DrawRandoEditor(bool& open) {
if (generated) {
generated = 0;
randoThread.join();
}
if (!open) { if (!open) {
return; return;
} }
@ -2088,14 +2093,12 @@ void DrawRandoEditor(bool& open) {
} }
if (ImGui::Button("Generate")) { if (ImGui::Button("Generate")) {
GenerateRandomizerImgui(); if (CVar_GetS32("gRandoGenerating", 0) == 0) {
randoThread = std::thread(&GenerateRandomizerImgui);
}
// GenerateRandomizerImgui();
} }
// if (generated) {
// generated = 0;
// randoThread.join();
// }
ImGui::End(); ImGui::End();
} }