diff --git a/changes.txt b/changes.txt index 408a87b8..02bdce47 100644 --- a/changes.txt +++ b/changes.txt @@ -1,5 +1,6 @@ -------------------------- Changes in 1.9 (not yet released) +- IGUIEnvironment::drawAll has now a parameter to allow disabling automatic resize to screensize. Makes it easier to use partial screens with full alignment support. - No longer try to set WM_QUIT when using an external Window on Win32. Thx @Marko Mahnic for the patch (https://sourceforge.net/p/irrlicht/bugs/449) - ply meshloader now also supports textures with uv-labels named texture_u/texture_v. diff --git a/include/IGUIEnvironment.h b/include/IGUIEnvironment.h index 695b41b8..b670d969 100644 --- a/include/IGUIEnvironment.h +++ b/include/IGUIEnvironment.h @@ -74,7 +74,9 @@ class IGUIEnvironment : public virtual IReferenceCounted public: //! Draws all gui elements by traversing the GUI environment starting at the root node. - virtual void drawAll() = 0; + /** \param When true ensure the GuiEnvironment (aka the RootGUIElement) has the same size as the current driver screensize. + Can be set to false to control that size yourself, p.E when not the full size should be used for UI. */ + virtual void drawAll(bool useScreenSize=true) = 0; //! Sets the focus to an element. /** Causes a EGET_ELEMENT_FOCUS_LOST event followed by a diff --git a/source/Irrlicht/CGUIEnvironment.cpp b/source/Irrlicht/CGUIEnvironment.cpp index e29195b2..0f0dc18b 100644 --- a/source/Irrlicht/CGUIEnvironment.cpp +++ b/source/Irrlicht/CGUIEnvironment.cpp @@ -191,19 +191,18 @@ void CGUIEnvironment::loadBuiltInFont() //! draws all gui elements -void CGUIEnvironment::drawAll() +void CGUIEnvironment::drawAll(bool useScreenSize) { - if (Driver) + if (useScreenSize && Driver) { core::dimension2d dim(Driver->getScreenSize()); if (AbsoluteRect.LowerRightCorner.X != dim.Width || - AbsoluteRect.LowerRightCorner.Y != dim.Height) + AbsoluteRect.UpperLeftCorner.X != 0 || + AbsoluteRect.LowerRightCorner.Y != dim.Height || + AbsoluteRect.UpperLeftCorner.Y != 0 + ) { - // resize gui environment - DesiredRect.LowerRightCorner = dim; - AbsoluteClippingRect = DesiredRect; - AbsoluteRect = DesiredRect; - updateAbsolutePosition(); + setRelativePosition(core::recti(0,0,dim.Width, dim.Height)); } } diff --git a/source/Irrlicht/CGUIEnvironment.h b/source/Irrlicht/CGUIEnvironment.h index 58b7f545..f8b03230 100644 --- a/source/Irrlicht/CGUIEnvironment.h +++ b/source/Irrlicht/CGUIEnvironment.h @@ -31,7 +31,7 @@ public: virtual ~CGUIEnvironment(); //! draws all gui elements - virtual void drawAll() _IRR_OVERRIDE_; + virtual void drawAll(bool useScreenSize) _IRR_OVERRIDE_; //! returns the current video driver virtual video::IVideoDriver* getVideoDriver() const _IRR_OVERRIDE_; diff --git a/tests/tests-last-passed-at.txt b/tests/tests-last-passed-at.txt index faa44d9c..15f31461 100644 --- a/tests/tests-last-passed-at.txt +++ b/tests/tests-last-passed-at.txt @@ -1,4 +1,4 @@ Tests finished. 72 tests of 72 passed. -Compiled as RELEASE -Test suite pass at GMT Tue Nov 10 18:42:40 2020 +Compiled as DEBUG +Test suite pass at GMT Tue Dec 01 13:34:31 2020