Commit 9927aeba authored by chili's avatar chili
Browse files

select boxes to manipulate

parent 8e18159c
...@@ -110,8 +110,39 @@ void App::DoFrame() ...@@ -110,8 +110,39 @@ void App::DoFrame()
// imgui windows to control camera and light // imgui windows to control camera and light
cam.SpawnControlWindow(); cam.SpawnControlWindow();
light.SpawnControlWindow(); light.SpawnControlWindow();
// imgui window to adjust box instance parameters // imgui window to open box windows
boxes.front()->SpawnControlWindow( 69,wnd.Gfx() ); if( ImGui::Begin( "Boxes" ) )
{
using namespace std::string_literals;
const auto preview = comboBoxIndex ? std::to_string( *comboBoxIndex ) : "Choose a box..."s;
if( ImGui::BeginCombo( "Box Number",preview.c_str() ) )
{
for( int i = 0; i < boxes.size(); i++ )
{
const bool selected = *comboBoxIndex == i;
if( ImGui::Selectable( std::to_string( i ).c_str(),selected ) )
{
comboBoxIndex = i;
}
if( selected )
{
ImGui::SetItemDefaultFocus();
}
}
ImGui::EndCombo();
}
if( ImGui::Button( "Spawn Control Window" ) && comboBoxIndex )
{
boxControlIds.insert( *comboBoxIndex );
comboBoxIndex.reset();
}
}
ImGui::End();
// imgui box attribute control windows
for( auto id : boxControlIds )
{
boxes[id]->SpawnControlWindow( id,wnd.Gfx() );
}
// present // present
wnd.Gfx().EndFrame(); wnd.Gfx().EndFrame();
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "ImguiManager.h" #include "ImguiManager.h"
#include "Camera.h" #include "Camera.h"
#include "PointLight.h" #include "PointLight.h"
#include <set>
class App class App
{ {
...@@ -24,4 +25,6 @@ private: ...@@ -24,4 +25,6 @@ private:
Camera cam; Camera cam;
PointLight light; PointLight light;
static constexpr size_t nDrawables = 180; static constexpr size_t nDrawables = 180;
std::optional<int> comboBoxIndex;
std::set<int> boxControlIds;
}; };
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment