Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 15, 2009, 5:02:22 PM (14 years ago)
Author:
dafrick
Message:

Made KeyBindMenu less Resolution dependent, because of this the keybind buttons aren't vertically aligned anymore.
Also made scrolling (with the mouse wheel) (to some extent) invariant of the size of the ScrollablePane in the KeyBindManager.

File:
1 edited

Legend:

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

    r6311 r6355  
    1111    InfoPopup.setCloseButton(closeButton)
    1212end
     13
     14function getMinTextSize(window)
     15    local size = {}
     16   
     17    local lookAndFeel = CEGUI.WidgetLookManager:getSingleton():getWidgetLook(window:getLookNFeel())
     18    local height = window:getFont():getLineSpacing() + window:getUnclippedPixelRect():getHeight() - lookAndFeel:getNamedArea("WithFrameTextRenderArea"):getArea():getPixelRect(window):getHeight()
     19    local width =  window:getFont():getTextExtent(window:getText()) + window:getUnclippedPixelRect():getWidth() - lookAndFeel:getNamedArea("WithFrameTextRenderArea"):getArea():getPixelRect(window):getWidth()
     20   
     21    table.insert(size, height)
     22    table.insert(size, width)
     23    return size
     24end
     25
     26function getScrollingStepSize(window)
     27    local height = window:getUnclippedPixelRect():getHeight()
     28    local maxHeight = CEGUI.System:getSingleton():getGUISheet():getUnclippedPixelRect():getHeight()
     29    local ratio = height/maxHeight
     30    return 0.008*ratio/0.3204
     31end
Note: See TracChangeset for help on using the changeset viewer.