IGUIEnvironment::drawAll has now a parameter to allow disabling the automatic resize to driver screensize.

That makes it easier to use partial screens, while using automatic alignment. 
Default is still automatic resizing as before, thought it got changed a bit as it looked a bit strange.
Before it only set the lower-right corner, but compared to driver screensizes, so it behaved a bit strange
when the leftTop corner of the rootGuiElement was changed (different than when the rightBottom corner was set).
Could be the idea before was that only clipping matters.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6163 dfc29bdd-3216-0410-991c-e03cc46cb475
This commit is contained in:
cutealien 2020-12-01 13:42:44 +00:00
parent ba8de14e83
commit 0368c5b09d
5 changed files with 14 additions and 12 deletions

View File

@ -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.

View File

@ -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

View File

@ -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<s32> 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));
}
}

View File

@ -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_;

View File

@ -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