about FrameWindow size!

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

jasonjzz
Not too shy to talk
Not too shy to talk
Posts: 40
Joined: Mon Dec 22, 2008 06:37

about FrameWindow size!

Postby jasonjzz » Mon Mar 15, 2010 12:48

Hi,CE

How judging the FrameWindow size.

For example

Code: Select all

FrameWindow * wnd = winMgr.getwindow("M_Wnd");
Window * st = winMgr.getwindow("Test_Wnd");
UDim now_dx;
UDim last_dx;
last_dx = st->getXPosition().d_x;
now_dx = wnd->getXPosition().d_x;
if(now_dx < last_dx)
{
   MessageBoxA(NULL,"good",NULL,MB_OK);
}
else
{
  return false;
}


Compiled code when the error:

Error C2678: binary '<' : no operator found which takes a left-hand operand of type.

How can I do it!

thanks!

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: about FrameWindow size!

Postby CrazyEddie » Mon Mar 15, 2010 18:43

Hi,

The thing about a UDim is that it really needs some point of reference in order to figure out the scale component. Though I think it's likely most people might expect these comparison operators to work - I'll consider this as a feature request ;)

Currently you have a choice of either converting the UDims to common base values yourself - by way of the UDim::asAbsolute and/or UDim::asRelative functions, passing in some pixel size as the 'base' for the conversion. Since that's too much like work, you can use the precalculated pixel areas from Window instead, for 0.7.x these are:
Window::getUnclippedOuterRect
Window::getUnclippedInnerRect
Window::getOuterRectClipper
Window::getInnerRectClipper
Window::getHitTestRect

or for 0.6.x:
Window::getUnclippedPixelRect
Window::getUnclippedInnerRect
Window::getPixelRect
Window::getInnerRect

I imagine the 'Unclipped' versions will be of most use to you, and you'll have to look them up in the API reference for the details ;)

HTH

CE.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: about FrameWindow size!

Postby CrazyEddie » Wed Mar 17, 2010 10:25

Just to update on the feature request part of this topic. I decided not to implement the operator< and operator> for UDim, the reason being is due to what I stated above about the point of reference for the scale components.

For example:

Code: Select all

UDim a(0.5f, 0);
UDim b(0, 200);

is 'a' < 'b'?

Without knowing what the base size for the scale part is (i.e what it's 0.5 of), we can't determine whether 'a' is greater or if 'b' is greater. If the base were to be 100, then 'b' is greater than 'a', if the base is 500, then 'a' is greater than 'b'.

This is probably why I did not add these operators originally, and is why I'm still not going to be adding them now - it can't be done unless we pass the base value as an additional argument - which we can't do with operator< and operator>, so we may as well use the existing approach of converting to a common form first, then comparing.

CE.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 19 guests