diff --git a/Editor/Editor.cpp b/Editor/Editor.cpp index e0bca689e..6059c07c5 100644 --- a/Editor/Editor.cpp +++ b/Editor/Editor.cpp @@ -173,8 +173,8 @@ void EditorComponent::ResizeLayout() componentsWnd.SetPos(XMFLOAT2(screenW - componentsWnd.GetScale().x, screenH - componentsWnd.GetScale().y)); componentsWnd.scale_local = wi::math::Clamp(componentsWnd.scale_local, XMFLOAT3(1, 1, 1), XMFLOAT3(screenW, screenH, 1)); - aboutLabel.SetSize(XMFLOAT2(screenW / 2.0f, screenH / 1.5f)); - aboutLabel.SetPos(XMFLOAT2(screenW / 2.0f - aboutLabel.scale.x / 2.0f, screenH / 2.0f - aboutLabel.scale.y / 2.0f)); + aboutWindow.SetSize(XMFLOAT2(screenW / 2.0f, screenH / 1.5f)); + aboutWindow.SetPos(XMFLOAT2(screenW / 2.0f - aboutWindow.scale.x / 2.0f, screenH / 2.0f - aboutWindow.scale.y / 2.0f)); } void EditorComponent::Load() @@ -451,7 +451,7 @@ void EditorComponent::Load() aboutButton.SetColor(wi::Color(50, 160, 200, 180), wi::gui::WIDGETSTATE::IDLE); aboutButton.SetColor(wi::Color(120, 200, 200, 255), wi::gui::WIDGETSTATE::FOCUS); aboutButton.OnClick([&](wi::gui::EventArgs args) { - aboutLabel.SetVisible(!aboutLabel.IsVisible()); + aboutWindow.SetVisible(!aboutWindow.IsVisible()); }); GetGUI().AddWidget(&aboutButton); @@ -517,10 +517,21 @@ void EditorComponent::Load() aboutLabel.Create("AboutLabel"); aboutLabel.SetText(ss); - aboutLabel.SetVisible(false); + aboutLabel.SetSize(XMFLOAT2(600,4000)); aboutLabel.SetColor(wi::Color(113, 183, 214, 100)); aboutLabel.SetLocalizationEnabled(false); - GetGUI().AddWidget(&aboutLabel); + aboutWindow.AddWidget(&aboutLabel); + + auto wctrl = wi::gui::Window::WindowControls::ALL; + wctrl &= ~wi::gui::Window::WindowControls::RESIZE_BOTTOMLEFT; + aboutWindow.Create("About", wctrl); + aboutWindow.SetVisible(false); + aboutWindow.SetPos(XMFLOAT2(100, 100)); + aboutWindow.SetSize(XMFLOAT2(640, 480)); + aboutWindow.OnResize([this]() { + aboutLabel.SetSize(XMFLOAT2(aboutWindow.GetWidgetAreaSize().x - 20, aboutLabel.GetSize().y)); + }); + GetGUI().AddWidget(&aboutWindow); } exitButton.Create("Exit"); diff --git a/Editor/Editor.h b/Editor/Editor.h index aee4b769d..1f20f468c 100644 --- a/Editor/Editor.h +++ b/Editor/Editor.h @@ -45,6 +45,7 @@ public: wi::gui::Button bugButton; wi::gui::Button aboutButton; wi::gui::Button exitButton; + wi::gui::Window aboutWindow; wi::gui::Label aboutLabel; OptionsWindow optionsWnd; diff --git a/Editor/GeneralWindow.cpp b/Editor/GeneralWindow.cpp index de1b0f87a..944e05a45 100644 --- a/Editor/GeneralWindow.cpp +++ b/Editor/GeneralWindow.cpp @@ -510,6 +510,20 @@ void GeneralWindow::Create(EditorComponent* _editor) ktxConvButton.sprites[i].params.corners_rounding[1].radius = 8; ktxConvButton.sprites[i].params.corners_rounding[2].radius = 8; ktxConvButton.sprites[i].params.corners_rounding[3].radius = 8; + + editor->aboutWindow.sprites[i].params.enableCornerRounding(); + editor->aboutWindow.sprites[i].params.corners_rounding[0].radius = 10; + editor->aboutWindow.sprites[i].params.corners_rounding[1].radius = 10; + editor->aboutWindow.sprites[i].params.corners_rounding[2].radius = 10; + editor->aboutWindow.sprites[i].params.corners_rounding[3].radius = 10; + editor->aboutWindow.resizeDragger_UpperLeft.sprites[i].params.enableCornerRounding(); + editor->aboutWindow.resizeDragger_UpperLeft.sprites[i].params.corners_rounding[0].radius = 10; + editor->aboutWindow.resizeDragger_UpperRight.sprites[i].params.enableCornerRounding(); + editor->aboutWindow.resizeDragger_UpperRight.sprites[i].params.corners_rounding[1].radius = 10; + editor->aboutWindow.resizeDragger_BottomLeft.sprites[i].params.enableCornerRounding(); + editor->aboutWindow.resizeDragger_BottomLeft.sprites[i].params.corners_rounding[2].radius = 10; + editor->aboutWindow.resizeDragger_BottomRight.sprites[i].params.enableCornerRounding(); + editor->aboutWindow.resizeDragger_BottomRight.sprites[i].params.corners_rounding[3].radius = 10; } for (int i = 0; i < arraysize(wi::gui::Widget::sprites); ++i) { @@ -565,6 +579,14 @@ void GeneralWindow::Create(EditorComponent* _editor) editor->save_text_color = theme.font.color; + editor->aboutLabel.SetShadowColor(wi::Color::Transparent()); + editor->aboutLabel.SetColor(wi::Color::Transparent()); + for (int i = 0; i < arraysize(wi::gui::Widget::sprites); ++i) + { + editor->aboutLabel.sprites[i].params.disableBackground(); + editor->aboutLabel.sprites[i].params.blendFlag = wi::enums::BLENDMODE_ALPHA; + } + }); AddWidget(&themeCombo); diff --git a/WickedEngine/wiGUI.cpp b/WickedEngine/wiGUI.cpp index f8955bd55..d67154225 100644 --- a/WickedEngine/wiGUI.cpp +++ b/WickedEngine/wiGUI.cpp @@ -3362,6 +3362,10 @@ namespace wi::gui { onCollapse = func; } + void Window::OnResize(std::function func) + { + onResize = func; + } void Window::SetColor(wi::Color color, int id) { Widget::SetColor(color, id); @@ -3537,6 +3541,11 @@ namespace wi::gui scrollbar_vertical.AttachTo(this); scrollbar_vertical.SetSafeArea(scrollbar_vertical.scale.x); } + + if (onResize) + { + onResize(); + } } void Window::ExportLocalization(wi::Localization& localization) const { diff --git a/WickedEngine/wiGUI.h b/WickedEngine/wiGUI.h index ca371bc04..8b97cd3c8 100644 --- a/WickedEngine/wiGUI.h +++ b/WickedEngine/wiGUI.h @@ -18,16 +18,16 @@ namespace wi::gui struct EventArgs { - XMFLOAT2 clickPos = {}; - XMFLOAT2 startPos = {}; - XMFLOAT2 deltaPos = {}; - XMFLOAT2 endPos = {}; - float fValue = 0; - bool bValue = false; - int iValue = 0; - wi::Color color; - std::string sValue; - uint64_t userdata = 0; + XMFLOAT2 clickPos = {}; // mouse click coordinate + XMFLOAT2 startPos = {}; // mouse start position of operation (drag) + XMFLOAT2 deltaPos = {}; // mouse delta position of operation since last update (drag) + XMFLOAT2 endPos = {}; // mouse end position of operation (drag) + float fValue = 0; // generic float value of operation + bool bValue = false; // generic boolean value of operation + int iValue = 0; // generic integer value of operation + wi::Color color; // color value of color picker operation + std::string sValue; // generic string value of operation + uint64_t userdata = 0; // this will provide the userdata value that was set to a widget (or part of a widget) }; enum WIDGETSTATE @@ -619,6 +619,7 @@ namespace wi::gui float control_size = 20; std::function onClose; std::function onCollapse; + std::function onResize; public: enum class WindowControls @@ -669,6 +670,7 @@ namespace wi::gui void OnClose(std::function func); void OnCollapse(std::function func); + void OnResize(std::function func); Button closeButton; Button collapseButton; diff --git a/WickedEngine/wiVersion.cpp b/WickedEngine/wiVersion.cpp index 69426f6c4..c2b5a0563 100644 --- a/WickedEngine/wiVersion.cpp +++ b/WickedEngine/wiVersion.cpp @@ -9,7 +9,7 @@ namespace wi::version // minor features, major updates, breaking compatibility changes const int minor = 71; // minor bug fixes, alterations, refactors, updates - const int revision = 278; + const int revision = 279; const std::string version_string = std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(revision); @@ -137,6 +137,8 @@ Patreon supporters - Peter Moore - therealjtgill - Nicolas Embleton +- Desuuc +- radino1977 )"; return credits;