Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 1, 2010, 9:28:28 PM (15 years ago)
Author:
dafrick
Message:

Made the QuestGUI completely lua based in an attempt to remove a segfault that occured when closing orxonox. Successfully, I might add. ;)
In the process of doing so I expanded the GUITools by adding a function that calculates the height that text in an input window needs, with word-wrap enabled.
Also fixed a small error in the Quest_PirateAttack level.

File:
1 edited

Legend:

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

    r6746 r7072  
    4545    return 0.008*ratio/0.3204
    4646end
     47
     48function getStaticTextWindowHeight(window)
     49    local lookAndFeel = CEGUI.WidgetLookManager:getSingleton():getWidgetLook(window:getLookNFeel())
     50    local formattedArea = lookAndFeel:getNamedArea("WithFrameTextRenderArea"):getArea():getPixelRect(window)
     51    local frameHeight = window:getUnclippedPixelRect():getHeight() - formattedArea:getHeight()
     52    local lines = window:getFont():getFormattedLineCount(window:getText(), formattedArea, CEGUI.WordWrapLeftAligned)
     53    local height = lines * window:getFont():getLineSpacing() + frameHeight
     54    return height
     55end
Note: See TracChangeset for help on using the changeset viewer.