Commit 724fe1fa authored by chili's avatar chili
Browse files

closeable box windows

parent 6df339c9
......@@ -155,9 +155,16 @@ void App::SpawnBoxWindowManagerWindow() noexcept
void App::SpawnBoxWindows() noexcept
{
for( auto id : boxControlIds )
for( auto i = boxControlIds.begin(); i != boxControlIds.end(); )
{
boxes[id]->SpawnControlWindow( id,wnd.Gfx() );
if( !boxes[*i]->SpawnControlWindow( *i,wnd.Gfx() ) )
{
i = boxControlIds.erase( i );
}
else
{
i++;
}
}
}
......
......@@ -69,12 +69,13 @@ DirectX::XMMATRIX Box::GetTransformXM() const noexcept
return dx::XMLoadFloat3x3( &mt ) * TestObject::GetTransformXM();
}
void Box::SpawnControlWindow( int id,Graphics& gfx ) noexcept
bool Box::SpawnControlWindow( int id,Graphics& gfx ) noexcept
{
using namespace std::string_literals;
bool dirty = false;
if( ImGui::Begin( ("Box "s + std::to_string( id )).c_str() ) )
bool open = true;
if( ImGui::Begin( ("Box "s + std::to_string( id )).c_str(),&open ) )
{
const auto cd = ImGui::ColorEdit3( "Material Color",&materialConstants.color.x );
const auto sid = ImGui::SliderFloat( "Specular Intensity",&materialConstants.specularIntensity,0.05f,4.0f,"%.2f",2 );
......@@ -87,6 +88,7 @@ void Box::SpawnControlWindow( int id,Graphics& gfx ) noexcept
{
SyncMaterial( gfx );
}
return open;
}
void Box::SyncMaterial( Graphics& gfx ) noexcept(!IS_DEBUG)
......
......@@ -13,7 +13,8 @@ public:
std::uniform_real_distribution<float>& bdist,
DirectX::XMFLOAT3 material );
DirectX::XMMATRIX GetTransformXM() const noexcept override;
void SpawnControlWindow( int id,Graphics& gfx ) noexcept;
// returns false if window is closed
bool SpawnControlWindow( int id,Graphics& gfx ) noexcept;
private:
void SyncMaterial( Graphics& gfx ) noexcept(!IS_DEBUG);
private:
......
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