Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 13, 2009, 1:46:28 PM (15 years ago)
Author:
dafrick
Message:

Removed empty lines.
Adjusted size of boxes in KeyBindMenu so that the text is displayed properly.
Regarding the bug: Found the reason why this happens. The problem is, that apparently CEGUI doesn't allow for windows bigger than the displayed screen, which means, that any window that is bigger than the scrren size isn'f fully displayed. I have no idea how to circumvent this, but I'll keep looking.

Location:
code/branches/presentation2/data/gui
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation2/data/gui/layouts/DecisionPopup.layout

    r6334 r6335  
    11<?xml version="1.0" encoding="UTF-8"?>
    22
    3 
    4 
    53<GUILayout >
    6 
    74    <Window Type="DefaultWindow" Name="orxonox/DecisionPopup_RootWindow" >
    8 
    95        <Property Name="InheritsAlpha" Value="False" />
    10 
    116        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    12 
    137        <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
    14 
    158        <Window Type="TaharezLook/StaticImage" Name="orxonox/DecisionPopup_Background" >
    16 
    17             <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    18 
     9            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /
    1910            <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
    20 
    2111            <Property Name="Alpha" Value="0.6" />
    22 
    2312            <Window Type="TaharezLook/Button" Name="orxonox/DecisionPopup_button_yes" >
    24 
    2513                <Property Name="Font" Value="BlueHighway-12" />
    26 
    2714                <Property Name="Text" Value="Yes" />
    28 
    2915                <Property Name="Alpha" Value="0.7" />
    30 
    3116                <Property Name="InheritsAlpha" Value="False" />
    32  
    3317                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    34 
    3518                <Property Name="UnifiedAreaRect" Value="{{0.2875,0},{0.5625,0},{0.4875,0},{0.6125,0}}" />
    36 
    3719                <Event Name="Clicked" Function="DecisionPopup.button_yes"/>
    38 
    3920            </Window>
    40 
    4121            <Window Type="TaharezLook/Button" Name="orxonox/DecisionPopup_button_no" >
    42 
    4322                <Property Name="Font" Value="BlueHighway-12" />
    44 
    4523                <Property Name="Text" Value="No" />
    46 
    4724                <Property Name="Alpha" Value="0.8" />
    48 
    4925                <Property Name="InheritsAlpha" Value="False" />
    50  
    5126                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    52 
    5327                <Property Name="UnifiedAreaRect" Value="{{0.5125,0},{0.5625,0},{0.7125,0},{0.6125,0}}" />
    54 
    5528                <Event Name="Clicked" Function="DecisionPopup.button_no"/>
    56 
    5729            </Window>
    58 
    5930            <Window Type="TaharezLook/StaticText" Name="orxonox/DecisionPopup_text" >
    60 
    6131                <Property Name="Text" Value="Template text" />
    62 
    6332                <Property Name="HorzFormatting" Value="WordWrapCentred" />
    64 
    6533                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    66 
    6734                <Property Name="UnifiedAreaRect" Value="{{0.25,0},{0.4375,0},{0.75,0},{0.5375,0}}" />
    68 
    6935                <Property Name="InheritsAlpha" Value="False" />
    70  
    7136                <Property Name="Alpha" Value="0.8" />
    72 
    7337            </Window>
    74 
    7538        </Window>
    76 
    7739    </Window>
    78 
    7940</GUILayout>
  • code/branches/presentation2/data/gui/layouts/InGameMenu.layout

    r6334 r6335  
    11<?xml version="1.0" encoding="UTF-8"?>
    22
    3 
    4 
    53<GUILayout >
    6 
    74    <Window Type="DefaultWindow" Name="orxonox/InGameMenu_RootWindow" >
    8 
    95        <Property Name="InheritsAlpha" Value="False" />
    10 
    116        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    12 
    137        <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
    14 
    158        <Window Type="TaharezLook/Button" Name="orxonox/InGameMenu_ReturnButton" >
    16 
    179            <Property Name="Font" Value="BlueHighway-12" />
    18 
    1910            <Property Name="Text" Value="Return to Game" />
    20 
    2111            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    22 
    2312            <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.3625,0},{0.6,0},{0.4125,0}}" />
    24 
    2513            <Property Name="Alpha" Value="0.7" />
    26 
    2714            <Event Name="Clicked" Function="InGameMenu.button_return_clicked"/>
    28 
    2915        </Window>
    30 
    3116        <Window Type="TaharezLook/Button" Name="orxonox/InGameMenu_MainMenuButton" >
    32 
    3317            <Property Name="Font" Value="BlueHighway-12" />
    34 
    3518            <Property Name="Text" Value="Main Menu" />
    36 
    3719            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    38 
    3920            <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.4625,0},{0.6,0},{0.5125,0}}" />
    40 
    4121            <Property Name="Alpha" Value="0.7" />
    42 
    4322            <Event Name="Clicked" Function="InGameMenu.button_mainmenu_clicked"/>
    44 
    4523        </Window>
    46 
    4724        <Window Type="TaharezLook/Button" Name="orxonox/InGameMenu_SettingsButton" >
    48 
    4925            <Property Name="Font" Value="BlueHighway-12" />
    50 
    5126            <Property Name="Text" Value="Settings" />
    52 
    5327            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    54 
    5528            <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.5625,0},{0.6,0},{0.6125,0}}" />
    56 
    5729            <Property Name="Alpha" Value="0.7" />
    58 
    5930            <Event Name="Clicked" Function="InGameMenu.button_settings_clicked"/>
    60 
    6131        </Window>
    62 
    6332        <Window Type="TaharezLook/Button" Name="orxonox/InGameMenu_QuitButton" >
    64 
    6533            <Property Name="Font" Value="BlueHighway-12" />
    66 
    6734            <Property Name="Text" Value="Quit" />
    68 
    6935            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    70 
    7136            <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.6625,0},{0.6,0},{0.7125,0}}" />
    72 
    7337            <Property Name="Alpha" Value="0.7" />
    74 
    7538            <Event Name="Clicked" Function="InGameMenu.button_quit_clicked"/>
    76 
    7739        </Window>
    78 
    7940    </Window>
    80 
    8141</GUILayout>
  • code/branches/presentation2/data/gui/layouts/InfoPopup.layout

    r6334 r6335  
    11<?xml version="1.0" encoding="UTF-8"?>
    22
    3 
    4 
    53<GUILayout >
    6 
    74    <Window Type="DefaultWindow" Name="orxonox/InfoPopup_RootWindow" >
    8 
    95        <Property Name="InheritsAlpha" Value="False" />
    10 
    116        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    12 
    137        <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
    14 
    158        <Window Type="TaharezLook/StaticImage" Name="orxonox/InfoPopup_Background" >
    16 
    179            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    18 
    1910            <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
    20 
    2111            <Property Name="Alpha" Value="0.7" />
    22 
    2312            <Window Type="TaharezLook/Button" Name="orxonox/InfoPopup_close" >
    24 
    2513                <Property Name="Font" Value="BlueHighway-12" />
    26 
    2714                <Property Name="Text" Value="Close" />
    28 
    2915                <Property Name="Alpha" Value="0.7" />
    30 
    3116                <Property Name="InheritsAlpha" Value="False" />
    32  
    33                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    34 
     17                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    3518                <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.5,0},{0.6,0},{0.55,0}}" />
    36 
    3719                <Event Name="Clicked" Function="InfoPopup.close"/>
    38 
    3920            </Window>
    40 
    4121            <Window Type="TaharezLook/StaticText" Name="orxonox/InfoPopup_text" >
    42 
    4322                <Property Name="Text" Value="Template text" />
    44 
    4523                <Property Name="TextColours" Value="FF4444FF" />
    4624                <Property Name="HorzFormatting" Value="WordWrapCentred" />
    47 
    4825                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    49 
    5026                <Property Name="UnifiedAreaRect" Value="{{0.25,0},{0.375,0},{0.75,0},{0.475,0}}" />
    51 
    5227                <Property Name="InheritsAlpha" Value="False" />
    53  
    5428               <Property Name="Alpha" Value="0.8" />
    55 
    5629            </Window>
    57 
    5830        </Window>
    59 
    6031    </Window>
    61 
    6232</GUILayout>
  • code/branches/presentation2/data/gui/layouts/KeyBindMenu.layout

    r6334 r6335  
    11<?xml version="1.0" encoding="UTF-8"?>
    22
    3 
    4 
    53<GUILayout >
    6 
    74    <Window Type="DefaultWindow" Name="orxonox/KeyBindMenu/Background" >
    8 
    95        <Property Name="InheritsAlpha" Value="False" />
    10 
    116        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    12 
    137        <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
    14 
    158        <Window Type="TaharezLook/StaticText" Name="orxonox/KeyBindWindow" >
    16 
    179            <Property Name="Text" Value="Keybindings" />
    18 
    1910            <Property Name="Alpha" Value="0.8" />
    20 
    2111            <Property Name="InheritsAlpha" Value="False" />
    22 
    2312            <Property Name="HorzFormatting" Value="HorzCentred" />
    24 
    2513            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    26 
    2714            <Property Name="VertFormatting" Value="TopAligned" />
    28 
    2915            <Property Name="UnifiedAreaRect" Value="{{0.15,0},{0.2125,0},{0.85,0},{0.6375,0}}" />
    30 
    3116            <Window Type="TaharezLook/StaticText" Name="orxonox/KeyBindWrapper" >
    32 
    3317                <Property Name="TextColours" Value="FF4444FF" />
    34 
    3518                <Property Name="InheritsAlpha" Value="False" />
    36 
    3719                <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    38 
    3920                <Property Name="HorzFormatting" Value="HorzCentred" />
    40 
    4121                <Property Name="VertFormatting" Value="TopAligned" />
    42 
    4322                <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.15,0},{0.95,0},{0.92,0}}" />
    44 
    4523                <Window Type="TaharezLook/ScrollablePane" Name="orxonox/KeyBindPane" >
    46 
    4724                    <Property Name="ContentArea" Value="l:0 t:0 r:0 b:0" />
    48 
    4925                    <Property Name="HorzStepSize" Value="0.1" />
    50 
    5126                    <Property Name="VertStepSize" Value="0.1" />
    52 
    5327                    <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    54 
    5528                    <Property Name="HorzOverlapSize" Value="0.01" />
    56 
    5729                    <Property Name="UnifiedAreaRect" Value="{{0.005,0},{0.01,0},{0.995,0},{0.99,0}}" />
    58 
    5930                    <Property Name="VertOverlapSize" Value="0.01" />
    60 
    6131                    <Property Name="HorzScrollPosition" Value="0" />
    62 
    6332                    <Property Name="VertScrollPosition" Value="0" />
    64 
    6533                </Window>
    66 
    6734            </Window>
    68 
    6935        </Window>
    70 
    7136        <Window Type="TaharezLook/Button" Name="orxonox/KeyBindBackButton" >
    7237            <Property Name="Text" Value="Back" />
    73 
    7438            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
    75 
    7639            <Property Name="UnifiedAreaRect" Value="{{0.4,0},{0.6625,0},{0.6,0},{0.7125,0}}" />
    77 
    7840            <Event Name="Clicked" Function="KeyBindMenu.KeyBindBackButton_clicked"/>
    79 
    8041        </Window>
    81 
    8242    </Window>
    83 
    8443</GUILayout>
  • code/branches/presentation2/data/gui/scripts/InfoPopup.lua

    r6334 r6335  
    11-- InfoPopup.lua
    2 
    3 
    42
    53BasicGUI = require("BasicGUI")
    64local P = BasicGUI:new() --inherit everything from the gui package
    75
    8 
    96if _REQUIREDNAME == nil then
    10 
    117    InfoPopup = P
    12 
    138else
    14 
    159    _G[_REQUIREDNAME] = P
    16 
    1710end
    1811
    19 
    20 
    2112P.filename = "InfoPopup"
    22 
    2313P.layoutString = "InfoPopup.layout"
    2414
    25 
    26 
    2715function P:init()
    28 
    2916end
    3017
    31 
    32 
    3318function P.execute(functionPtr, arguments)
    34 
    3519    if functionPtr ~= nil then
    36 
    3720        if arguments ~= nil then
    38 
    3921            functionPtr(arguments)
    40 
    4122        else
    42 
    4323            functionPtr()
    44 
    4524        end
    46 
    4725    end
    48 
    4926end
    5027
    51 
    52 
    5328function P.setText( text )
    54 
    5529    winMgr:getWindow("orxonox/InfoPopup_text"):setText( text )
    56 
    5730end
    5831
    59 
    60 
    6132function P.setCloseButton(closeButton)
    62 
    6333    close = winMgr:getWindow("orxonox/InfoPopup_close")
    64 
    6534    close:setVisible(closeButton)
    66 
    6735    if(not closeButton) then
    68 
    6936        close:deactivate();
    70 
    7137    else
    72 
    7338        close:activate();
    74 
    7539    end
    76 
    7740end
    7841
    79 
    80 
    8142-- events for ingamemenu
    82 
    83 
    8443function P.close(e)
    85 
    8644    hideGUI("InfoPopup")
    87 
    8845end
    8946
    90 
    91 
    9247return P
    93 
  • code/branches/presentation2/data/gui/scripts/KeyBindMenu.lua

    r6334 r6335  
    11-- KeyBindMenu.lua
    22
    3 
    4 
    53BasicGUI = require("BasicGUI")
    6 
    74local P = BasicGUI:new() --inherit everything from the gui package
    85
    9 
    106if _REQUIREDNAME == nil then
    11 
    127    KeyBindMenu = P
    13 
    148else
    159    _G[_REQUIREDNAME] = P
    16 
    17 end
    18 
    19 
     10end
    2011
    2112P.filename = "KeyBindMenu"
    22 
    2313P.layoutString = "KeyBindMenu.layout"
    2414
    25 
    26 
    2715function P:init()
    2816
    2917    commandList = {}
    30 
    3118    table.insert(commandList, "fire 0")
    32 
    3319    table.insert(commandList, "fire 1 | unfire")
    34 
    3520    table.insert(commandList, "onpress fire 2")
    36 
    3721    table.insert(commandList, "scale 1 moveFrontBack")
    38 
    3922    table.insert(commandList, "scale -1 moveFrontBack")
    40 
    4123    table.insert(commandList, "boost")
    42 
    4324    table.insert(commandList, "scale 1 moveRightLeft")
    44 
    4525    table.insert(commandList, "scale -1 moveRightLeft")
    46 
    4726    table.insert(commandList, "scale 1 moveUpDown")
    48 
    4927    table.insert(commandList, "scale -1 moveUpDown")
    50 
    5128    table.insert(commandList, "scale 1 rotateRoll")
    52 
    5329    table.insert(commandList, "scale -1 rotateRoll")
    54 
    5530    table.insert(commandList, "switchCamera")
    56 
    5731    table.insert(commandList, "openConsole")
    58 
    5932    table.insert(commandList, "OverlayGroup toggleVisibility Debug")
    60 
    6133    table.insert(commandList, "OverlayGroup toggleVisibility Stats")
    62 
    6334    table.insert(commandList, "mouseLook")
    64 
    6535    table.insert(commandList, "pause")
    6636
    67    
    68 
    6937    nameList = {}
    70 
    7138    table.insert(nameList, "Primary Fire")
    72 
    7339    table.insert(nameList, "Secondary Fire")
    74 
    7540    table.insert(nameList, "Fire Rocket")
    76 
    7741    table.insert(nameList, "Accelerate")
    78 
    7942    table.insert(nameList, "Break")
    8043    table.insert(nameList, "Boost")
    81 
    8244    table.insert(nameList, "Move Right")
    83 
    8445    table.insert(nameList, "Move Left")
    85 
    8646    table.insert(nameList, "Move Up")
    87 
    8847    table.insert(nameList, "Move Down")
    89 
    9048    table.insert(nameList, "Roll Right")
    91 
    9249    table.insert(nameList, "Roll Left")
    93 
    9450    table.insert(nameList, "Switch Camera")
    95 
    9651    table.insert(nameList, "Open Console")
    97 
    9852    table.insert(nameList, "Show Debug")
    99 
    10053    table.insert(nameList, "Show Stats")
    101 
    10254    table.insert(nameList, "Look Around")
    103 
    10455    table.insert(nameList, "Pause")
    10556
    106    
    107 
    10857    linesList = {}
    10958
    110 
    111     lineHeight = 25
     59    lineHeight = 30
    11260    commandWidth = 125
    113     buttonWidth = 125
     61    buttonWidth = 145
    11462    clearWidth = 20
    115     addWidth = 25
    116 
     63    addWidth = 30
    11764    spaceWidth = 10
    11865
    119    
    120 
    12166    P.createLines()
    12267
    123    
    124 
    12568    local funct = luaState:createLuaFunctor("KeyBindMenu.callback()")
    126 
    12769    orxonox.KeyBinderManager:getInstance():registerKeybindCallback(funct)
    128 
    129 end
    130 
    131 
    132 
     70end
    13371
    13472function P.KeyNameNiceifier(key)
    135 
    13673    local name = string.sub(key, string.find(key, '%.(.*)')+1)
    13774    local group = string.sub(key, string.find(key, '(.*)%.'))
    138 
    13975    group = string.sub(group,1,string.len(group)-1)
    140 
    14176    if( group == "Keys") then
    142 
    14377        return "Key " .. string.sub(name, string.find(name, 'Key(.*)')+3)
    144 
    14578    elseif( group == "MouseButtons") then
    146 
    14779        return "Mouse " .. name
    148 
    149     end
    150 
     80    end
    15181    return key
    152 
    153 end
    154 
    155 
     82end
    15683
    15784function P.createLine(k)
    158 
    15985    local offset = 0
    160 
    16186    local line = winMgr:createWindow("DefaultWindow", "orxonox/KeyBindPane/Binding" .. k)
    162 
    16387    line:setHeight(CEGUI.UDim(0, lineHeight))
    164 
    16588    line:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, lineHeight*(k-1))))
    16689
    167    
    168 
    16990    local command = winMgr:createWindow("TaharezLook/StaticText", "orxonox/KeyBindPane/Binding" .. k .. "/Command")
    170 
    17191    command:setSize(CEGUI.UVector2(CEGUI.UDim(0, commandWidth), CEGUI.UDim(1, 0)))
    172 
    17392    command:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0, 0)))
    174 
    17593    command:setText(nameList[k])
    17694    line:addChildWindow(command)
    177 
    17895    offset = offset + commandWidth + spaceWidth
    17996
     97    local plus = winMgr:createWindow("TaharezLook/TabButton", "orxonox/KeyBindPane/Binding" .. k .. "/Plus")
     98    plus:setSize(CEGUI.UVector2(CEGUI.UDim(0, addWidth), CEGUI.UDim(0.7, 0)))
     99    plus:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.15, 0)))
     100    plus:setText("add")
     101    orxonox.KeyBinderManager:getInstance():subscribeEventHelper(plus, "Clicked", P.filename .. ".KeyBindPlus_clicked")
     102    line:addChildWindow(plus)
     103    offset = offset + addWidth + spaceWidth
     104
     105    local numButtons = orxonox.KeyBinderManager:getInstance():getCurrent():getNumberOfBindings(commandList[k]);
     106    for i=0,(numButtons-1) do
     107        local button = winMgr:createWindow("TaharezLook/TabButton", "orxonox/KeyBindPane/Binding" .. k .. "/Button" .. i)
     108        button:setSize(CEGUI.UVector2(CEGUI.UDim(0, buttonWidth), CEGUI.UDim(0.7, 0)))
     109        button:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.15, 0)))
     110        local name = orxonox.KeyBinderManager:getInstance():getCurrent():getBinding(commandList[k],i)
     111        name = P.KeyNameNiceifier(name)
     112        button:setText(name)
     113        orxonox.KeyBinderManager:getInstance():subscribeEventHelper(button, "Clicked", P.filename .. ".KeyBindButton_clicked")
     114        --button:subscribeScriptedEvent("EventClicked", P.filename .. ".KeyBindButton_clicked")
     115        line:addChildWindow(button)
     116        offset = offset + buttonWidth
     117
     118        local clear = winMgr:createWindow("TaharezLook/TabButton", "orxonox/KeyBindPane/Binding" .. k .. "/Clear" .. i)
     119        clear:setSize(CEGUI.UVector2(CEGUI.UDim(0, clearWidth), CEGUI.UDim(0.7, 0)))
     120        clear:setPosition(CEGUI.UVector2(CEGUI.UDim(0, (i*(buttonWidth+clearWidth+spaceWidth)+buttonWidth)+commandWidth+clearWidth+2*spaceWidth), CEGUI.UDim(0.15, 0)))
     121        clear:setText("X")
     122        orxonox.KeyBinderManager:getInstance():subscribeEventHelper(clear, "Clicked", P.filename .. ".KeyBindClear_clicked")
     123        line:addChildWindow(clear)
     124        offset = offset + clearWidth + spaceWidth
     125    end
    180126   
    181 
    182     local plus = winMgr:createWindow("TaharezLook/TabButton", "orxonox/KeyBindPane/Binding" .. k .. "/Plus")
    183 
    184     plus:setSize(CEGUI.UVector2(CEGUI.UDim(0, addWidth), CEGUI.UDim(0.7, 0)))
    185 
    186     plus:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.15, 0)))
    187 
    188     plus:setText("add")
    189 
    190     orxonox.KeyBinderManager:getInstance():subscribeEventHelper(plus, "Clicked", P.filename .. ".KeyBindPlus_clicked")
    191 
    192     line:addChildWindow(plus)
    193 
    194     offset = offset + addWidth + spaceWidth
    195 
     127    debug(0, "OFFSET: " .. offset)
     128
     129    line:setWidth(CEGUI.UDim(0, offset+clearWidth))
    196130   
    197 
    198     local numButtons = orxonox.KeyBinderManager:getInstance():getCurrent():getNumberOfBindings(commandList[k]);
    199 
    200     for i=0,(numButtons-1) do
    201 
    202         local button = winMgr:createWindow("TaharezLook/TabButton", "orxonox/KeyBindPane/Binding" .. k .. "/Button" .. i)
    203 
    204         button:setSize(CEGUI.UVector2(CEGUI.UDim(0, buttonWidth), CEGUI.UDim(0.7, 0)))
    205 
    206         button:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.15, 0)))
    207 
    208         local name = orxonox.KeyBinderManager:getInstance():getCurrent():getBinding(commandList[k],i)
    209 
    210         name = P.KeyNameNiceifier(name)
    211 
    212         button:setText(name)
    213 
    214         orxonox.KeyBinderManager:getInstance():subscribeEventHelper(button, "Clicked", P.filename .. ".KeyBindButton_clicked")
    215 
    216         --button:subscribeScriptedEvent("EventClicked", P.filename .. ".KeyBindButton_clicked")
    217 
    218         line:addChildWindow(button)
    219 
    220         offset = offset + buttonWidth
    221 
    222        
    223 
    224         local clear = winMgr:createWindow("TaharezLook/TabButton", "orxonox/KeyBindPane/Binding" .. k .. "/Clear" .. i)
    225 
    226         clear:setSize(CEGUI.UVector2(CEGUI.UDim(0, clearWidth), CEGUI.UDim(0.7, 0)))
    227 
    228         clear:setPosition(CEGUI.UVector2(CEGUI.UDim(0, (i*(buttonWidth+clearWidth+spaceWidth)+buttonWidth)+commandWidth+clearWidth+2*spaceWidth), CEGUI.UDim(0.15, 0)))
    229 
    230         clear:setText("X")
    231 
    232         orxonox.KeyBinderManager:getInstance():subscribeEventHelper(clear, "Clicked", P.filename .. ".KeyBindClear_clicked")
    233 
    234         line:addChildWindow(clear)
    235 
    236         offset = offset + clearWidth + spaceWidth
    237 
    238     end
    239 
    240    
    241 
    242     line:setWidth(CEGUI.UDim(0, offset+clearWidth))
    243 
    244    
    245 
    246131    return line
    247 
    248 end
    249 
    250 
     132end
    251133
    252134function P.createLines()
    253 
    254 
    255135    local window = winMgr:getWindow("orxonox/KeyBindPane")
    256136
    257 
    258137    for k,v in pairs(commandList) do
    259 
    260138        local line = P.createLine(k)
    261 
    262139        table.insert(linesList, line)
    263 
    264140        window:addChildWindow(line)
    265 
    266     end
    267 
    268 
    269 end
    270 
    271 
     141    end
     142end
    272143
    273144function P.KeyBindButton_clicked(e)
    274 
    275145    local we = CEGUI.toWindowEventArgs(e)
    276 
    277146    local name = we.window:getName()
    278147
    279 
    280148    local match = string.gmatch(name, "%d+")
    281 
    282149    local commandNr = tonumber(match())
    283 
    284150    local buttonNr = tonumber(match())
    285151
    286    
    287 
    288152    local arguments = {}
    289 
    290153    arguments[1] = commandNr
    291 
    292154    arguments[2] = buttonNr
    293 
    294155    openInfoPopup("Press any button/key or move a mouse/joystick axis.", KeyBindMenu.keybind, false, arguments)
    295156end
    296157
    297158function P.KeyBindPlus_clicked(e)
    298 
    299159    local we = CEGUI.toWindowEventArgs(e)
    300 
    301160    local name = we.window:getName()
    302161
    303    
    304 
    305162    local match = string.gmatch(name, "%d+")
    306 
    307163    local commandNr = tonumber(match())
    308    
    309164
    310165    local arguments = {}
    311 
    312166    arguments[1] = commandNr
    313 
    314167    openInfoPopup("Press any button/key or move a mouse/joystick axis.", KeyBindMenu.keybind, false, arguments)
    315168end
    316169
    317170function P.KeyBindClear_clicked(e)
    318 
    319171    local we = CEGUI.toWindowEventArgs(e)
    320 
    321172    local name = we.window:getName()
    322173
    323    
    324 
    325174    local match = string.gmatch(name, "%d+")
    326 
    327175    local commandNr = tonumber(match())
    328 
    329176    local buttonNr = tonumber(match())
    330    
    331177 
    332178    orxonox.KeyBinderManager:getInstance():unbind(orxonox.KeyBinderManager:getInstance():getCurrent():getBinding(commandList[commandNr], buttonNr))
    333179
    334    
    335 
    336180    P.callback()
    337 
    338 end
    339 
    340 
     181end
    341182
    342183function P.keybind(arguments)
    343 
    344184    local commandNr = arguments[1]
    345 
    346185    local buttonNr = arguments[2]
    347 
    348186    if buttonNr ~= nil then
    349 
    350187        orxonox.KeyBinderManager:getInstance():unbind(orxonox.KeyBinderManager:getInstance():getCurrent():getBinding(commandList[commandNr], buttonNr))
    351 
    352     end
    353 
     188    end
    354189
    355190    orxonox.KeyBinderManager:getInstance():keybind(commandList[commandNr])
    356 
    357 end
    358 
    359 
     191end
    360192
    361193function P.callback()
    362 
    363194    while table.getn(linesList) ~= 0 do
    364 
    365195        if linesList[1] ~= nil then
    366 
    367196            winMgr:destroyWindow(linesList[1]:getName())
    368 
    369197        end
    370 
    371198        table.remove(linesList, 1)
    372 
    373     end
    374 
    375    
     199    end
    376200
    377201    linesList = {}
    378202
    379 
    380203    P.createLines()
    381 
    382204    if(InfoPopup ~= nil) then
    383 
    384205        InfoPopup.close()
    385 
    386     end
    387 
    388 end
    389 
    390 
     206    end
     207end
    391208
    392209function P.KeyBindBackButton_clicked(e)
    393 
    394210    hideGUI("KeyBindMenu")
    395 
    396 end
    397 
    398 
     211end
    399212
    400213return P
    401 
Note: See TracChangeset for help on using the changeset viewer.