mirror of
https://github.com/Poikilos/SAM-Viewer.git
synced 2023-10-03 07:58:48 -07:00
Simplify dialog threading
This commit is contained in:
parent
224f2d0be1
commit
730f15058f
@ -24,6 +24,14 @@ namespace dialog
|
||||
|
||||
void showFileOpen(IGUIEnvironment *env, s32 id, const char *caption,
|
||||
const char **filters, const int filter_count)
|
||||
{
|
||||
std::thread thread(fileOpen, env, id, caption, filters,
|
||||
filter_count);
|
||||
thread.detach();
|
||||
}
|
||||
|
||||
void fileOpen(IGUIEnvironment *env, s32 id, const char *caption,
|
||||
const char **filters, const int filter_count)
|
||||
{
|
||||
IGUIWindow *window = env->addWindow(rect<s32>(0,0,0,0), true);
|
||||
window->setVisible(false);
|
||||
@ -554,10 +562,9 @@ bool TexturesDialog::OnEvent(const SEvent &event)
|
||||
}
|
||||
if (texture_id)
|
||||
{
|
||||
std::thread thread(dialog::showFileOpen,
|
||||
Environment, texture_id, "Open Image File",
|
||||
dialog::texture_filters, dialog::texture_filter_count);
|
||||
thread.detach();
|
||||
dialog::showFileOpen(Environment, texture_id,
|
||||
"Open Image File", dialog::texture_filters,
|
||||
dialog::texture_filter_count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,10 @@ namespace dialog
|
||||
extern bool has_event;
|
||||
extern SEvent event;
|
||||
|
||||
void showFileOpen(IGUIEnvironment *env, s32 id, const char *caption,
|
||||
void showFileOpen(IGUIEnvironment *env, s32 id, const char *caption,
|
||||
const char **filters, const int filter_count);
|
||||
|
||||
void fileOpen(IGUIEnvironment *env, s32 id, const char *caption,
|
||||
const char **filters, const int filter_count);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
#include <stdlib.h>
|
||||
#include <thread>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <irrlicht.h>
|
||||
@ -161,21 +160,15 @@ bool Viewer::OnEvent(const SEvent &event)
|
||||
switch (id)
|
||||
{
|
||||
case E_GUI_ID_LOAD_MODEL_MESH:
|
||||
{
|
||||
std::thread thread(dialog::showFileOpen, env,
|
||||
E_GUI_ID_LOAD_MODEL_MESH, "Open main model file",
|
||||
dialog::model_filters, dialog::model_filter_count);
|
||||
thread.detach();
|
||||
dialog::showFileOpen(env, E_GUI_ID_LOAD_MODEL_MESH,
|
||||
"Open main model file", dialog::model_filters,
|
||||
dialog::model_filter_count);
|
||||
break;
|
||||
}
|
||||
case E_GUI_ID_LOAD_WIELD_MESH:
|
||||
{
|
||||
std::thread thread(dialog::showFileOpen, env,
|
||||
E_GUI_ID_LOAD_WIELD_MESH, "Open wield model file",
|
||||
dialog::model_filters, dialog::model_filter_count);
|
||||
thread.detach();
|
||||
dialog::showFileOpen(env, E_GUI_ID_LOAD_WIELD_MESH,
|
||||
"Open wield model file", dialog::model_filters,
|
||||
dialog::model_filter_count);
|
||||
break;
|
||||
}
|
||||
case E_GUI_ID_ENABLE_WIELD:
|
||||
{
|
||||
ISceneNode *wield = scene->getNode(E_SCENE_ID_WIELD);
|
||||
|
Loading…
x
Reference in New Issue
Block a user