I'm pleased to announce that Dawntide has just upgraded to CEGUI 0.7.5 which is ~4 times faster than our last integration CEGUI 0.6.2. I'm quite impressed to be honest. Our UI is way more responsive now and doesn't hog the CPU anymore with quad updates when moving windows around. My thanks and gratitude to CE and his team, good job !
However there are still some issues with the new way the UI works. First, panels doesn't auto-place things inside which makes sense though I just didn't realize we had so many offsetted windows before. Next up is that I had a function to rescale widgets based on how many lines of text I had in them which doesn't work and CE supplied it to me so I'm not really sure how to upgrade it to 0.7.5 standards.
Code: Select all
int RescaleHeight(CEGUI::Window* static_text)
{
// Get the area the text is formatted and drawn into.
CEGUI::Rect fmt_area(getStaticTextArea(static_text));
// Calculate the pixel height of the frame by subtracting the height of the
// area above from the total height of the window.
float frame_height = static_text->getUnclippedOuterRect().getHeight() - fmt_area.getHeight();
// Get the formatted line count - using the formatting area obtained above.
//int lines = static_text->getFont()->getFormattedLineCount( static_text->getText(), fmt_area, CEGUI::WordWrapLeftAligned);//CEGUI 0.7
CEGUI::JustifiedRenderedString JRS( static_text->getRenderedString() );
CEGUI::Size S( fmt_area.d_right - fmt_area.d_left, fmt_area.d_bottom - fmt_area.d_top );
JRS.format( S );
const char *Text = static_text->getText().c_str();
int lines = JRS.getFormattedLineCount();
// Calculate pixel height of window, which is the number of formatted lines
// multiplied by the spacing of the font, plus the pixel height of the
// frame.
float height = (float)lines * static_text->getFont()->getLineSpacing() + frame_height;
height = (float)( (int)height + 1 );
// set the height to the window.
static_text->setHeight(CEGUI::UDim(0, height));
return static_cast<int>(height);
}
That is how I tried to patch the code since the commented line doesn't work and my "patch" always returns one line.
Next up is a real CEGUI bug that I thought is worth mentioning. I was creating a widget attached to a different widget from a hierarchy which is at base negatively offsetted on the Y axis. It turned out that when I was scaling it to fit entirely in it's parent window (with X and Y scale set to 1), after a setArea/setSize call the Y scale was 0 and the widget was rendered invisible. I debugged the code a bit and it gets clamped to 0 because the PixelSize.Y of the parent is reporting to be -10.
Code: Select all
<Window Type='defaultLook/GoldStaticImage' Name='GuiMain/BottomDock'>
<Property Name='UnifiedPosition' Value='{{0.0000,0.0000},{1.0000,-79.0000}}'/>
<Property Name='UnifiedSize' Value='{{1.0000,0.0000},{0.0000,79.0000}}'/>
<Property Name='MousePassThroughEnabled' Value='True'/>
<!-- CastBar Begin-->
<Window Type='defaultLook/GoldStaticImage' Name='GuiMain/CastBar'>
<Property Name='Visible' Value='False'/>
<Property Name='UnifiedPosition' Value='{{0.5,-133.5},{0.0000,-43.0000}}'/>
<Property Name='UnifiedSize' Value='{{0.0000,267.0000},{0.0000,33.0000}}'/>
<Property Name='Image' Value='set:v3-Unitframes image:UF_CastBackground'/>
<Property Name='ClippedByParent' Value='False'/>
<Window Type='defaultLook/GoldStaticImage' Name='GuiMain/CastBar_Frame'>
<Property Name='Visible' Value='True'/>
<Property Name='UnifiedPosition' Value='{{0.0,16.0000},{0.0,8.0000}}'/>
<Property Name='UnifiedSize' Value='{{0,235},{0,17}}' />
<Property Name='Image' Value='set:v3-Unitframes image:UF_CastFull'/>
</Window>
</Window>
</Window>
I was creating a widget inside which I was placing GuiMain/CastBar_Frame and then attaching it to GuiMain/CastBar.
However I've managed to fix this by specifying the size in pixels rather than scale.
Hope it helps.