Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Feb 26, 2011, 6:46:36 AM (14 years ago)
Author:
rgrieder
Message:

Trying to port last bit of our Lua code to CEGUI 0.7.
But the piece of code now doesn't work with either version (though you can only see it in Credits and Quest)
Damian, I might need your assistance again :P

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/kicklib/data/gui/scripts/GUITools.lua

    r7961 r7964  
    4646end
    4747
     48function getStaticTextArea(static_text)
     49    local lookAndFeel = CEGUI.WidgetLookManager:getSingleton():getWidgetLook(static_text:getLookNFeel())
     50
     51    return lookAndFeel:getNamedArea("WithFrameTextRenderArea"):getArea():getPixelRect(static_text)
     52end
     53
    4854function getStaticTextWindowHeight(window)
    49     local lookAndFeel = CEGUI.WidgetLookManager:getSingleton():getWidgetLook(window:getLookNFeel())
    50     local formattedArea = lookAndFeel:getNamedArea("WithFrameTextRenderArea"):getArea():getPixelRect(window)
     55    -- Get the area the text is formatted and drawn into.
     56    local formattedArea = getStaticTextArea(window)
     57    -- Calculate the pixel height of the frame by subtracting the height of the area above from the total height of the window.
    5158    local frameHeight = window:getUnclippedOuterRect():getHeight() - formattedArea:getHeight()
    52     local lines = window:getFont():getFormattedLineCount(window:getText(), formattedArea, CEGUI.WordWrapLeftAligned)
    53     local height = lines * window:getFont():getLineSpacing() + frameHeight
     59
     60    local height = math.floor(CEGUI.PropertyHelper.stringToFloat(window:getProperty("VertExtent")) + frameHeight) + 1
    5461    return height
    5562end
Note: See TracChangeset for help on using the changeset viewer.