Minor Update - Import file

Feat :

+ Import Button to import from file a 3D object
This commit is contained in:
CatChow0 2024-04-05 16:33:52 +02:00
parent 3323dfa6ad
commit bb15be5bd3
3 changed files with 27 additions and 1 deletions

View File

@ -159,7 +159,7 @@ bool SystemClass::Frame()
return false;
}
// Render ImGui
// Render ImGui
m_imguiManager->ImGuiWidgetRenderer(m_Application);
return true;

View File

@ -441,6 +441,7 @@ void ApplicationClass::Shutdown()
delete[] m_MouseStrings;
m_MouseStrings = 0;
}
// Release the text object for the fps string.
if (m_FpsString)
{

View File

@ -74,6 +74,31 @@ void imguiManager::WidgetAddObject(ApplicationClass* app)
}
ImGui::SameLine();
ImGui::Text("Number of cubes: %d", app->GetCubeCount());
if (ImGui::Button("Import Object"))
{
// Open file dialog
OPENFILENAME ofn;
WCHAR szFile[260];
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = NULL;
ofn.lpstrFile = szFile;
ofn.lpstrFile[0] = '\0';
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = L"OBJ\0*.obj\0TXT\0*.txt\0KOBJ\0*.kobj";
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
if (GetOpenFileName(&ofn))
{
app->AddKobject(ofn.lpstrFile);
}
}
}
}