diff --git a/Editor/AnimationWindow.cpp b/Editor/AnimationWindow.cpp index 71c98b637..8495e6488 100644 --- a/Editor/AnimationWindow.cpp +++ b/Editor/AnimationWindow.cpp @@ -12,16 +12,17 @@ AnimationWindow::AnimationWindow(EditorComponent* editor) : GUI(&editor->GetGUI( assert(GUI && "Invalid GUI!"); animWindow = new wiWindow(GUI, "Animation Window"); - animWindow->SetSize(XMFLOAT2(600, 300)); + animWindow->SetSize(XMFLOAT2(520, 140)); GUI->AddWidget(animWindow); - float x = 200; - float y = 0; - float step = 35; + float x = 140; + float y = 10; + float hei = 18; + float step = hei + 2; animationsComboBox = new wiComboBox("Animation: "); - animationsComboBox->SetSize(XMFLOAT2(300, 20)); + animationsComboBox->SetSize(XMFLOAT2(300, hei)); animationsComboBox->SetPos(XMFLOAT2(x, y += step)); animationsComboBox->SetEnabled(false); animationsComboBox->OnSelect([&](wiEventArgs args) { @@ -32,6 +33,7 @@ AnimationWindow::AnimationWindow(EditorComponent* editor) : GUI(&editor->GetGUI( loopedCheckBox = new wiCheckBox("Looped: "); loopedCheckBox->SetTooltip("Toggle animation looping behaviour."); + loopedCheckBox->SetSize(XMFLOAT2(hei, hei)); loopedCheckBox->SetPos(XMFLOAT2(150, y += step)); loopedCheckBox->OnClick([&](wiEventArgs args) { AnimationComponent* animation = wiScene::GetScene().animations.GetComponent(entity); @@ -44,6 +46,7 @@ AnimationWindow::AnimationWindow(EditorComponent* editor) : GUI(&editor->GetGUI( playButton = new wiButton("Play"); playButton->SetTooltip("Play/Pause animation."); + playButton->SetSize(XMFLOAT2(100, hei)); playButton->SetPos(XMFLOAT2(200, y)); playButton->OnClick([&](wiEventArgs args) { AnimationComponent* animation = wiScene::GetScene().animations.GetComponent(entity); @@ -64,6 +67,7 @@ AnimationWindow::AnimationWindow(EditorComponent* editor) : GUI(&editor->GetGUI( stopButton = new wiButton("Stop"); stopButton->SetTooltip("Stop animation."); + stopButton->SetSize(XMFLOAT2(100, hei)); stopButton->SetPos(XMFLOAT2(310, y)); stopButton->OnClick([&](wiEventArgs args) { AnimationComponent* animation = wiScene::GetScene().animations.GetComponent(entity); @@ -75,8 +79,8 @@ AnimationWindow::AnimationWindow(EditorComponent* editor) : GUI(&editor->GetGUI( animWindow->AddWidget(stopButton); timerSlider = new wiSlider(0, 1, 0, 100000, "Timer: "); - timerSlider->SetSize(XMFLOAT2(250, 30)); - timerSlider->SetPos(XMFLOAT2(x, y += step * 2)); + timerSlider->SetSize(XMFLOAT2(250, hei)); + timerSlider->SetPos(XMFLOAT2(x, y += step)); timerSlider->OnSlide([&](wiEventArgs args) { AnimationComponent* animation = wiScene::GetScene().animations.GetComponent(entity); if (animation != nullptr) @@ -89,7 +93,7 @@ AnimationWindow::AnimationWindow(EditorComponent* editor) : GUI(&editor->GetGUI( animWindow->AddWidget(timerSlider); amountSlider = new wiSlider(0, 1, 0, 100000, "Amount: "); - amountSlider->SetSize(XMFLOAT2(250, 30)); + amountSlider->SetSize(XMFLOAT2(250, hei)); amountSlider->SetPos(XMFLOAT2(x, y += step)); amountSlider->OnSlide([&](wiEventArgs args) { AnimationComponent* animation = wiScene::GetScene().animations.GetComponent(entity); @@ -103,7 +107,7 @@ AnimationWindow::AnimationWindow(EditorComponent* editor) : GUI(&editor->GetGUI( animWindow->AddWidget(amountSlider); speedSlider = new wiSlider(0, 4, 1, 100000, "Speed: "); - speedSlider->SetSize(XMFLOAT2(250, 30)); + speedSlider->SetSize(XMFLOAT2(250, hei)); speedSlider->SetPos(XMFLOAT2(x, y += step)); speedSlider->OnSlide([&](wiEventArgs args) { AnimationComponent* animation = wiScene::GetScene().animations.GetComponent(entity); diff --git a/Editor/CameraWindow.cpp b/Editor/CameraWindow.cpp index c81361efb..cd824ee4b 100644 --- a/Editor/CameraWindow.cpp +++ b/Editor/CameraWindow.cpp @@ -26,16 +26,17 @@ CameraWindow::CameraWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) camera_transform.UpdateTransform(); cameraWindow = new wiWindow(GUI, "Camera Window"); - cameraWindow->SetSize(XMFLOAT2(600, 420)); + cameraWindow->SetSize(XMFLOAT2(380, 260)); GUI->AddWidget(cameraWindow); float x = 200; - float y = 0; - float inc = 35; + float y = 10; + float hei = 18; + float step = hei + 2; farPlaneSlider = new wiSlider(1, 5000, 1000, 100000, "Far Plane: "); - farPlaneSlider->SetSize(XMFLOAT2(100, 30)); - farPlaneSlider->SetPos(XMFLOAT2(x, y += inc)); + farPlaneSlider->SetSize(XMFLOAT2(100, hei)); + farPlaneSlider->SetPos(XMFLOAT2(x, y += step)); farPlaneSlider->SetValue(wiRenderer::GetCamera().zFarP); farPlaneSlider->OnSlide([&](wiEventArgs args) { Scene& scene = wiScene::GetScene(); @@ -46,8 +47,8 @@ CameraWindow::CameraWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) cameraWindow->AddWidget(farPlaneSlider); nearPlaneSlider = new wiSlider(0.01f, 10, 0.1f, 10000, "Near Plane: "); - nearPlaneSlider->SetSize(XMFLOAT2(100, 30)); - nearPlaneSlider->SetPos(XMFLOAT2(x, y += inc)); + nearPlaneSlider->SetSize(XMFLOAT2(100, hei)); + nearPlaneSlider->SetPos(XMFLOAT2(x, y += step)); nearPlaneSlider->SetValue(wiRenderer::GetCamera().zNearP); nearPlaneSlider->OnSlide([&](wiEventArgs args) { Scene& scene = wiScene::GetScene(); @@ -58,8 +59,8 @@ CameraWindow::CameraWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) cameraWindow->AddWidget(nearPlaneSlider); fovSlider = new wiSlider(1, 179, 60, 10000, "FOV: "); - fovSlider->SetSize(XMFLOAT2(100, 30)); - fovSlider->SetPos(XMFLOAT2(x, y += inc)); + fovSlider->SetSize(XMFLOAT2(100, hei)); + fovSlider->SetPos(XMFLOAT2(x, y += step)); fovSlider->OnSlide([&](wiEventArgs args) { Scene& scene = wiScene::GetScene(); CameraComponent& camera = wiRenderer::GetCamera(); @@ -69,25 +70,26 @@ CameraWindow::CameraWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) cameraWindow->AddWidget(fovSlider); movespeedSlider = new wiSlider(1, 100, 10, 10000, "Movement Speed: "); - movespeedSlider->SetSize(XMFLOAT2(100, 30)); - movespeedSlider->SetPos(XMFLOAT2(x, y += inc)); + movespeedSlider->SetSize(XMFLOAT2(100, hei)); + movespeedSlider->SetPos(XMFLOAT2(x, y += step)); cameraWindow->AddWidget(movespeedSlider); rotationspeedSlider = new wiSlider(0.1f, 2, 1, 10000, "Rotation Speed: "); - rotationspeedSlider->SetSize(XMFLOAT2(100, 30)); - rotationspeedSlider->SetPos(XMFLOAT2(x, y += inc)); + rotationspeedSlider->SetSize(XMFLOAT2(100, hei)); + rotationspeedSlider->SetPos(XMFLOAT2(x, y += step)); cameraWindow->AddWidget(rotationspeedSlider); resetButton = new wiButton("Reset Camera"); - resetButton->SetSize(XMFLOAT2(140, 30)); - resetButton->SetPos(XMFLOAT2(x, y += inc)); + resetButton->SetSize(XMFLOAT2(140, hei)); + resetButton->SetPos(XMFLOAT2(x, y += step)); resetButton->OnClick([&](wiEventArgs args) { ResetCam(); }); cameraWindow->AddWidget(resetButton); fpsCheckBox = new wiCheckBox("FPS Camera: "); - fpsCheckBox->SetPos(XMFLOAT2(x, y += inc)); + fpsCheckBox->SetSize(XMFLOAT2(hei, hei)); + fpsCheckBox->SetPos(XMFLOAT2(x, y += step)); fpsCheckBox->SetCheck(true); cameraWindow->AddWidget(fpsCheckBox); @@ -95,8 +97,8 @@ CameraWindow::CameraWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) proxyButton = new wiButton("Place Proxy"); proxyButton->SetTooltip("Copy the current camera and place a proxy of it in the world."); - proxyButton->SetSize(XMFLOAT2(140, 30)); - proxyButton->SetPos(XMFLOAT2(x, y += inc * 2)); + proxyButton->SetSize(XMFLOAT2(140, hei)); + proxyButton->SetPos(XMFLOAT2(x, y += step * 2)); proxyButton->OnClick([&](wiEventArgs args) { const CameraComponent& camera = wiRenderer::GetCamera(); @@ -110,28 +112,16 @@ CameraWindow::CameraWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) }); cameraWindow->AddWidget(proxyButton); - proxyNameField = new wiTextInputField("Proxy Name: "); - proxyNameField->SetSize(XMFLOAT2(140, 30)); - proxyNameField->SetPos(XMFLOAT2(x + 200, y)); - proxyNameField->OnInputAccepted([&](wiEventArgs args) { - Scene& scene = wiScene::GetScene(); - NameComponent* camera = scene.names.GetComponent(proxy); - if (camera != nullptr) - { - *camera = args.sValue; - } - }); - cameraWindow->AddWidget(proxyNameField); - followCheckBox = new wiCheckBox("Follow Proxy: "); - followCheckBox->SetPos(XMFLOAT2(x, y += inc)); + followCheckBox->SetSize(XMFLOAT2(hei, hei)); + followCheckBox->SetPos(XMFLOAT2(x, y += step)); followCheckBox->SetCheck(false); cameraWindow->AddWidget(followCheckBox); followSlider = new wiSlider(0.0f, 0.999f, 0.0f, 1000.0f, "Follow Proxy Delay: "); - followSlider->SetSize(XMFLOAT2(100, 30)); - followSlider->SetPos(XMFLOAT2(x, y += inc)); + followSlider->SetSize(XMFLOAT2(100, hei)); + followSlider->SetPos(XMFLOAT2(x, y += step)); cameraWindow->AddWidget(followSlider); @@ -160,17 +150,11 @@ void CameraWindow::SetEntity(Entity entity) { followCheckBox->SetEnabled(true); followSlider->SetEnabled(true); - NameComponent* camera = scene.names.GetComponent(entity); - if (camera != nullptr) - { - proxyNameField->SetValue(camera->name); - } } else { followCheckBox->SetCheck(false); followCheckBox->SetEnabled(false); followSlider->SetEnabled(false); - proxyNameField->SetValue("Proxy Name: "); } } diff --git a/Editor/CameraWindow.h b/Editor/CameraWindow.h index 762714b3b..f833f0814 100644 --- a/Editor/CameraWindow.h +++ b/Editor/CameraWindow.h @@ -36,7 +36,6 @@ public: wiCheckBox* fpsCheckBox; wiButton* proxyButton; - wiTextInputField* proxyNameField; wiCheckBox* followCheckBox; wiSlider* followSlider; }; diff --git a/Editor/DecalWindow.cpp b/Editor/DecalWindow.cpp index 0b8bdb9b1..8c3e51fb7 100644 --- a/Editor/DecalWindow.cpp +++ b/Editor/DecalWindow.cpp @@ -11,17 +11,17 @@ DecalWindow::DecalWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) assert(GUI && "Invalid GUI!"); decalWindow = new wiWindow(GUI, "Decal Window"); - decalWindow->SetSize(XMFLOAT2(400, 300)); + decalWindow->SetSize(XMFLOAT2(400, 200)); GUI->AddWidget(decalWindow); float x = 200; float y = 5; - float step = 22; - float itemheight = 20; + float hei = 18; + float step = hei + 2; placementCheckBox = new wiCheckBox("Decal Placement Enabled: "); placementCheckBox->SetPos(XMFLOAT2(x, y += step)); - placementCheckBox->SetSize(XMFLOAT2(itemheight, itemheight)); + placementCheckBox->SetSize(XMFLOAT2(hei, hei)); placementCheckBox->SetCheck(false); placementCheckBox->SetTooltip("Enable decal placement. Use the left mouse button to place decals to the scene."); decalWindow->AddWidget(placementCheckBox); @@ -38,7 +38,7 @@ DecalWindow::DecalWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) decalNameField = new wiTextInputField("Decal Name"); decalNameField->SetPos(XMFLOAT2(10, y+=step)); - decalNameField->SetSize(XMFLOAT2(300, 20)); + decalNameField->SetSize(XMFLOAT2(300, hei)); decalNameField->OnInputAccepted([&](wiEventArgs args) { NameComponent* name = wiScene::GetScene().names.GetComponent(entity); if (name != nullptr) diff --git a/Editor/EmitterWindow.cpp b/Editor/EmitterWindow.cpp index 8e698c0e1..6b57d0718 100644 --- a/Editor/EmitterWindow.cpp +++ b/Editor/EmitterWindow.cpp @@ -13,13 +13,13 @@ EmitterWindow::EmitterWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) assert(GUI && "Invalid GUI!"); emitterWindow = new wiWindow(GUI, "Emitter Window"); - emitterWindow->SetSize(XMFLOAT2(680, 700)); + emitterWindow->SetSize(XMFLOAT2(680, 660)); GUI->AddWidget(emitterWindow); float x = 200; float y = 5; - float step = 22; - float itemheight = 20; + float itemheight = 18; + float step = itemheight + 2; emitterNameField = new wiTextInputField("EmitterName"); diff --git a/Editor/ForceFieldWindow.cpp b/Editor/ForceFieldWindow.cpp index 877f6238b..d8d44a2f3 100644 --- a/Editor/ForceFieldWindow.cpp +++ b/Editor/ForceFieldWindow.cpp @@ -11,16 +11,50 @@ ForceFieldWindow::ForceFieldWindow(EditorComponent* editor) : GUI(&editor->GetGU assert(GUI && "Invalid GUI!"); forceFieldWindow = new wiWindow(GUI, "Force Field Window"); - forceFieldWindow->SetSize(XMFLOAT2(600, 300)); + forceFieldWindow->SetSize(XMFLOAT2(420, 120)); GUI->AddWidget(forceFieldWindow); float x = 150; float y = 10; - float step = 35; + float hei = 18; + float step = hei + 2; + + addButton = new wiButton("Add Force Field"); + addButton->SetSize(XMFLOAT2(150, hei)); + addButton->SetPos(XMFLOAT2(x, y += step)); + addButton->OnClick([=](wiEventArgs args) { + Entity entity = wiScene::GetScene().Entity_CreateForce("editorForce"); + ForceFieldComponent* force = wiScene::GetScene().forces.GetComponent(entity); + if (force != nullptr) + { + switch (typeComboBox->GetSelected()) + { + case 0: + force->type = ENTITY_TYPE_FORCEFIELD_POINT; + break; + case 1: + force->type = ENTITY_TYPE_FORCEFIELD_PLANE; + break; + default: + assert(0); + break; + } + editor->ClearSelected(); + editor->AddSelected(entity); + SetEntity(entity); + } + else + { + assert(0); + } + }); + addButton->SetEnabled(true); + addButton->SetTooltip("Add new Force Field to the simulation."); + forceFieldWindow->AddWidget(addButton); typeComboBox = new wiComboBox("Force Field type: "); typeComboBox->SetPos(XMFLOAT2(x, y += step)); - typeComboBox->SetSize(XMFLOAT2(300, 25)); + typeComboBox->SetSize(XMFLOAT2(200, hei)); typeComboBox->OnSelect([&](wiEventArgs args) { ForceFieldComponent* force = wiScene::GetScene().forces.GetComponent(entity); if (force != nullptr && args.iValue >= 0) @@ -47,7 +81,7 @@ ForceFieldWindow::ForceFieldWindow(EditorComponent* editor) : GUI(&editor->GetGU gravitySlider = new wiSlider(-10, 10, 0, 100000, "Gravity: "); - gravitySlider->SetSize(XMFLOAT2(200, 30)); + gravitySlider->SetSize(XMFLOAT2(200, hei)); gravitySlider->SetPos(XMFLOAT2(x, y += step)); gravitySlider->OnSlide([&](wiEventArgs args) { ForceFieldComponent* force = wiScene::GetScene().forces.GetComponent(entity); @@ -62,7 +96,7 @@ ForceFieldWindow::ForceFieldWindow(EditorComponent* editor) : GUI(&editor->GetGU rangeSlider = new wiSlider(0.0f, 100.0f, 10, 100000, "Range: "); - rangeSlider->SetSize(XMFLOAT2(200, 30)); + rangeSlider->SetSize(XMFLOAT2(200, hei)); rangeSlider->SetPos(XMFLOAT2(x, y += step)); rangeSlider->OnSlide([&](wiEventArgs args) { ForceFieldComponent* force = wiScene::GetScene().forces.GetComponent(entity); @@ -76,40 +110,6 @@ ForceFieldWindow::ForceFieldWindow(EditorComponent* editor) : GUI(&editor->GetGU forceFieldWindow->AddWidget(rangeSlider); - addButton = new wiButton("Add Force Field"); - addButton->SetSize(XMFLOAT2(150, 30)); - addButton->SetPos(XMFLOAT2(x, y += step * 2)); - addButton->OnClick([=](wiEventArgs args) { - Entity entity = wiScene::GetScene().Entity_CreateForce("editorForce"); - ForceFieldComponent* force = wiScene::GetScene().forces.GetComponent(entity); - if (force != nullptr) - { - switch (typeComboBox->GetSelected()) - { - case 0: - force->type = ENTITY_TYPE_FORCEFIELD_POINT; - break; - case 1: - force->type = ENTITY_TYPE_FORCEFIELD_PLANE; - break; - default: - assert(0); - break; - } - editor->ClearSelected(); - editor->AddSelected(entity); - SetEntity(entity); - } - else - { - assert(0); - } - }); - addButton->SetEnabled(true); - addButton->SetTooltip("Add new Force Field to the simulation."); - forceFieldWindow->AddWidget(addButton); - - forceFieldWindow->Translate(XMFLOAT3((float)wiRenderer::GetDevice()->GetScreenWidth() - 720, 50, 0)); forceFieldWindow->SetVisible(false); diff --git a/Editor/HairParticleWindow.cpp b/Editor/HairParticleWindow.cpp index 90388db02..fc1e96c1c 100644 --- a/Editor/HairParticleWindow.cpp +++ b/Editor/HairParticleWindow.cpp @@ -11,17 +11,18 @@ HairParticleWindow::HairParticleWindow(EditorComponent* editor) : GUI(&editor->G assert(GUI && "Invalid GUI!"); hairWindow = new wiWindow(GUI, "Hair Particle System Window"); - hairWindow->SetSize(XMFLOAT2(600, 420)); + hairWindow->SetSize(XMFLOAT2(600, 260)); GUI->AddWidget(hairWindow); float x = 160; - float y = 0; - float step = 35; + float y = 10; + float hei = 18; + float step = hei + 2; addButton = new wiButton("Add Hair Particle System"); addButton->SetPos(XMFLOAT2(x, y += step)); - addButton->SetSize(XMFLOAT2(200, 30)); + addButton->SetSize(XMFLOAT2(200, hei)); addButton->OnClick([=](wiEventArgs args) { Scene& scene = wiScene::GetScene(); Entity entity = scene.Entity_CreateHair("editorHair"); @@ -33,7 +34,7 @@ HairParticleWindow::HairParticleWindow(EditorComponent* editor) : GUI(&editor->G hairWindow->AddWidget(addButton); meshComboBox = new wiComboBox("Mesh: "); - meshComboBox->SetSize(XMFLOAT2(300, 25)); + meshComboBox->SetSize(XMFLOAT2(300, hei)); meshComboBox->SetPos(XMFLOAT2(x, y += step)); meshComboBox->SetEnabled(false); meshComboBox->OnSelect([&](wiEventArgs args) { @@ -55,7 +56,7 @@ HairParticleWindow::HairParticleWindow(EditorComponent* editor) : GUI(&editor->G hairWindow->AddWidget(meshComboBox); countSlider = new wiSlider(0, 100000, 1000, 100000, "Strand Count: "); - countSlider->SetSize(XMFLOAT2(360, 30)); + countSlider->SetSize(XMFLOAT2(360, hei)); countSlider->SetPos(XMFLOAT2(x, y += step)); countSlider->OnSlide([&](wiEventArgs args) { auto hair = GetHair(); @@ -69,7 +70,7 @@ HairParticleWindow::HairParticleWindow(EditorComponent* editor) : GUI(&editor->G hairWindow->AddWidget(countSlider); lengthSlider = new wiSlider(0, 4, 1, 100000, "Particle Length: "); - lengthSlider->SetSize(XMFLOAT2(360, 30)); + lengthSlider->SetSize(XMFLOAT2(360, hei)); lengthSlider->SetPos(XMFLOAT2(x, y += step)); lengthSlider->OnSlide([&](wiEventArgs args) { auto hair = GetHair(); @@ -83,7 +84,7 @@ HairParticleWindow::HairParticleWindow(EditorComponent* editor) : GUI(&editor->G hairWindow->AddWidget(lengthSlider); stiffnessSlider = new wiSlider(0, 20, 5, 100000, "Particle Stiffness: "); - stiffnessSlider->SetSize(XMFLOAT2(360, 30)); + stiffnessSlider->SetSize(XMFLOAT2(360, hei)); stiffnessSlider->SetPos(XMFLOAT2(x, y += step)); stiffnessSlider->OnSlide([&](wiEventArgs args) { auto hair = GetHair(); @@ -97,7 +98,7 @@ HairParticleWindow::HairParticleWindow(EditorComponent* editor) : GUI(&editor->G hairWindow->AddWidget(stiffnessSlider); randomnessSlider = new wiSlider(0, 1, 0.2f, 100000, "Particle Randomness: "); - randomnessSlider->SetSize(XMFLOAT2(360, 30)); + randomnessSlider->SetSize(XMFLOAT2(360, hei)); randomnessSlider->SetPos(XMFLOAT2(x, y += step)); randomnessSlider->OnSlide([&](wiEventArgs args) { auto hair = GetHair(); @@ -111,7 +112,7 @@ HairParticleWindow::HairParticleWindow(EditorComponent* editor) : GUI(&editor->G hairWindow->AddWidget(randomnessSlider); segmentcountSlider = new wiSlider(1, 10, 1, 9, "Segment Count: "); - segmentcountSlider->SetSize(XMFLOAT2(360, 30)); + segmentcountSlider->SetSize(XMFLOAT2(360, hei)); segmentcountSlider->SetPos(XMFLOAT2(x, y += step)); segmentcountSlider->OnSlide([&](wiEventArgs args) { auto hair = GetHair(); @@ -125,7 +126,7 @@ HairParticleWindow::HairParticleWindow(EditorComponent* editor) : GUI(&editor->G hairWindow->AddWidget(segmentcountSlider); randomSeedSlider = new wiSlider(1, 12345, 1, 12344, "Random seed: "); - randomSeedSlider->SetSize(XMFLOAT2(360, 30)); + randomSeedSlider->SetSize(XMFLOAT2(360, hei)); randomSeedSlider->SetPos(XMFLOAT2(x, y += step)); randomSeedSlider->OnSlide([&](wiEventArgs args) { auto hair = GetHair(); @@ -139,7 +140,7 @@ HairParticleWindow::HairParticleWindow(EditorComponent* editor) : GUI(&editor->G hairWindow->AddWidget(randomSeedSlider); viewDistanceSlider = new wiSlider(0, 1000, 100, 10000, "View distance: "); - viewDistanceSlider->SetSize(XMFLOAT2(360, 30)); + viewDistanceSlider->SetSize(XMFLOAT2(360, hei)); viewDistanceSlider->SetPos(XMFLOAT2(x, y += step)); viewDistanceSlider->OnSlide([&](wiEventArgs args) { auto hair = GetHair(); @@ -154,7 +155,7 @@ HairParticleWindow::HairParticleWindow(EditorComponent* editor) : GUI(&editor->G framesXInput = new wiTextInputField(""); framesXInput->SetPos(XMFLOAT2(x, y += step)); - framesXInput->SetSize(XMFLOAT2(40, 18)); + framesXInput->SetSize(XMFLOAT2(40, hei)); framesXInput->SetText(""); framesXInput->SetTooltip("How many horizontal frames there are in the spritesheet."); framesXInput->SetDescription("Frames X: "); @@ -169,7 +170,7 @@ HairParticleWindow::HairParticleWindow(EditorComponent* editor) : GUI(&editor->G framesYInput = new wiTextInputField(""); framesYInput->SetPos(XMFLOAT2(x + 250, y)); - framesYInput->SetSize(XMFLOAT2(40, 18)); + framesYInput->SetSize(XMFLOAT2(40, hei)); framesYInput->SetText(""); framesYInput->SetTooltip("How many vertical frames there are in the spritesheet."); framesYInput->SetDescription("Frames Y: "); @@ -186,7 +187,7 @@ HairParticleWindow::HairParticleWindow(EditorComponent* editor) : GUI(&editor->G frameCountInput = new wiTextInputField(""); frameCountInput->SetPos(XMFLOAT2(x, y += step)); - frameCountInput->SetSize(XMFLOAT2(40, 18)); + frameCountInput->SetSize(XMFLOAT2(40, hei)); frameCountInput->SetText(""); frameCountInput->SetTooltip("Enter a value to enable the random sprite sheet frame selection's max frame number."); frameCountInput->SetDescription("Frame Count: "); @@ -201,7 +202,7 @@ HairParticleWindow::HairParticleWindow(EditorComponent* editor) : GUI(&editor->G frameStartInput = new wiTextInputField(""); frameStartInput->SetPos(XMFLOAT2(x + 250, y)); - frameStartInput->SetSize(XMFLOAT2(40, 18)); + frameStartInput->SetSize(XMFLOAT2(40, hei)); frameStartInput->SetText(""); frameStartInput->SetTooltip("Specifies the first frame of the sheet that can be used."); frameStartInput->SetDescription("First Frame: "); diff --git a/Editor/IKWindow.cpp b/Editor/IKWindow.cpp index 91770e793..769fd969b 100644 --- a/Editor/IKWindow.cpp +++ b/Editor/IKWindow.cpp @@ -11,14 +11,14 @@ IKWindow::IKWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) assert(GUI && "Invalid GUI!"); window = new wiWindow(GUI, "Inverse Kinematics (IK) Window"); - window->SetSize(XMFLOAT2(460, 200)); + window->SetSize(XMFLOAT2(400, 150)); GUI->AddWidget(window); - float x = 100; - float y = 0; - float step = 25; + float x = 120; + float y = 10; float siz = 200; - float hei = 20; + float hei = 18; + float step = hei + 2; createButton = new wiButton("Create"); createButton->SetTooltip("Create/Remove IK Component to selected entity"); diff --git a/Editor/LightWindow.cpp b/Editor/LightWindow.cpp index 08a0410be..353f5895c 100644 --- a/Editor/LightWindow.cpp +++ b/Editor/LightWindow.cpp @@ -14,15 +14,16 @@ LightWindow::LightWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) assert(GUI && "Invalid GUI!"); lightWindow = new wiWindow(GUI, "Light Window"); - lightWindow->SetSize(XMFLOAT2(650, 520)); + lightWindow->SetSize(XMFLOAT2(650, 500)); GUI->AddWidget(lightWindow); float x = 450; float y = 0; - float step = 35; + float hei = 18; + float step = hei + 2; energySlider = new wiSlider(0.1f, 64, 0, 100000, "Energy: "); - energySlider->SetSize(XMFLOAT2(100, 30)); + energySlider->SetSize(XMFLOAT2(100, hei)); energySlider->SetPos(XMFLOAT2(x, y += step)); energySlider->OnSlide([&](wiEventArgs args) { LightComponent* light = wiScene::GetScene().lights.GetComponent(entity); @@ -36,7 +37,7 @@ LightWindow::LightWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) lightWindow->AddWidget(energySlider); rangeSlider = new wiSlider(1, 1000, 0, 100000, "Range: "); - rangeSlider->SetSize(XMFLOAT2(100, 30)); + rangeSlider->SetSize(XMFLOAT2(100, hei)); rangeSlider->SetPos(XMFLOAT2(x, y += step)); rangeSlider->OnSlide([&](wiEventArgs args) { LightComponent* light = wiScene::GetScene().lights.GetComponent(entity); @@ -50,7 +51,7 @@ LightWindow::LightWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) lightWindow->AddWidget(rangeSlider); radiusSlider = new wiSlider(0.01f, 10, 0, 100000, "Radius: "); - radiusSlider->SetSize(XMFLOAT2(100, 30)); + radiusSlider->SetSize(XMFLOAT2(100, hei)); radiusSlider->SetPos(XMFLOAT2(x, y += step)); radiusSlider->OnSlide([&](wiEventArgs args) { LightComponent* light = wiScene::GetScene().lights.GetComponent(entity); @@ -64,7 +65,7 @@ LightWindow::LightWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) lightWindow->AddWidget(radiusSlider); widthSlider = new wiSlider(1, 10, 0, 100000, "Width: "); - widthSlider->SetSize(XMFLOAT2(100, 30)); + widthSlider->SetSize(XMFLOAT2(100, hei)); widthSlider->SetPos(XMFLOAT2(x, y += step)); widthSlider->OnSlide([&](wiEventArgs args) { LightComponent* light = wiScene::GetScene().lights.GetComponent(entity); @@ -78,7 +79,7 @@ LightWindow::LightWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) lightWindow->AddWidget(widthSlider); heightSlider = new wiSlider(1, 10, 0, 100000, "Height: "); - heightSlider->SetSize(XMFLOAT2(100, 30)); + heightSlider->SetSize(XMFLOAT2(100, hei)); heightSlider->SetPos(XMFLOAT2(x, y += step)); heightSlider->OnSlide([&](wiEventArgs args) { LightComponent* light = wiScene::GetScene().lights.GetComponent(entity); @@ -92,7 +93,7 @@ LightWindow::LightWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) lightWindow->AddWidget(heightSlider); fovSlider = new wiSlider(0.1f, XM_PI - 0.01f, 0, 100000, "FOV: "); - fovSlider->SetSize(XMFLOAT2(100, 30)); + fovSlider->SetSize(XMFLOAT2(100, hei)); fovSlider->SetPos(XMFLOAT2(x, y += step)); fovSlider->OnSlide([&](wiEventArgs args) { LightComponent* light = wiScene::GetScene().lights.GetComponent(entity); @@ -106,7 +107,7 @@ LightWindow::LightWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) lightWindow->AddWidget(fovSlider); biasSlider = new wiSlider(0.0f, 0.2f, 0, 100000, "ShadowBias: "); - biasSlider->SetSize(XMFLOAT2(100, 30)); + biasSlider->SetSize(XMFLOAT2(100, hei)); biasSlider->SetPos(XMFLOAT2(x, y += step)); biasSlider->OnSlide([&](wiEventArgs args) { LightComponent* light = wiScene::GetScene().lights.GetComponent(entity); @@ -120,6 +121,7 @@ LightWindow::LightWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) lightWindow->AddWidget(biasSlider); shadowCheckBox = new wiCheckBox("Shadow: "); + shadowCheckBox->SetSize(XMFLOAT2(hei, hei)); shadowCheckBox->SetPos(XMFLOAT2(x, y += step)); shadowCheckBox->OnClick([&](wiEventArgs args) { LightComponent* light = wiScene::GetScene().lights.GetComponent(entity); @@ -132,7 +134,8 @@ LightWindow::LightWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) shadowCheckBox->SetTooltip("Set light as shadow caster. Many shadow casters can affect performance!"); lightWindow->AddWidget(shadowCheckBox); - volumetricsCheckBox = new wiCheckBox("Volumetric Scattering: "); + volumetricsCheckBox = new wiCheckBox("Volumetric: "); + volumetricsCheckBox->SetSize(XMFLOAT2(hei, hei)); volumetricsCheckBox->SetPos(XMFLOAT2(x, y += step)); volumetricsCheckBox->OnClick([&](wiEventArgs args) { LightComponent* light = wiScene::GetScene().lights.GetComponent(entity); @@ -142,10 +145,11 @@ LightWindow::LightWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) } }); volumetricsCheckBox->SetEnabled(false); - volumetricsCheckBox->SetTooltip("Compute volumetric light scattering effect. The scattering is modulated by fog settings!"); + volumetricsCheckBox->SetTooltip("Compute volumetric light scattering effect. \nThe fog settings affect scattering (see Weather window). If there is no fog, there is no scattering."); lightWindow->AddWidget(volumetricsCheckBox); haloCheckBox = new wiCheckBox("Visualizer: "); + haloCheckBox->SetSize(XMFLOAT2(hei, hei)); haloCheckBox->SetPos(XMFLOAT2(x, y += step)); haloCheckBox->OnClick([&](wiEventArgs args) { LightComponent* light = wiScene::GetScene().lights.GetComponent(entity); @@ -159,6 +163,7 @@ LightWindow::LightWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) lightWindow->AddWidget(haloCheckBox); staticCheckBox = new wiCheckBox("Static: "); + staticCheckBox->SetSize(XMFLOAT2(hei, hei)); staticCheckBox->SetPos(XMFLOAT2(x, y += step)); staticCheckBox->OnClick([&](wiEventArgs args) { LightComponent* light = wiScene::GetScene().lights.GetComponent(entity); @@ -173,7 +178,7 @@ LightWindow::LightWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) addLightButton = new wiButton("Add Light"); addLightButton->SetPos(XMFLOAT2(x, y += step)); - addLightButton->SetSize(XMFLOAT2(150, 30)); + addLightButton->SetSize(XMFLOAT2(150, hei)); addLightButton->OnClick([=](wiEventArgs args) { Entity entity = wiScene::GetScene().Entity_CreateLight("editorLight", XMFLOAT3(0, 3, 0), XMFLOAT3(1, 1, 1), 2, 60); LightComponent* light = wiScene::GetScene().lights.GetComponent(entity); @@ -207,6 +212,7 @@ LightWindow::LightWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) lightWindow->AddWidget(colorPicker); typeSelectorComboBox = new wiComboBox("Type: "); + typeSelectorComboBox->SetSize(XMFLOAT2(150, hei)); typeSelectorComboBox->SetPos(XMFLOAT2(x, y += step)); typeSelectorComboBox->OnSelect([&](wiEventArgs args) { LightComponent* light = wiScene::GetScene().lights.GetComponent(entity); @@ -232,11 +238,12 @@ LightWindow::LightWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) x = 10; y = 280; - step = 25; + hei = 20; + step = hei + 2; lensflare_Label = new wiLabel("Lens flare textures: "); lensflare_Label->SetPos(XMFLOAT2(x, y += step)); - lensflare_Label->SetSize(XMFLOAT2(140, 20)); + lensflare_Label->SetSize(XMFLOAT2(140, hei)); lightWindow->AddWidget(lensflare_Label); for (size_t i = 0; i < arraysize(lensflare_Button); ++i) @@ -245,7 +252,7 @@ LightWindow::LightWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) lensflare_Button[i]->SetText(""); lensflare_Button[i]->SetTooltip("Load a lensflare texture to this slot"); lensflare_Button[i]->SetPos(XMFLOAT2(x, y += step)); - lensflare_Button[i]->SetSize(XMFLOAT2(260, 20)); + lensflare_Button[i]->SetSize(XMFLOAT2(260, hei)); lensflare_Button[i]->OnClick([=](wiEventArgs args) { LightComponent* light = wiScene::GetScene().lights.GetComponent(entity); if (light == nullptr) diff --git a/Editor/MeshWindow.cpp b/Editor/MeshWindow.cpp index 23e0ae065..efbd5eb6c 100644 --- a/Editor/MeshWindow.cpp +++ b/Editor/MeshWindow.cpp @@ -16,13 +16,13 @@ MeshWindow::MeshWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) meshWindow = new wiWindow(GUI, "Mesh Window"); - meshWindow->SetSize(XMFLOAT2(580, 640)); + meshWindow->SetSize(XMFLOAT2(580, 500)); GUI->AddWidget(meshWindow); float x = 150; float y = 0; - float step = 30; - float hei = 25; + float hei = 18; + float step = hei + 2; meshInfoLabel = new wiLabel("Mesh Info"); meshInfoLabel->SetPos(XMFLOAT2(x - 50, y += step)); @@ -33,6 +33,7 @@ MeshWindow::MeshWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) doubleSidedCheckBox = new wiCheckBox("Double Sided: "); doubleSidedCheckBox->SetTooltip("If enabled, the inside of the mesh will be visible."); + doubleSidedCheckBox->SetSize(XMFLOAT2(hei, hei)); doubleSidedCheckBox->SetPos(XMFLOAT2(x, y += step)); doubleSidedCheckBox->OnClick([&](wiEventArgs args) { MeshComponent* mesh = wiScene::GetScene().meshes.GetComponent(entity); @@ -45,6 +46,7 @@ MeshWindow::MeshWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) softbodyCheckBox = new wiCheckBox("Soft body: "); softbodyCheckBox->SetTooltip("Enable soft body simulation. Tip: Use the Paint Tool to control vertex pinning."); + softbodyCheckBox->SetSize(XMFLOAT2(hei, hei)); softbodyCheckBox->SetPos(XMFLOAT2(x, y += step)); softbodyCheckBox->OnClick([&](wiEventArgs args) { @@ -226,6 +228,7 @@ MeshWindow::MeshWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) terrainCheckBox = new wiCheckBox("Terrain: "); terrainCheckBox->SetTooltip("If enabled, the mesh will use multiple materials and blend between them based on vertex colors."); + terrainCheckBox->SetSize(XMFLOAT2(hei, hei)); terrainCheckBox->SetPos(XMFLOAT2(x, y += step)); terrainCheckBox->OnClick([&](wiEventArgs args) { MeshComponent* mesh = wiScene::GetScene().meshes.GetComponent(entity); @@ -253,7 +256,7 @@ MeshWindow::MeshWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) meshWindow->AddWidget(terrainCheckBox); terrainMat1Combo = new wiComboBox("Terrain Material 1: "); - terrainMat1Combo->SetSize(XMFLOAT2(200, 20)); + terrainMat1Combo->SetSize(XMFLOAT2(200, hei)); terrainMat1Combo->SetPos(XMFLOAT2(x + 180, y)); terrainMat1Combo->SetEnabled(false); terrainMat1Combo->OnSelect([&](wiEventArgs args) { @@ -275,7 +278,7 @@ MeshWindow::MeshWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) meshWindow->AddWidget(terrainMat1Combo); terrainMat2Combo = new wiComboBox("Terrain Material 2: "); - terrainMat2Combo->SetSize(XMFLOAT2(200, 20)); + terrainMat2Combo->SetSize(XMFLOAT2(200, hei)); terrainMat2Combo->SetPos(XMFLOAT2(x + 180, y += step)); terrainMat2Combo->SetEnabled(false); terrainMat2Combo->OnSelect([&](wiEventArgs args) { @@ -297,7 +300,7 @@ MeshWindow::MeshWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) meshWindow->AddWidget(terrainMat2Combo); terrainMat3Combo = new wiComboBox("Terrain Material 3: "); - terrainMat3Combo->SetSize(XMFLOAT2(200, 20)); + terrainMat3Combo->SetSize(XMFLOAT2(200, hei)); terrainMat3Combo->SetPos(XMFLOAT2(x + 180, y += step)); terrainMat3Combo->SetEnabled(false); terrainMat3Combo->OnSelect([&](wiEventArgs args) { @@ -320,7 +323,7 @@ MeshWindow::MeshWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) terrainGenButton = new wiButton("Generate Terrain..."); terrainGenButton->SetTooltip("Generate terrain meshes."); - terrainGenButton->SetSize(XMFLOAT2(200, 20)); + terrainGenButton->SetSize(XMFLOAT2(200, hei)); terrainGenButton->SetPos(XMFLOAT2(x + 180, y += step)); terrainGenButton->OnClick([=](wiEventArgs args) { diff --git a/Editor/ObjectWindow.cpp b/Editor/ObjectWindow.cpp index fc2bef51d..54c0894e5 100644 --- a/Editor/ObjectWindow.cpp +++ b/Editor/ObjectWindow.cpp @@ -251,21 +251,24 @@ ObjectWindow::ObjectWindow(EditorComponent* editor) : editor(editor) assert(GUI && "Invalid GUI!"); objectWindow = new wiWindow(GUI, "Object Window"); - objectWindow->SetSize(XMFLOAT2(600, 520)); + objectWindow->SetSize(XMFLOAT2(350, 610)); GUI->AddWidget(objectWindow); - float x = 450; + float x = 200; float y = 0; + float hei = 18; + float step = hei + 2; nameLabel = new wiLabel("NAMELABEL"); nameLabel->SetText(""); - nameLabel->SetPos(XMFLOAT2(x - 30, y += 30)); - nameLabel->SetSize(XMFLOAT2(150, 20)); + nameLabel->SetPos(XMFLOAT2(x - 30, y += step)); + nameLabel->SetSize(XMFLOAT2(150, hei)); objectWindow->AddWidget(nameLabel); renderableCheckBox = new wiCheckBox("Renderable: "); renderableCheckBox->SetTooltip("Set object to be participating in rendering."); - renderableCheckBox->SetPos(XMFLOAT2(x, y += 30)); + renderableCheckBox->SetSize(XMFLOAT2(hei, hei)); + renderableCheckBox->SetPos(XMFLOAT2(x, y += step)); renderableCheckBox->SetCheck(true); renderableCheckBox->OnClick([&](wiEventArgs args) { ObjectComponent* object = wiScene::GetScene().objects.GetComponent(entity); @@ -278,8 +281,8 @@ ObjectWindow::ObjectWindow(EditorComponent* editor) : editor(editor) ditherSlider = new wiSlider(0, 1, 0, 1000, "Dither: "); ditherSlider->SetTooltip("Adjust dithered transparency of the object. This disables some optimizations so performance can be affected."); - ditherSlider->SetSize(XMFLOAT2(100, 30)); - ditherSlider->SetPos(XMFLOAT2(x, y += 30)); + ditherSlider->SetSize(XMFLOAT2(100, hei)); + ditherSlider->SetPos(XMFLOAT2(x, y += step)); ditherSlider->OnSlide([&](wiEventArgs args) { ObjectComponent* object = wiScene::GetScene().objects.GetComponent(entity); if (object != nullptr) @@ -291,8 +294,8 @@ ObjectWindow::ObjectWindow(EditorComponent* editor) : editor(editor) cascadeMaskSlider = new wiSlider(0, 3, 0, 3, "Cascade Mask: "); cascadeMaskSlider->SetTooltip("How many shadow cascades to skip when rendering this object into shadow maps? (0: skip none, it will be in all cascades, 1: skip first (biggest cascade), ...etc..."); - cascadeMaskSlider->SetSize(XMFLOAT2(100, 30)); - cascadeMaskSlider->SetPos(XMFLOAT2(x, y += 30)); + cascadeMaskSlider->SetSize(XMFLOAT2(100, hei)); + cascadeMaskSlider->SetPos(XMFLOAT2(x, y += step)); cascadeMaskSlider->OnSlide([&](wiEventArgs args) { ObjectComponent* object = wiScene::GetScene().objects.GetComponent(entity); if (object != nullptr) @@ -302,34 +305,20 @@ ObjectWindow::ObjectWindow(EditorComponent* editor) : editor(editor) }); objectWindow->AddWidget(cascadeMaskSlider); - - colorPicker = new wiColorPicker(GUI, "Object Color", false); - colorPicker->SetPos(XMFLOAT2(10, 30)); - colorPicker->SetVisible(true); - colorPicker->SetEnabled(true); - colorPicker->OnColorChanged([&](wiEventArgs args) { - ObjectComponent* object = wiScene::GetScene().objects.GetComponent(entity); - if (object != nullptr) - { - XMFLOAT3 col = args.color.toFloat3(); - object->color = XMFLOAT4(col.x, col.y, col.z, object->color.w); - } - }); - objectWindow->AddWidget(colorPicker); - - y += 60; + y += step; physicsLabel = new wiLabel("PHYSICSLABEL"); physicsLabel->SetText("PHYSICS SETTINGS"); - physicsLabel->SetPos(XMFLOAT2(x - 30, y += 30)); - physicsLabel->SetSize(XMFLOAT2(150, 20)); + physicsLabel->SetPos(XMFLOAT2(x - 30, y += step)); + physicsLabel->SetSize(XMFLOAT2(150, hei)); objectWindow->AddWidget(physicsLabel); rigidBodyCheckBox = new wiCheckBox("Rigid Body Physics: "); rigidBodyCheckBox->SetTooltip("Enable rigid body physics simulation."); - rigidBodyCheckBox->SetPos(XMFLOAT2(x, y += 30)); + rigidBodyCheckBox->SetSize(XMFLOAT2(hei, hei)); + rigidBodyCheckBox->SetPos(XMFLOAT2(x, y += step)); rigidBodyCheckBox->SetCheck(false); rigidBodyCheckBox->OnClick([&](wiEventArgs args) { @@ -359,7 +348,8 @@ ObjectWindow::ObjectWindow(EditorComponent* editor) : editor(editor) kinematicCheckBox = new wiCheckBox("Kinematic: "); kinematicCheckBox->SetTooltip("Toggle kinematic behaviour."); - kinematicCheckBox->SetPos(XMFLOAT2(x, y += 30)); + kinematicCheckBox->SetSize(XMFLOAT2(hei, hei)); + kinematicCheckBox->SetPos(XMFLOAT2(x, y += step)); kinematicCheckBox->SetCheck(false); kinematicCheckBox->OnClick([&](wiEventArgs args) { RigidBodyPhysicsComponent* physicscomponent = wiScene::GetScene().rigidbodies.GetComponent(entity); @@ -372,7 +362,8 @@ ObjectWindow::ObjectWindow(EditorComponent* editor) : editor(editor) disabledeactivationCheckBox = new wiCheckBox("Disable Deactivation: "); disabledeactivationCheckBox->SetTooltip("Toggle kinematic behaviour."); - disabledeactivationCheckBox->SetPos(XMFLOAT2(x, y += 30)); + disabledeactivationCheckBox->SetSize(XMFLOAT2(hei, hei)); + disabledeactivationCheckBox->SetPos(XMFLOAT2(x, y += step)); disabledeactivationCheckBox->SetCheck(false); disabledeactivationCheckBox->OnClick([&](wiEventArgs args) { RigidBodyPhysicsComponent* physicscomponent = wiScene::GetScene().rigidbodies.GetComponent(entity); @@ -384,8 +375,8 @@ ObjectWindow::ObjectWindow(EditorComponent* editor) : editor(editor) objectWindow->AddWidget(disabledeactivationCheckBox); collisionShapeComboBox = new wiComboBox("Collision Shape:"); - collisionShapeComboBox->SetSize(XMFLOAT2(100, 20)); - collisionShapeComboBox->SetPos(XMFLOAT2(x, y += 30)); + collisionShapeComboBox->SetSize(XMFLOAT2(100, hei)); + collisionShapeComboBox->SetPos(XMFLOAT2(x, y += step)); collisionShapeComboBox->AddItem("Box"); collisionShapeComboBox->AddItem("Sphere"); collisionShapeComboBox->AddItem("Capsule"); @@ -424,13 +415,13 @@ ObjectWindow::ObjectWindow(EditorComponent* editor) : editor(editor) objectWindow->AddWidget(collisionShapeComboBox); - y += 30; + y += step; lightmapResolutionSlider = new wiSlider(32, 1024, 128, 1024 - 32, "Lightmap resolution: "); lightmapResolutionSlider->SetTooltip("Set the approximate resolution for this object's lightmap. This will be packed into the larger global lightmap later."); - lightmapResolutionSlider->SetSize(XMFLOAT2(100, 30)); - lightmapResolutionSlider->SetPos(XMFLOAT2(x, y += 30)); + lightmapResolutionSlider->SetSize(XMFLOAT2(100, hei)); + lightmapResolutionSlider->SetPos(XMFLOAT2(x, y += step)); lightmapResolutionSlider->OnSlide([&](wiEventArgs args) { // unfortunately, we must be pow2 with full float lightmap format, otherwise it could be unlimited (but accumulation blending would suffer then) // or at least for me, downloading the lightmap was glitching out when non-pow 2 and RGBA32_FLOAT format @@ -438,8 +429,8 @@ ObjectWindow::ObjectWindow(EditorComponent* editor) : editor(editor) }); objectWindow->AddWidget(lightmapResolutionSlider); - lightmapSourceUVSetComboBox = new wiComboBox("Source UV: "); - lightmapSourceUVSetComboBox->SetPos(XMFLOAT2(x - 130, y += 30)); + lightmapSourceUVSetComboBox = new wiComboBox("UV Set: "); + lightmapSourceUVSetComboBox->SetPos(XMFLOAT2(x - 130, y += step)); lightmapSourceUVSetComboBox->AddItem("Copy UV 0"); lightmapSourceUVSetComboBox->AddItem("Copy UV 1"); lightmapSourceUVSetComboBox->AddItem("Keep Atlas"); @@ -451,7 +442,7 @@ ObjectWindow::ObjectWindow(EditorComponent* editor) : editor(editor) generateLightmapButton = new wiButton("Generate Lightmap"); generateLightmapButton->SetTooltip("Render the lightmap for only this object. It will automatically combined with the global lightmap."); generateLightmapButton->SetPos(XMFLOAT2(x, y)); - generateLightmapButton->SetSize(XMFLOAT2(140,30)); + generateLightmapButton->SetSize(XMFLOAT2(140, hei)); generateLightmapButton->OnClick([&](wiEventArgs args) { Scene& scene = wiScene::GetScene(); @@ -531,8 +522,8 @@ ObjectWindow::ObjectWindow(EditorComponent* editor) : editor(editor) stopLightmapGenButton = new wiButton("Stop Lightmap Gen"); stopLightmapGenButton->SetTooltip("Stop the lightmap rendering and save the lightmap."); - stopLightmapGenButton->SetPos(XMFLOAT2(x, y += 30)); - stopLightmapGenButton->SetSize(XMFLOAT2(140, 30)); + stopLightmapGenButton->SetPos(XMFLOAT2(x, y += step)); + stopLightmapGenButton->SetSize(XMFLOAT2(140, hei)); stopLightmapGenButton->OnClick([&](wiEventArgs args) { Scene& scene = wiScene::GetScene(); @@ -552,8 +543,8 @@ ObjectWindow::ObjectWindow(EditorComponent* editor) : editor(editor) clearLightmapButton = new wiButton("Clear Lightmap"); clearLightmapButton->SetTooltip("Clear the lightmap from this object."); - clearLightmapButton->SetPos(XMFLOAT2(x, y += 30)); - clearLightmapButton->SetSize(XMFLOAT2(140, 30)); + clearLightmapButton->SetPos(XMFLOAT2(x, y += step)); + clearLightmapButton->SetSize(XMFLOAT2(140, hei)); clearLightmapButton->OnClick([&](wiEventArgs args) { Scene& scene = wiScene::GetScene(); @@ -570,6 +561,21 @@ ObjectWindow::ObjectWindow(EditorComponent* editor) : editor(editor) }); objectWindow->AddWidget(clearLightmapButton); + y += step; + + colorPicker = new wiColorPicker(GUI, "Object Color", false); + colorPicker->SetPos(XMFLOAT2(20, y += step)); + colorPicker->SetVisible(true); + colorPicker->SetEnabled(true); + colorPicker->OnColorChanged([&](wiEventArgs args) { + ObjectComponent* object = wiScene::GetScene().objects.GetComponent(entity); + if (object != nullptr) + { + XMFLOAT3 col = args.color.toFloat3(); + object->color = XMFLOAT4(col.x, col.y, col.z, object->color.w); + } + }); + objectWindow->AddWidget(colorPicker); objectWindow->Translate(XMFLOAT3((float)wiRenderer::GetDevice()->GetScreenWidth() - 720, 120, 0)); diff --git a/Editor/PaintToolWindow.cpp b/Editor/PaintToolWindow.cpp index 51292a038..992950ef9 100644 --- a/Editor/PaintToolWindow.cpp +++ b/Editor/PaintToolWindow.cpp @@ -12,17 +12,18 @@ using namespace wiGraphics; PaintToolWindow::PaintToolWindow(EditorComponent* editor) : editor(editor) { window = new wiWindow(&editor->GetGUI(), "Paint Tool Window"); - window->SetSize(XMFLOAT2(400, 660)); + window->SetSize(XMFLOAT2(400, 600)); editor->GetGUI().AddWidget(window); float x = 100; float y = 5; - float step = 30; + float hei = 20; + float step = hei + 4; modeComboBox = new wiComboBox("Mode: "); modeComboBox->SetTooltip("Choose paint tool mode"); modeComboBox->SetPos(XMFLOAT2(x, y += step)); - modeComboBox->SetSize(XMFLOAT2(200, 28)); + modeComboBox->SetSize(XMFLOAT2(200, hei)); modeComboBox->AddItem("Disabled"); modeComboBox->AddItem("Texture"); modeComboBox->AddItem("Vertexcolor"); @@ -90,35 +91,37 @@ PaintToolWindow::PaintToolWindow(EditorComponent* editor) : editor(editor) radiusSlider = new wiSlider(1.0f, 500.0f, 50, 10000, "Brush Radius: "); radiusSlider->SetTooltip("Set the brush radius in pixel units"); - radiusSlider->SetSize(XMFLOAT2(200, 20)); + radiusSlider->SetSize(XMFLOAT2(200, hei)); radiusSlider->SetPos(XMFLOAT2(x, y += step)); window->AddWidget(radiusSlider); amountSlider = new wiSlider(0, 1, 1, 10000, "Brush Amount: "); amountSlider->SetTooltip("Set the brush amount. 0 = minimum affection, 1 = maximum affection"); - amountSlider->SetSize(XMFLOAT2(200, 20)); + amountSlider->SetSize(XMFLOAT2(200, hei)); amountSlider->SetPos(XMFLOAT2(x, y += step)); window->AddWidget(amountSlider); falloffSlider = new wiSlider(0, 16, 0, 10000, "Brush Falloff: "); falloffSlider->SetTooltip("Set the brush power. 0 = no falloff, 1 = linear falloff, more = falloff power"); - falloffSlider->SetSize(XMFLOAT2(200, 20)); + falloffSlider->SetSize(XMFLOAT2(200, hei)); falloffSlider->SetPos(XMFLOAT2(x, y += step)); window->AddWidget(falloffSlider); spacingSlider = new wiSlider(0, 500, 1, 500, "Brush Spacing: "); spacingSlider->SetTooltip("Brush spacing means how much brush movement (in pixels) starts a new stroke. 0 = new stroke every frame, 100 = every 100 pixel movement since last stroke will start a new stroke."); - spacingSlider->SetSize(XMFLOAT2(200, 20)); + spacingSlider->SetSize(XMFLOAT2(200, hei)); spacingSlider->SetPos(XMFLOAT2(x, y += step)); window->AddWidget(spacingSlider); backfaceCheckBox = new wiCheckBox("Backfaces: "); backfaceCheckBox->SetTooltip("Set whether to paint on backfaces of geometry or not"); + backfaceCheckBox->SetSize(XMFLOAT2(hei, hei)); backfaceCheckBox->SetPos(XMFLOAT2(x, y += step)); window->AddWidget(backfaceCheckBox); wireCheckBox = new wiCheckBox("Wireframe: "); wireCheckBox->SetTooltip("Set whether to draw wireframe on top of geometry or not"); + wireCheckBox->SetSize(XMFLOAT2(hei, hei)); wireCheckBox->SetPos(XMFLOAT2(x + 100, y)); wireCheckBox->SetCheck(true); window->AddWidget(wireCheckBox); @@ -126,7 +129,7 @@ PaintToolWindow::PaintToolWindow(EditorComponent* editor) : editor(editor) textureSlotComboBox = new wiComboBox("Texture Slot: "); textureSlotComboBox->SetTooltip("Choose texture slot of the selected material to paint (texture paint mode only)"); textureSlotComboBox->SetPos(XMFLOAT2(x, y += step)); - textureSlotComboBox->SetSize(XMFLOAT2(200, 28)); + textureSlotComboBox->SetSize(XMFLOAT2(200, hei)); textureSlotComboBox->AddItem("BaseColor (RGBA)"); textureSlotComboBox->AddItem("Normal (RGB)"); textureSlotComboBox->AddItem("SurfaceMap (RGBA)"); @@ -139,7 +142,7 @@ PaintToolWindow::PaintToolWindow(EditorComponent* editor) : editor(editor) saveTextureButton = new wiButton("Save Texture"); saveTextureButton->SetTooltip("Save edited texture. This will append _0 postfix to texture name and save as new PNG texture."); - saveTextureButton->SetSize(XMFLOAT2(200, 28)); + saveTextureButton->SetSize(XMFLOAT2(200, hei)); saveTextureButton->SetPos(XMFLOAT2(x, y += step)); saveTextureButton->SetEnabled(false); saveTextureButton->OnClick([this] (wiEventArgs args) { diff --git a/Editor/PostprocessWindow.cpp b/Editor/PostprocessWindow.cpp index e283688f1..45d8316f4 100644 --- a/Editor/PostprocessWindow.cpp +++ b/Editor/PostprocessWindow.cpp @@ -13,17 +13,18 @@ PostprocessWindow::PostprocessWindow(EditorComponent* editor) : GUI(&editor->Get assert(GUI && "Invalid GUI!"); ppWindow = new wiWindow(GUI, "PostProcess Window"); - ppWindow->SetSize(XMFLOAT2(400, 620)); + ppWindow->SetSize(XMFLOAT2(420, 500)); GUI->AddWidget(ppWindow); float x = 150; - float y = 5; - float step = 25; + float y = 10; + float hei = 18; + float step = hei + 2; exposureSlider = new wiSlider(0.0f, 3.0f, 1, 10000, "Exposure: "); exposureSlider->SetTooltip("Set the tonemap exposure value"); exposureSlider->SetScriptTip("RenderPath3D::SetExposure(float value)"); - exposureSlider->SetSize(XMFLOAT2(100, 20)); + exposureSlider->SetSize(XMFLOAT2(100, hei)); exposureSlider->SetPos(XMFLOAT2(x, y += step)); exposureSlider->SetValue(editor->renderPath->getExposure()); exposureSlider->OnSlide([=](wiEventArgs args) { @@ -34,6 +35,7 @@ PostprocessWindow::PostprocessWindow(EditorComponent* editor) : GUI(&editor->Get lensFlareCheckBox = new wiCheckBox("LensFlare: "); lensFlareCheckBox->SetTooltip("Toggle visibility of light source flares. Additional setup needed per light for a lensflare to be visible."); lensFlareCheckBox->SetScriptTip("RenderPath3D::SetLensFlareEnabled(bool value)"); + lensFlareCheckBox->SetSize(XMFLOAT2(hei, hei)); lensFlareCheckBox->SetPos(XMFLOAT2(x, y += step)); lensFlareCheckBox->SetCheck(editor->renderPath->getLensFlareEnabled()); lensFlareCheckBox->OnClick([=](wiEventArgs args) { @@ -44,6 +46,7 @@ PostprocessWindow::PostprocessWindow(EditorComponent* editor) : GUI(&editor->Get lightShaftsCheckBox = new wiCheckBox("LightShafts: "); lightShaftsCheckBox->SetTooltip("Enable light shaft for directional light sources."); lightShaftsCheckBox->SetScriptTip("RenderPath3D::SetLightShaftsEnabled(bool value)"); + lightShaftsCheckBox->SetSize(XMFLOAT2(hei, hei)); lightShaftsCheckBox->SetPos(XMFLOAT2(x, y += step)); lightShaftsCheckBox->SetCheck(editor->renderPath->getLightShaftsEnabled()); lightShaftsCheckBox->OnClick([=](wiEventArgs args) { @@ -53,6 +56,7 @@ PostprocessWindow::PostprocessWindow(EditorComponent* editor) : GUI(&editor->Get volumetricCloudsCheckBox = new wiCheckBox("Volumetric clouds: "); volumetricCloudsCheckBox->SetTooltip("Enable volumetric cloud rendering."); + volumetricCloudsCheckBox->SetSize(XMFLOAT2(hei, hei)); volumetricCloudsCheckBox->SetPos(XMFLOAT2(x, y += step)); volumetricCloudsCheckBox->SetCheck(editor->renderPath->getVolumetricCloudsEnabled()); volumetricCloudsCheckBox->OnClick([=](wiEventArgs args) { @@ -63,6 +67,7 @@ PostprocessWindow::PostprocessWindow(EditorComponent* editor) : GUI(&editor->Get aoComboBox = new wiComboBox("AO: "); aoComboBox->SetTooltip("Choose Ambient Occlusion type. RTAO is only available if hardware supports ray tracing"); aoComboBox->SetScriptTip("RenderPath3D::SetAO(int value)"); + aoComboBox->SetSize(XMFLOAT2(150, hei)); aoComboBox->SetPos(XMFLOAT2(x, y += step)); aoComboBox->AddItem("Disabled"); aoComboBox->AddItem("SSAO"); @@ -103,7 +108,7 @@ PostprocessWindow::PostprocessWindow(EditorComponent* editor) : GUI(&editor->Get aoPowerSlider = new wiSlider(0.25f, 8.0f, 2, 1000, "Power: "); aoPowerSlider->SetTooltip("Set SSAO Power. Higher values produce darker, more pronounced effect"); - aoPowerSlider->SetSize(XMFLOAT2(100, 20)); + aoPowerSlider->SetSize(XMFLOAT2(100, hei)); aoPowerSlider->SetPos(XMFLOAT2(x + 100, y += step)); aoPowerSlider->SetValue((float)editor->renderPath->getAOPower()); aoPowerSlider->OnSlide([=](wiEventArgs args) { @@ -113,7 +118,7 @@ PostprocessWindow::PostprocessWindow(EditorComponent* editor) : GUI(&editor->Get aoRangeSlider = new wiSlider(1.0f, 100.0f, 1, 1000, "Range: "); aoRangeSlider->SetTooltip("Set AO ray length. Only for SSAO and RTAO"); - aoRangeSlider->SetSize(XMFLOAT2(100, 20)); + aoRangeSlider->SetSize(XMFLOAT2(100, hei)); aoRangeSlider->SetPos(XMFLOAT2(x + 100, y += step)); aoRangeSlider->SetValue((float)editor->renderPath->getAOPower()); aoRangeSlider->OnSlide([=](wiEventArgs args) { @@ -123,7 +128,7 @@ PostprocessWindow::PostprocessWindow(EditorComponent* editor) : GUI(&editor->Get aoSampleCountSlider = new wiSlider(1, 16, 9, 15, "Sample Count: "); aoSampleCountSlider->SetTooltip("Set AO ray count. Only for SSAO and RTAO"); - aoSampleCountSlider->SetSize(XMFLOAT2(100, 20)); + aoSampleCountSlider->SetSize(XMFLOAT2(100, hei)); aoSampleCountSlider->SetPos(XMFLOAT2(x + 100, y += step)); aoSampleCountSlider->SetValue((float)editor->renderPath->getAOPower()); aoSampleCountSlider->OnSlide([=](wiEventArgs args) { @@ -134,6 +139,7 @@ PostprocessWindow::PostprocessWindow(EditorComponent* editor) : GUI(&editor->Get ssrCheckBox = new wiCheckBox("SSR: "); ssrCheckBox->SetTooltip("Enable Screen Space Reflections."); ssrCheckBox->SetScriptTip("RenderPath3D::SetSSREnabled(bool value)"); + ssrCheckBox->SetSize(XMFLOAT2(hei, hei)); ssrCheckBox->SetPos(XMFLOAT2(x, y += step)); ssrCheckBox->SetCheck(editor->renderPath->getSSREnabled()); ssrCheckBox->OnClick([=](wiEventArgs args) { @@ -144,6 +150,7 @@ PostprocessWindow::PostprocessWindow(EditorComponent* editor) : GUI(&editor->Get ssrCheckBox = new wiCheckBox("Ray Traced Reflections: "); ssrCheckBox->SetTooltip("Enable Ray Traced Reflections. Only if GPU supports raytracing."); ssrCheckBox->SetScriptTip("RenderPath3D::SetRaytracedReflectionsEnabled(bool value)"); + ssrCheckBox->SetSize(XMFLOAT2(hei, hei)); ssrCheckBox->SetPos(XMFLOAT2(x + 200, y)); ssrCheckBox->SetCheck(editor->renderPath->getRaytracedReflectionEnabled()); ssrCheckBox->OnClick([=](wiEventArgs args) { @@ -155,6 +162,7 @@ PostprocessWindow::PostprocessWindow(EditorComponent* editor) : GUI(&editor->Get sssCheckBox = new wiCheckBox("SSS: "); sssCheckBox->SetTooltip("Enable Subsurface Scattering. (Deferred only for now)"); sssCheckBox->SetScriptTip("RenderPath3D::SetSSSEnabled(bool value)"); + sssCheckBox->SetSize(XMFLOAT2(hei, hei)); sssCheckBox->SetPos(XMFLOAT2(x, y += step)); sssCheckBox->SetCheck(editor->renderPath->getSSSEnabled()); sssCheckBox->OnClick([=](wiEventArgs args) { @@ -164,6 +172,7 @@ PostprocessWindow::PostprocessWindow(EditorComponent* editor) : GUI(&editor->Get eyeAdaptionCheckBox = new wiCheckBox("EyeAdaption: "); eyeAdaptionCheckBox->SetTooltip("Enable eye adaption for the overall screen luminance"); + eyeAdaptionCheckBox->SetSize(XMFLOAT2(hei, hei)); eyeAdaptionCheckBox->SetPos(XMFLOAT2(x, y += step)); eyeAdaptionCheckBox->SetCheck(editor->renderPath->getEyeAdaptionEnabled()); eyeAdaptionCheckBox->OnClick([=](wiEventArgs args) { @@ -174,6 +183,7 @@ PostprocessWindow::PostprocessWindow(EditorComponent* editor) : GUI(&editor->Get motionBlurCheckBox = new wiCheckBox("MotionBlur: "); motionBlurCheckBox->SetTooltip("Enable motion blur for camera movement and animated meshes."); motionBlurCheckBox->SetScriptTip("RenderPath3D::SetMotionBlurEnabled(bool value)"); + motionBlurCheckBox->SetSize(XMFLOAT2(hei, hei)); motionBlurCheckBox->SetPos(XMFLOAT2(x, y += step)); motionBlurCheckBox->SetCheck(editor->renderPath->getMotionBlurEnabled()); motionBlurCheckBox->OnClick([=](wiEventArgs args) { @@ -184,7 +194,7 @@ PostprocessWindow::PostprocessWindow(EditorComponent* editor) : GUI(&editor->Get motionBlurStrengthSlider = new wiSlider(0.1f, 400, 100, 10000, "Strength: "); motionBlurStrengthSlider->SetTooltip("Set the camera shutter speed for motion blur (higher value means stronger blur)."); motionBlurStrengthSlider->SetScriptTip("RenderPath3D::SetMotionBlurStrength(float value)"); - motionBlurStrengthSlider->SetSize(XMFLOAT2(100, 20)); + motionBlurStrengthSlider->SetSize(XMFLOAT2(100, hei)); motionBlurStrengthSlider->SetPos(XMFLOAT2(x + 100, y)); motionBlurStrengthSlider->SetValue(editor->renderPath->getMotionBlurStrength()); motionBlurStrengthSlider->OnSlide([=](wiEventArgs args) { @@ -195,6 +205,7 @@ PostprocessWindow::PostprocessWindow(EditorComponent* editor) : GUI(&editor->Get depthOfFieldCheckBox = new wiCheckBox("DepthOfField: "); depthOfFieldCheckBox->SetTooltip("Enable Depth of field effect. Additional focus and strength setup required."); depthOfFieldCheckBox->SetScriptTip("RenderPath3D::SetDepthOfFieldEnabled(bool value)"); + depthOfFieldCheckBox->SetSize(XMFLOAT2(hei, hei)); depthOfFieldCheckBox->SetPos(XMFLOAT2(x, y += step)); depthOfFieldCheckBox->SetCheck(editor->renderPath->getDepthOfFieldEnabled()); depthOfFieldCheckBox->OnClick([=](wiEventArgs args) { @@ -205,7 +216,7 @@ PostprocessWindow::PostprocessWindow(EditorComponent* editor) : GUI(&editor->Get depthOfFieldFocusSlider = new wiSlider(1.0f, 100, 10, 10000, "Focus: "); depthOfFieldFocusSlider->SetTooltip("Set the focus distance from the camera. The picture will be sharper near the focus, and blurrier further from it."); depthOfFieldFocusSlider->SetScriptTip("RenderPath3D::SetDepthOfFieldFocus(float value)"); - depthOfFieldFocusSlider->SetSize(XMFLOAT2(100, 20)); + depthOfFieldFocusSlider->SetSize(XMFLOAT2(100, hei)); depthOfFieldFocusSlider->SetPos(XMFLOAT2(x + 100, y)); depthOfFieldFocusSlider->SetValue(editor->renderPath->getDepthOfFieldFocus()); depthOfFieldFocusSlider->OnSlide([=](wiEventArgs args) { @@ -216,7 +227,7 @@ PostprocessWindow::PostprocessWindow(EditorComponent* editor) : GUI(&editor->Get depthOfFieldScaleSlider = new wiSlider(1.0f, 20, 100, 1000, "Scale: "); depthOfFieldScaleSlider->SetTooltip("Set depth of field scale/falloff."); depthOfFieldScaleSlider->SetScriptTip("RenderPath3D::SetDepthOfFieldStrength(float value)"); - depthOfFieldScaleSlider->SetSize(XMFLOAT2(100, 20)); + depthOfFieldScaleSlider->SetSize(XMFLOAT2(100, hei)); depthOfFieldScaleSlider->SetPos(XMFLOAT2(x + 100, y += step)); depthOfFieldScaleSlider->SetValue(editor->renderPath->getDepthOfFieldStrength()); depthOfFieldScaleSlider->OnSlide([=](wiEventArgs args) { @@ -227,7 +238,7 @@ PostprocessWindow::PostprocessWindow(EditorComponent* editor) : GUI(&editor->Get depthOfFieldAspectSlider = new wiSlider(0.01f, 2, 1, 1000, "Aspect: "); depthOfFieldAspectSlider->SetTooltip("Set depth of field bokeh aspect ratio (width/height)."); depthOfFieldAspectSlider->SetScriptTip("RenderPath3D::SetDepthOfFieldAspect(float value)"); - depthOfFieldAspectSlider->SetSize(XMFLOAT2(100, 20)); + depthOfFieldAspectSlider->SetSize(XMFLOAT2(100, hei)); depthOfFieldAspectSlider->SetPos(XMFLOAT2(x + 100, y += step)); depthOfFieldAspectSlider->SetValue(editor->renderPath->getDepthOfFieldAspect()); depthOfFieldAspectSlider->OnSlide([=](wiEventArgs args) { @@ -238,6 +249,7 @@ PostprocessWindow::PostprocessWindow(EditorComponent* editor) : GUI(&editor->Get bloomCheckBox = new wiCheckBox("Bloom: "); bloomCheckBox->SetTooltip("Enable bloom. The effect adds color bleeding to the brightest parts of the scene."); bloomCheckBox->SetScriptTip("RenderPath3D::SetBloomEnabled(bool value)"); + bloomCheckBox->SetSize(XMFLOAT2(hei, hei)); bloomCheckBox->SetPos(XMFLOAT2(x, y += step)); bloomCheckBox->SetCheck(editor->renderPath->getBloomEnabled()); bloomCheckBox->OnClick([=](wiEventArgs args) { @@ -247,7 +259,7 @@ PostprocessWindow::PostprocessWindow(EditorComponent* editor) : GUI(&editor->Get bloomStrengthSlider = new wiSlider(0.0f, 10, 1, 1000, "Threshold: "); bloomStrengthSlider->SetTooltip("Set bloom threshold. The values below this will not glow on the screen."); - bloomStrengthSlider->SetSize(XMFLOAT2(100, 20)); + bloomStrengthSlider->SetSize(XMFLOAT2(100, hei)); bloomStrengthSlider->SetPos(XMFLOAT2(x + 100, y)); bloomStrengthSlider->SetValue(editor->renderPath->getBloomThreshold()); bloomStrengthSlider->OnSlide([=](wiEventArgs args) { @@ -258,6 +270,7 @@ PostprocessWindow::PostprocessWindow(EditorComponent* editor) : GUI(&editor->Get fxaaCheckBox = new wiCheckBox("FXAA: "); fxaaCheckBox->SetTooltip("Fast Approximate Anti Aliasing. A fast antialiasing method, but can be a bit too blurry."); fxaaCheckBox->SetScriptTip("RenderPath3D::SetFXAAEnabled(bool value)"); + fxaaCheckBox->SetSize(XMFLOAT2(hei, hei)); fxaaCheckBox->SetPos(XMFLOAT2(x, y += step)); fxaaCheckBox->SetCheck(editor->renderPath->getFXAAEnabled()); fxaaCheckBox->OnClick([=](wiEventArgs args) { @@ -268,6 +281,7 @@ PostprocessWindow::PostprocessWindow(EditorComponent* editor) : GUI(&editor->Get colorGradingCheckBox = new wiCheckBox("Color Grading: "); colorGradingCheckBox->SetTooltip("Enable color grading of the final render. An additional lookup texture must be set for it to take effect."); colorGradingCheckBox->SetScriptTip("RenderPath3D::SetColorGradingEnabled(bool value)"); + colorGradingCheckBox->SetSize(XMFLOAT2(hei, hei)); colorGradingCheckBox->SetPos(XMFLOAT2(x, y += step)); colorGradingCheckBox->SetCheck(editor->renderPath->getColorGradingEnabled()); colorGradingCheckBox->OnClick([=](wiEventArgs args) { @@ -278,7 +292,7 @@ PostprocessWindow::PostprocessWindow(EditorComponent* editor) : GUI(&editor->Get colorGradingButton = new wiButton("Load Color Grading LUT..."); colorGradingButton->SetTooltip("Load a color grading lookup texture..."); colorGradingButton->SetPos(XMFLOAT2(x + 35, y)); - colorGradingButton->SetSize(XMFLOAT2(200, 18)); + colorGradingButton->SetSize(XMFLOAT2(200, hei)); colorGradingButton->OnClick([=](wiEventArgs args) { auto x = editor->renderPath->getColorGradingTexture(); @@ -312,6 +326,7 @@ PostprocessWindow::PostprocessWindow(EditorComponent* editor) : GUI(&editor->Get outlineCheckBox = new wiCheckBox("Dithering: "); outlineCheckBox->SetTooltip("Toggle the full screen dithering effect. This helps to reduce color banding."); + outlineCheckBox->SetSize(XMFLOAT2(hei, hei)); outlineCheckBox->SetPos(XMFLOAT2(x, y += step)); outlineCheckBox->SetCheck(editor->renderPath->getDitherEnabled()); outlineCheckBox->OnClick([=](wiEventArgs args) { @@ -322,6 +337,7 @@ PostprocessWindow::PostprocessWindow(EditorComponent* editor) : GUI(&editor->Get sharpenFilterCheckBox = new wiCheckBox("Sharpen Filter: "); sharpenFilterCheckBox->SetTooltip("Toggle sharpening post process of the final image."); sharpenFilterCheckBox->SetScriptTip("RenderPath3D::SetSharpenFilterEnabled(bool value)"); + sharpenFilterCheckBox->SetSize(XMFLOAT2(hei, hei)); sharpenFilterCheckBox->SetPos(XMFLOAT2(x, y += step)); sharpenFilterCheckBox->SetCheck(editor->renderPath->getSharpenFilterEnabled()); sharpenFilterCheckBox->OnClick([=](wiEventArgs args) { @@ -332,7 +348,7 @@ PostprocessWindow::PostprocessWindow(EditorComponent* editor) : GUI(&editor->Get sharpenFilterAmountSlider = new wiSlider(0, 4, 1, 1000, "Amount: "); sharpenFilterAmountSlider->SetTooltip("Set sharpness filter strength."); sharpenFilterAmountSlider->SetScriptTip("RenderPath3D::SetSharpenFilterAmount(float value)"); - sharpenFilterAmountSlider->SetSize(XMFLOAT2(100, 20)); + sharpenFilterAmountSlider->SetSize(XMFLOAT2(100, hei)); sharpenFilterAmountSlider->SetPos(XMFLOAT2(x + 100, y)); sharpenFilterAmountSlider->SetValue(editor->renderPath->getSharpenFilterAmount()); sharpenFilterAmountSlider->OnSlide([=](wiEventArgs args) { @@ -342,6 +358,7 @@ PostprocessWindow::PostprocessWindow(EditorComponent* editor) : GUI(&editor->Get outlineCheckBox = new wiCheckBox("Cartoon Outline: "); outlineCheckBox->SetTooltip("Toggle the full screen cartoon outline effect."); + outlineCheckBox->SetSize(XMFLOAT2(hei, hei)); outlineCheckBox->SetPos(XMFLOAT2(x, y += step)); outlineCheckBox->SetCheck(editor->renderPath->getOutlineEnabled()); outlineCheckBox->OnClick([=](wiEventArgs args) { @@ -351,7 +368,7 @@ PostprocessWindow::PostprocessWindow(EditorComponent* editor) : GUI(&editor->Get outlineThresholdSlider = new wiSlider(0, 1, 0.1f, 1000, "Threshold: "); outlineThresholdSlider->SetTooltip("Outline edge detection threshold. Increase if not enough otlines are detected, decrease if too many outlines are detected."); - outlineThresholdSlider->SetSize(XMFLOAT2(100, 20)); + outlineThresholdSlider->SetSize(XMFLOAT2(100, hei)); outlineThresholdSlider->SetPos(XMFLOAT2(x + 100, y)); outlineThresholdSlider->SetValue(editor->renderPath->getOutlineThreshold()); outlineThresholdSlider->OnSlide([=](wiEventArgs args) { @@ -361,7 +378,7 @@ PostprocessWindow::PostprocessWindow(EditorComponent* editor) : GUI(&editor->Get outlineThicknessSlider = new wiSlider(0, 4, 1, 1000, "Thickness: "); outlineThicknessSlider->SetTooltip("Set outline thickness."); - outlineThicknessSlider->SetSize(XMFLOAT2(100, 20)); + outlineThicknessSlider->SetSize(XMFLOAT2(100, hei)); outlineThicknessSlider->SetPos(XMFLOAT2(x + 100, y += step)); outlineThicknessSlider->SetValue(editor->renderPath->getOutlineThickness()); outlineThicknessSlider->OnSlide([=](wiEventArgs args) { @@ -371,6 +388,7 @@ PostprocessWindow::PostprocessWindow(EditorComponent* editor) : GUI(&editor->Get chromaticaberrationCheckBox = new wiCheckBox("Chromatic Aberration: "); chromaticaberrationCheckBox->SetTooltip("Toggle the full screen chromatic aberration effect. This simulates lens distortion at screen edges."); + chromaticaberrationCheckBox->SetSize(XMFLOAT2(hei, hei)); chromaticaberrationCheckBox->SetPos(XMFLOAT2(x, y += step)); chromaticaberrationCheckBox->SetCheck(editor->renderPath->getOutlineEnabled()); chromaticaberrationCheckBox->OnClick([=](wiEventArgs args) { @@ -380,7 +398,7 @@ PostprocessWindow::PostprocessWindow(EditorComponent* editor) : GUI(&editor->Get chromaticaberrationSlider = new wiSlider(0, 4, 1.0f, 1000, "Amount: "); chromaticaberrationSlider->SetTooltip("The lens distortion amount."); - chromaticaberrationSlider->SetSize(XMFLOAT2(100, 20)); + chromaticaberrationSlider->SetSize(XMFLOAT2(100, hei)); chromaticaberrationSlider->SetPos(XMFLOAT2(x + 100, y)); chromaticaberrationSlider->SetValue(editor->renderPath->getChromaticAberrationAmount()); chromaticaberrationSlider->OnSlide([=](wiEventArgs args) { diff --git a/Editor/RendererWindow.cpp b/Editor/RendererWindow.cpp index a1da24fd5..7aefcc4a4 100644 --- a/Editor/RendererWindow.cpp +++ b/Editor/RendererWindow.cpp @@ -13,10 +13,10 @@ RendererWindow::RendererWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) wiRenderer::SetToDrawDebugCameras(true); rendererWindow = new wiWindow(GUI, "Renderer Window"); - rendererWindow->SetSize(XMFLOAT2(580, 600)); + rendererWindow->SetSize(XMFLOAT2(580, 540)); GUI->AddWidget(rendererWindow); - float x = 220, y = 5, step = 22, itemheight = 20; + float x = 220, y = 5, step = 20, itemheight = 18; vsyncCheckBox = new wiCheckBox("VSync: "); vsyncCheckBox->SetTooltip("Toggle vertical sync"); diff --git a/Editor/SoundWindow.cpp b/Editor/SoundWindow.cpp index 7d2981f37..3cbc36d9f 100644 --- a/Editor/SoundWindow.cpp +++ b/Editor/SoundWindow.cpp @@ -15,16 +15,17 @@ SoundWindow::SoundWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) assert(GUI && "Invalid GUI!"); soundWindow = new wiWindow(GUI, "Sound Window"); - soundWindow->SetSize(XMFLOAT2(440, 340)); + soundWindow->SetSize(XMFLOAT2(440, 200)); GUI->AddWidget(soundWindow); float x = 20; - float y = 0; - float step = 35; + float y = 10; + float hei = 18; + float step = hei + 2; reverbComboBox = new wiComboBox("Reverb: "); reverbComboBox->SetPos(XMFLOAT2(x + 80, y += step)); - reverbComboBox->SetSize(XMFLOAT2(180, 25)); + reverbComboBox->SetSize(XMFLOAT2(180, hei)); reverbComboBox->OnSelect([&](wiEventArgs args) { wiAudio::SetReverb((wiAudio::REVERB_PRESET)args.iValue); }); @@ -66,7 +67,7 @@ SoundWindow::SoundWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) addButton = new wiButton("Add Sound"); addButton->SetTooltip("Add a sound file to the scene."); addButton->SetPos(XMFLOAT2(x, y += step)); - addButton->SetSize(XMFLOAT2(80, 30)); + addButton->SetSize(XMFLOAT2(80, hei)); addButton->OnClick([=](wiEventArgs args) { wiHelper::FileDialogParams params; params.type = wiHelper::FileDialogParams::OPEN; @@ -85,13 +86,13 @@ SoundWindow::SoundWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) filenameLabel = new wiLabel("Filename"); filenameLabel->SetPos(XMFLOAT2(x, y += step)); - filenameLabel->SetSize(XMFLOAT2(400, 20)); + filenameLabel->SetSize(XMFLOAT2(400, hei)); soundWindow->AddWidget(filenameLabel); nameField = new wiTextInputField("SoundName"); nameField->SetTooltip("Enter a sound name to identify this entity..."); nameField->SetPos(XMFLOAT2(x, y += step)); - nameField->SetSize(XMFLOAT2(300, 20)); + nameField->SetSize(XMFLOAT2(300, hei)); nameField->OnInputAccepted([&](wiEventArgs args) { NameComponent* name = wiScene::GetScene().names.GetComponent(entity); if (name == nullptr) @@ -106,7 +107,7 @@ SoundWindow::SoundWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) playstopButton = new wiButton("Play"); playstopButton->SetTooltip("Play/Stop selected sound instance."); playstopButton->SetPos(XMFLOAT2(x, y += step)); - playstopButton->SetSize(XMFLOAT2(80, 30)); + playstopButton->SetSize(XMFLOAT2(80, hei)); playstopButton->OnClick([&](wiEventArgs args) { SoundComponent* sound = GetScene().sounds.GetComponent(entity); if (sound != nullptr) @@ -129,7 +130,7 @@ SoundWindow::SoundWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) loopedCheckbox = new wiCheckBox("Looped: "); loopedCheckbox->SetTooltip("Enable looping for the selected sound instance."); loopedCheckbox->SetPos(XMFLOAT2(x + 150, y)); - loopedCheckbox->SetSize(XMFLOAT2(30, 30)); + loopedCheckbox->SetSize(XMFLOAT2(30, hei)); loopedCheckbox->OnClick([&](wiEventArgs args) { SoundComponent* sound = GetScene().sounds.GetComponent(entity); if (sound != nullptr) @@ -143,7 +144,7 @@ SoundWindow::SoundWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) volumeSlider = new wiSlider(0, 1, 1, 1000, "Volume: "); volumeSlider->SetTooltip("Set volume level for the selected sound instance."); volumeSlider->SetPos(XMFLOAT2(x + 60, y += step)); - volumeSlider->SetSize(XMFLOAT2(240, 30)); + volumeSlider->SetSize(XMFLOAT2(240, hei)); volumeSlider->OnSlide([&](wiEventArgs args) { SoundComponent* sound = GetScene().sounds.GetComponent(entity); if (sound != nullptr) diff --git a/Editor/SpringWindow.cpp b/Editor/SpringWindow.cpp index 6c72cdff6..c2c1de788 100644 --- a/Editor/SpringWindow.cpp +++ b/Editor/SpringWindow.cpp @@ -11,14 +11,14 @@ SpringWindow::SpringWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) assert(GUI && "Invalid GUI!"); window = new wiWindow(GUI, "Spring Window"); - window->SetSize(XMFLOAT2(460, 230)); + window->SetSize(XMFLOAT2(460, 200)); GUI->AddWidget(window); float x = 150; - float y = 0; - float step = 25; + float y = 10; float siz = 200; - float hei = 20; + float hei = 18; + float step = hei + 2; createButton = new wiButton("Create"); createButton->SetTooltip("Create/Remove Spring Component to selected entity"); diff --git a/Editor/TransformWindow.cpp b/Editor/TransformWindow.cpp index 72546f536..697503e16 100644 --- a/Editor/TransformWindow.cpp +++ b/Editor/TransformWindow.cpp @@ -11,7 +11,7 @@ TransformWindow::TransformWindow(EditorComponent* editor) : GUI(&editor->GetGUI( assert(GUI && "Invalid GUI!"); window = new wiWindow(GUI, "Transform Window"); - window->SetSize(XMFLOAT2(460, 170)); + window->SetSize(XMFLOAT2(460, 180)); GUI->AddWidget(window); float x = 100; diff --git a/WickedEngine/wiGUI.cpp b/WickedEngine/wiGUI.cpp index 0c4883daa..d686ae3e7 100644 --- a/WickedEngine/wiGUI.cpp +++ b/WickedEngine/wiGUI.cpp @@ -79,6 +79,7 @@ void wiGUI::Update(float dt) XMFLOAT4 _p = wiInput::GetPointer(); pointerpos.x = _p.x; pointerpos.y = _p.y; + pointerhitbox = Hitbox2D(pointerpos, XMFLOAT2(1, 1)); if (activeWidget != nullptr) { @@ -96,6 +97,13 @@ void wiGUI::Update(float dt) { // the contained child widgets will be updated by the containers widget->Update(this, dt); + + if (widget->IsVisible() && widget->hitBox.intersects(pointerhitbox)) + { + // hitbox can only intersect with one element (avoid detecting multiple overlapping elements) + pointerhitbox.pos = XMFLOAT2(-FLT_MAX, -FLT_MAX); + pointerhitbox.siz = XMFLOAT2(0, 0); + } } if (widget->IsEnabled() && widget->IsVisible() && widget->GetState() > wiWidget::WIDGETSTATE::IDLE) diff --git a/WickedEngine/wiGUI.h b/WickedEngine/wiGUI.h index 07d5dae6c..3c24bafc4 100644 --- a/WickedEngine/wiGUI.h +++ b/WickedEngine/wiGUI.h @@ -29,6 +29,7 @@ private: bool focus = false; bool visible = true; XMFLOAT2 pointerpos = XMFLOAT2(0, 0); + Hitbox2D pointerhitbox; public: ~wiGUI(); @@ -55,5 +56,9 @@ public: { return pointerpos; } + const Hitbox2D& GetPointerHitbox() const + { + return pointerhitbox; + } }; diff --git a/WickedEngine/wiIntersect.cpp b/WickedEngine/wiIntersect.cpp index fecd0a117..a0ca228b1 100644 --- a/WickedEngine/wiIntersect.cpp +++ b/WickedEngine/wiIntersect.cpp @@ -384,7 +384,7 @@ const XMFLOAT4& Frustum::getBottomPlane() const { return planes[5]; } -bool Hitbox2D::intersects(const Hitbox2D& b) +bool Hitbox2D::intersects(const Hitbox2D& b) const { return wiMath::Collision2D(pos, siz, b.pos, b.siz); } \ No newline at end of file diff --git a/WickedEngine/wiIntersect.h b/WickedEngine/wiIntersect.h index ae6b4fda7..cd45a850d 100644 --- a/WickedEngine/wiIntersect.h +++ b/WickedEngine/wiIntersect.h @@ -144,7 +144,7 @@ public: Hitbox2D(const XMFLOAT2& newPos, const XMFLOAT2 newSiz) :pos(newPos), siz(newSiz) {} ~Hitbox2D() {}; - bool intersects(const Hitbox2D& b); + bool intersects(const Hitbox2D& b) const; }; diff --git a/WickedEngine/wiVersion.cpp b/WickedEngine/wiVersion.cpp index d92debd85..319046d6c 100644 --- a/WickedEngine/wiVersion.cpp +++ b/WickedEngine/wiVersion.cpp @@ -9,7 +9,7 @@ namespace wiVersion // minor features, major updates, breaking API changes const int minor = 47; // minor bug fixes, alterations, refactors, updates - const int revision = 45; + const int revision = 46; const std::string version_string = std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(revision); diff --git a/WickedEngine/wiWidget.cpp b/WickedEngine/wiWidget.cpp index 4f1171dd8..51153f18f 100644 --- a/WickedEngine/wiWidget.cpp +++ b/WickedEngine/wiWidget.cpp @@ -43,10 +43,9 @@ void wiWidget::Update(wiGUI* gui, float dt) } - Hitbox2D pointerHitbox = Hitbox2D(gui->GetPointerPos(), XMFLOAT2(1, 1)); hitBox = Hitbox2D(XMFLOAT2(translation.x, translation.y), XMFLOAT2(scale.x, scale.y)); - if (GetState() != WIDGETSTATE::ACTIVE && !tooltip.empty() && pointerHitbox.intersects(hitBox)) + if (GetState() != WIDGETSTATE::ACTIVE && !tooltip.empty() && gui->GetPointerHitbox().intersects(hitBox)) { tooltipTimer++; } @@ -95,16 +94,10 @@ void wiWidget::RenderTooltip(const wiGUI* gui, CommandList cmd) const if (tooltipTimer > 25) { - XMFLOAT2 tooltipPos = XMFLOAT2(gui->pointerpos.x, gui->pointerpos.y); - if (tooltipPos.y > wiRenderer::GetDevice()->GetScreenHeight()*0.8f) - { - tooltipPos.y -= 30; - } - else - { - tooltipPos.y += 40; - } - wiFontParams fontProps = wiFontParams(tooltipPos.x, tooltipPos.y, WIFONTSIZE_DEFAULT, WIFALIGN_LEFT, WIFALIGN_TOP); + float screenwidth = wiRenderer::GetDevice()->GetScreenWidth(); + float screenheight = wiRenderer::GetDevice()->GetScreenHeight(); + + wiFontParams fontProps = wiFontParams(0, 0, WIFONTSIZE_DEFAULT, WIFALIGN_LEFT, WIFALIGN_TOP); fontProps.color = wiColor(25, 25, 25, 255); wiSpriteFont tooltipFont = wiSpriteFont(tooltip, fontProps); if (!scriptTip.empty()) @@ -112,23 +105,40 @@ void wiWidget::RenderTooltip(const wiGUI* gui, CommandList cmd) const tooltipFont.SetText(tooltip + "\n" + scriptTip); } - float textWidth = tooltipFont.textWidth(); - if (tooltipPos.x > wiRenderer::GetDevice()->GetScreenWidth() - textWidth) + static const float _border = 2; + float textWidth = tooltipFont.textWidth() + _border * 2; + float textHeight = tooltipFont.textHeight() + _border * 2; + + tooltipFont.params.posX = gui->pointerpos.x; + tooltipFont.params.posY = gui->pointerpos.y; + + if (tooltipFont.params.posX + textWidth > screenwidth) { - tooltipPos.x -= textWidth + 10; - tooltipFont.params.posX = tooltipPos.x; + tooltipFont.params.posX -= tooltipFont.params.posX + textWidth - screenwidth; + } + if (tooltipFont.params.posX < 0) + { + tooltipFont.params.posX = 0; } - static const float _border = 2; - float fontWidth = (float)tooltipFont.textWidth() + _border * 2; - float fontHeight = (float)tooltipFont.textHeight() + _border * 2; - wiImage::Draw(wiTextureHelper::getWhite(), wiImageParams(tooltipPos.x - _border, tooltipPos.y - _border, fontWidth, fontHeight, wiColor(255, 234, 165)), cmd); + if (tooltipFont.params.posY > screenheight * 0.8f) + { + tooltipFont.params.posY -= 30; + } + else + { + tooltipFont.params.posY += 40; + } + + wiImage::Draw(wiTextureHelper::getWhite(), + wiImageParams(tooltipFont.params.posX - _border, tooltipFont.params.posY - _border, + textWidth, textHeight, wiColor(255, 234, 165)), cmd); tooltipFont.SetText(tooltip); tooltipFont.Draw(cmd); if (!scriptTip.empty()) { tooltipFont.SetText(scriptTip); - tooltipFont.params.posY += (int)(fontHeight / 2); + tooltipFont.params.posY += (int)(textHeight / 2); tooltipFont.params.color = wiColor(25, 25, 25, 110); tooltipFont.Draw(cmd); } @@ -300,7 +310,7 @@ void wiButton::Update(wiGUI* gui, float dt) hitBox.siz.x = scale.x; hitBox.siz.y = scale.y; - Hitbox2D pointerHitbox = Hitbox2D(gui->GetPointerPos(), XMFLOAT2(1, 1)); + const Hitbox2D& pointerHitbox = gui->GetPointerHitbox(); if (state == FOCUS) { @@ -562,7 +572,7 @@ void wiTextInputField::Update(wiGUI* gui, float dt) hitBox.siz.x = scale.x; hitBox.siz.y = scale.y; - Hitbox2D pointerHitbox = Hitbox2D(gui->GetPointerPos(), XMFLOAT2(1, 1)); + const Hitbox2D& pointerHitbox = gui->GetPointerHitbox(); bool intersectsPointer = pointerHitbox.intersects(hitBox); if (state == FOCUS) @@ -823,7 +833,7 @@ void wiSlider::Update(wiGUI* gui, float dt) hitBox.siz.x = scale.x + knobWidth; hitBox.siz.y = scale.y; - Hitbox2D pointerHitbox = Hitbox2D(gui->GetPointerPos(), XMFLOAT2(1, 1)); + const Hitbox2D& pointerHitbox = gui->GetPointerHitbox(); if (pointerHitbox.intersects(hitBox)) @@ -961,7 +971,7 @@ void wiCheckBox::Update(wiGUI* gui, float dt) hitBox.siz.x = scale.x; hitBox.siz.y = scale.y; - Hitbox2D pointerHitbox = Hitbox2D(gui->GetPointerPos(), XMFLOAT2(1, 1)); + const Hitbox2D& pointerHitbox = gui->GetPointerHitbox(); bool clicked = false; // hover the button @@ -1108,7 +1118,7 @@ void wiComboBox::Update(wiGUI* gui, float dt) hitBox.siz.x = scale.x + scale.y + 1; // + drop-down indicator arrow + little offset hitBox.siz.y = scale.y; - Hitbox2D pointerHitbox = Hitbox2D(gui->GetPointerPos(), XMFLOAT2(1, 1)); + const Hitbox2D& pointerHitbox = gui->GetPointerHitbox(); bool clicked = false; // hover the button @@ -1682,7 +1692,7 @@ void wiWindow::Update(wiGUI* gui, float dt) gui->DeactivateWidget(this); } - Hitbox2D pointerHitbox = Hitbox2D(gui->GetPointerPos(), XMFLOAT2(1, 1)); + const Hitbox2D& pointerHitbox = gui->GetPointerHitbox(); bool clicked = false; // hover the button @@ -2059,7 +2069,7 @@ void wiColorPicker::Update(wiGUI* gui, float dt) ; XMFLOAT2 center = XMFLOAT2(translation.x + scale.x * 0.4f, translation.y + scale.y * 0.5f); - XMFLOAT2 pointer = gui->GetPointerPos(); + XMFLOAT2 pointer = gui->GetPointerHitbox().pos; float distance = wiMath::Distance(center, pointer); bool hover_hue = (distance > colorpicker_radius * sca) && (distance < (colorpicker_radius + colorpicker_width) * sca); @@ -2664,7 +2674,7 @@ void wiTreeList::Update(wiGUI* gui, float dt) } Hitbox2D hitbox = Hitbox2D(XMFLOAT2(translation.x, translation.y), XMFLOAT2(scale.x, scale.y)); - Hitbox2D pointerHitbox = Hitbox2D(gui->GetPointerPos(), XMFLOAT2(1, 1)); + const Hitbox2D& pointerHitbox = gui->GetPointerHitbox(); if (state == IDLE && hitbox.intersects(pointerHitbox)) {