faut tout pt encore

This commit is contained in:
2025-01-14 16:10:40 +01:00
parent c5de18a9b3
commit 58cafd7682
7 changed files with 47 additions and 88 deletions

View File

@@ -93,7 +93,7 @@ void imguiManager::WidgetAddObject(ApplicationClass* app)
ofn.lpstrFile = szFile;
ofn.lpstrFile[0] = '\0';
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = L"TXT\0*.txt\0KOBJ\0*.kobj\0*OBJ\0*.obj";
ofn.lpstrFilter = L"OBJ\0*.obj\0KOBJ\0*.kobj\0TXT\0*.txt";
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
@@ -169,36 +169,15 @@ void imguiManager::WidgetObjectWindow(ApplicationClass* app)
"Refraction"
};
for (int count = 0; count < 1; count++)
{
std::string textureLabel = "Texture##" + std::to_string(index);
ID3D11ShaderResourceView* texture = object->GetTexture(count);
if (texture != nullptr)
{
// Set the cursor position
ImGui::SetCursorPosX(count * (64 + 20) + 10); // 64 is the width of the image, 10 is the spacing
// Display the texture name
std::string textureName = textureCategories[count];
ImGui::Text(textureName.c_str());
if(count < 5)
{
ImGui::SameLine();
}
}
}
// Display all images
for (int count = 0; count < 1; count++)
for (int count = 0; count < textureCategories.size(); count++)
{
std::string textureLabel = "Texture##" + std::to_string(index);
std::string textureLabel = "Texture##" + std::to_string(index) + "##" + std::to_string(count);
ID3D11ShaderResourceView* texture = object->GetTexture(count);
if (texture != nullptr)
{
// Set the cursor position
ImGui::SetCursorPosX(count * (64 + 20) + 10); // 64 is the width of the image, 10 is the spacing
ImGui::Text(textureCategories[count].c_str());
ImGui::SameLine();
if (ImGui::ImageButton((ImTextureID)texture, ImVec2(64, 64)))
{
@@ -221,7 +200,7 @@ void imguiManager::WidgetObjectWindow(ApplicationClass* app)
if (GetOpenFileName(&ofn))
{
// Load the selected texture
object->ChangeTexture(m_device, m_deviceContext, ofn.lpstrFile, index);
object->ChangeTexture(m_device, m_deviceContext, ofn.lpstrFile, count);
}
}
@@ -232,8 +211,7 @@ void imguiManager::WidgetObjectWindow(ApplicationClass* app)
ImGui::EndTooltip();
}
// If this is not the last texture, put the next button on the same line
if (count < 5)
if (count < textureCategories.size() - 1)
{
ImGui::SameLine();
}
@@ -310,6 +288,7 @@ void imguiManager::WidgetTerrainWindow(ApplicationClass* app)
app->DeleteTerrain();
}
ImGui::End();
}