Minor update - ImGui
Feat : ~ Seul la fenêtre principale est ouverte par default + Bouton dans la fenêtre principale pour ouvrir les autres fenêtre disponible + Croix pour fermer les fenêtre ouverte en plus de la fenêtre principale
This commit is contained in:
parent
8d344dbfc7
commit
5a6efc909f
@ -3,7 +3,7 @@ Pos=60,60
|
|||||||
Size=400,400
|
Size=400,400
|
||||||
|
|
||||||
[Window][Khaotic Engine]
|
[Window][Khaotic Engine]
|
||||||
Pos=819,137
|
Pos=172,20
|
||||||
Size=694,210
|
Size=694,210
|
||||||
|
|
||||||
[Window][Objects]
|
[Window][Objects]
|
||||||
@ -15,6 +15,6 @@ Pos=892,19
|
|||||||
Size=418,94
|
Size=418,94
|
||||||
|
|
||||||
[Window][Light]
|
[Window][Light]
|
||||||
Pos=70,378
|
Pos=185,468
|
||||||
Size=418,240
|
Size=418,240
|
||||||
|
|
||||||
|
@ -73,8 +73,6 @@ void imguiManager::WidgetAddObject(ApplicationClass* app)
|
|||||||
app->AddCube();
|
app->AddCube();
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::Text("Number of cubes: %d", app->GetCubeCount());
|
|
||||||
|
|
||||||
if (ImGui::Button("Import Object"))
|
if (ImGui::Button("Import Object"))
|
||||||
{
|
{
|
||||||
// Open file dialog
|
// Open file dialog
|
||||||
@ -99,12 +97,14 @@ void imguiManager::WidgetAddObject(ApplicationClass* app)
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::Text("Number of cubes: %d", app->GetCubeCount());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void imguiManager::WidgetObjectWindow(ApplicationClass* app)
|
void imguiManager::WidgetObjectWindow(ApplicationClass* app)
|
||||||
{
|
{
|
||||||
ImGui::Begin("Objects");
|
ImGui::Begin("Objects", &showObjectWindow);
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (auto& object : app->GetKobjects())
|
for (auto& object : app->GetKobjects())
|
||||||
{
|
{
|
||||||
@ -160,7 +160,7 @@ void imguiManager::WidgetObjectWindow(ApplicationClass* app)
|
|||||||
|
|
||||||
void imguiManager::WidgetTerrainWindow(ApplicationClass* app)
|
void imguiManager::WidgetTerrainWindow(ApplicationClass* app)
|
||||||
{
|
{
|
||||||
ImGui::Begin("Terrain");
|
ImGui::Begin("Terrain", &showTerrainWindow);
|
||||||
|
|
||||||
ImGui::Text("Number of terrain cubes: %d", app->GetTerrainCubeCount());
|
ImGui::Text("Number of terrain cubes: %d", app->GetTerrainCubeCount());
|
||||||
|
|
||||||
@ -195,12 +195,42 @@ void imguiManager::ImGuiWidgetRenderer(ApplicationClass* app)
|
|||||||
WidgetButton();
|
WidgetButton();
|
||||||
WidgetFPS();
|
WidgetFPS();
|
||||||
WidgetAddObject(app);
|
WidgetAddObject(app);
|
||||||
WidgetObjectWindow(app);
|
ImGui::Separator();
|
||||||
WidgetTerrainWindow(app);
|
|
||||||
WidgetLightWindow(app);
|
// Add buttons for opening windows
|
||||||
|
if (ImGui::Button("Open Object Window"))
|
||||||
|
{
|
||||||
|
showObjectWindow = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ImGui::Button("Open Terrain Window"))
|
||||||
|
{
|
||||||
|
showTerrainWindow = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ImGui::Button("Open Light Window"))
|
||||||
|
{
|
||||||
|
showLightWindow = true;
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
|
|
||||||
|
// Show windows if their corresponding variables are true
|
||||||
|
if (showObjectWindow)
|
||||||
|
{
|
||||||
|
WidgetObjectWindow(app);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (showTerrainWindow)
|
||||||
|
{
|
||||||
|
WidgetTerrainWindow(app);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (showLightWindow)
|
||||||
|
{
|
||||||
|
WidgetLightWindow(app);
|
||||||
|
}
|
||||||
|
|
||||||
//render imgui
|
//render imgui
|
||||||
Render();
|
Render();
|
||||||
|
|
||||||
@ -209,7 +239,7 @@ void imguiManager::ImGuiWidgetRenderer(ApplicationClass* app)
|
|||||||
|
|
||||||
void imguiManager::WidgetLightWindow(ApplicationClass* app)
|
void imguiManager::WidgetLightWindow(ApplicationClass* app)
|
||||||
{
|
{
|
||||||
ImGui::Begin("Light");
|
ImGui::Begin("Light", &showLightWindow);
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for(auto& light : app->GetLights())
|
for(auto& light : app->GetLights())
|
||||||
{
|
{
|
||||||
|
@ -32,6 +32,11 @@ public:
|
|||||||
|
|
||||||
void ImGuiWidgetRenderer(ApplicationClass* app);
|
void ImGuiWidgetRenderer(ApplicationClass* app);
|
||||||
|
|
||||||
|
private :
|
||||||
|
bool showObjectWindow = false;
|
||||||
|
bool showTerrainWindow = false;
|
||||||
|
bool showLightWindow = false;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ImGuiIO* io;
|
ImGuiIO* io;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user