this note is about another workaround developed for the window setup described in http://www.cegui.org.uk/phpBB2/viewtopic.php?f=3&t=6429#p30169 . In short, I have a large pane that renders its content onto a large texture, which is then projected into a (zoomable) viewport on the screen. I am using CEGUI-0.7.7 (stable).
I got one finding related to a content window whose rendered proportions on the screen were larger then expected. I found the root cause for this problem in current calculatePixelSize() from CEGUIWindow. Therein, the window's pixelSize is calculated from it's UDim values using either the parent's ChildWindowContentArea or the DisplaySize as 'base_size'. This is reasonable, as long as the size of the ChildWindowContentArea (that will be eventually projected on the screen) is not larger than the display size. In my case, however, the ChildWindowContentArea of the mother pane is in the worst case twice as large as my physical DisplaySize.
The workaround I've found was to specially handle the above case in CEGUIWindow::calculatePixelSize . The below patch works fine for me, so far. But again, I've no idea about its side effects on other parts of the library.
Code: Select all
void Window::calculatePixelSize()
{
// calculate pixel sizes for everything, so we have a common format for
// comparisons.
const Vector2 absMax(d_maxSize.asAbsolute(
System::getSingleton().getRenderer()->getDisplaySize()));
const Vector2 absMin(d_minSize.asAbsolute(
System::getSingleton().getRenderer()->getDisplaySize()));
const Size base_size(d_parent ?
d_parent->getChildWindowContentArea(d_nonClientContent).getSize() :
System::getSingleton().getRenderer()->getDisplaySize());
// Added 04/30/2013, KS
// - If our parent's ChildWindowContentArea is larger than the physical
// DisplaySize, then we should limit what is used as 'base_size'
// to that of our display
const Size& dsz = System::getSingleton().getRenderer()->getDisplaySize();
const Size sz(ceguimin(base_size.d_width, dsz.d_width),
ceguimin(base_size.d_height, dsz.d_height));
d_pixelSize = d_area.getSize().asAbsolute(sz).asSize();
// Commented out, 04/30/2013, KS
// - see above
// d_pixelSize = d_area.getSize().asAbsolute(base_size).asSize();
// limit new pixel size to: minSize <= newSize <= maxSize
if (d_pixelSize.d_width < absMin.d_x)
d_pixelSize.d_width = absMin.d_x;
else if (d_pixelSize.d_width > absMax.d_x)
d_pixelSize.d_width = absMax.d_x;
if (d_pixelSize.d_height < absMin.d_y)
d_pixelSize.d_height = absMin.d_y;
else if (d_pixelSize.d_height > absMax.d_y)
d_pixelSize.d_height = absMax.d_y;
}