Changeset 8283 for code/branches/kicklib2/data/gui/scripts/GUITools.lua
- Timestamp:
- Apr 21, 2011, 6:32:28 PM (14 years ago)
- Location:
- code/branches/kicklib2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/kicklib2
- Property svn:mergeinfo changed
/code/branches/kicklib merged: 7940-7948,7950-7951,7953,7956-7957,7959-7961,7964-7965,7967-7969,7971,7973-7974
- Property svn:mergeinfo changed
-
code/branches/kicklib2/data/gui/scripts/GUITools.lua
r8079 r8283 31 31 32 32 local lookAndFeel = CEGUI.WidgetLookManager:getSingleton():getWidgetLook(window:getLookNFeel()) 33 local height = window:getFont():getLineSpacing() + window:getUnclipped PixelRect():getHeight() - lookAndFeel:getNamedArea("WithFrameTextRenderArea"):getArea():getPixelRect(window):getHeight()34 local width = window:getFont():getTextExtent(window:getText()) + window:getUnclipped PixelRect():getWidth() - lookAndFeel:getNamedArea("WithFrameTextRenderArea"):getArea():getPixelRect(window):getWidth()33 local height = window:getFont():getLineSpacing() + window:getUnclippedOuterRect():getHeight() - lookAndFeel:getNamedArea("WithFrameTextRenderArea"):getArea():getPixelRect(window):getHeight() 34 local width = window:getFont():getTextExtent(window:getText()) + window:getUnclippedOuterRect():getWidth() - lookAndFeel:getNamedArea("WithFrameTextRenderArea"):getArea():getPixelRect(window):getWidth() 35 35 36 36 table.insert(size, height) … … 40 40 41 41 function getScrollingStepSize(window) 42 local height = window:getUnclipped PixelRect():getHeight()43 local maxHeight = CEGUI.System:getSingleton():getGUISheet():getUnclipped PixelRect():getHeight()42 local height = window:getUnclippedOuterRect():getHeight() 43 local maxHeight = CEGUI.System:getSingleton():getGUISheet():getUnclippedOuterRect():getHeight() 44 44 local ratio = height/maxHeight 45 45 return 0.008*ratio/0.3204 … … 47 47 48 48 function getStaticTextWindowHeight(window) 49 -- Get the area the text is formatted and drawn into. 49 50 local lookAndFeel = CEGUI.WidgetLookManager:getSingleton():getWidgetLook(window:getLookNFeel()) 50 51 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 52 -- Calculate the pixel height of the frame by subtracting the height of the area above from the total height of the window. 53 local frameHeight = window:getUnclippedOuterRect():getHeight() - formattedArea:getHeight() 54 55 local height = 0 56 if ORXONOX_OLD_CEGUI then 57 local lines = window:getFont():getFormattedLineCount(window:getText(), formattedArea, CEGUI.WordWrapLeftAligned) 58 height = lines * window:getFont():getLineSpacing() + frameHeight 59 else 60 height = math.floor(CEGUI.PropertyHelper:stringToFloat(window:getProperty("VertExtent")) + frameHeight) + 1 61 end 54 62 return height 55 63 end
Note: See TracChangeset
for help on using the changeset viewer.