Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 13, 2009, 1:12:13 PM (15 years ago)
Author:
cmueri
Message:

All the menus (inclusive InGameMenus) have an equal design, some menus have a larger window. They should be ready to presentate now.
BUG REPORT in KeyBindMenu: If there are >4 buttons in a row, the GUI doesn't show those correctly.

Location:
code/branches/presentation2/data/gui/scripts
Files:
1 deleted
3 edited

Legend:

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

    r6235 r6334  
    3737    effectsmutewindow:setSelected(effectsmute)
    3838    choice = "Default"
    39     dropdownwindow = winMgr:getWindow("orxonox/AudioThemeCombobox")
     39    listboxwindow = winMgr:getWindow("orxonox/AudioThemeListbox")
    4040    local themeList = {}
    4141    table.insert(themeList, "Default")
     
    4444        item = CEGUI.createListboxTextItem(v)       
    4545        item:setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush")
    46         CEGUI.toCombobox(dropdownwindow):addItem(item)
     46        CEGUI.toListbox(listboxwindow):addItem(item)
    4747    end
    48     dropdownwindow:setItemSelectState(0,true)
    4948end
    5049
     
    165164end
    166165
    167 function P.AudioThemeCombobox_changed(e)
    168     if dropdownwindow:isItemSelected(1) then
     166function P.AudioThemeListbox_changed(e)
     167    if listboxwindow:isItemSelected(1) then
    169168        orxonox.CommandExecutor:execute("setMood dnb")
    170169    else
  • code/branches/presentation2/data/gui/scripts/InfoPopup.lua

    r6311 r6334  
    11-- InfoPopup.lua
     2
     3
    24
    35BasicGUI = require("BasicGUI")
    46local P = BasicGUI:new() --inherit everything from the gui package
     7
     8
    59if _REQUIREDNAME == nil then
     10
    611    InfoPopup = P
     12
    713else
     14
    815    _G[_REQUIREDNAME] = P
     16
    917end
    1018
     19
     20
    1121P.filename = "InfoPopup"
     22
    1223P.layoutString = "InfoPopup.layout"
    1324
     25
     26
    1427function P:init()
     28
    1529end
    1630
     31
     32
    1733function P.execute(functionPtr, arguments)
     34
    1835    if functionPtr ~= nil then
     36
    1937        if arguments ~= nil then
     38
    2039            functionPtr(arguments)
     40
    2141        else
     42
    2243            functionPtr()
     44
    2345        end
     46
    2447    end
     48
    2549end
    2650
     51
     52
    2753function P.setText( text )
     54
    2855    winMgr:getWindow("orxonox/InfoPopup_text"):setText( text )
     56
    2957end
    3058
     59
     60
    3161function P.setCloseButton(closeButton)
     62
    3263    close = winMgr:getWindow("orxonox/InfoPopup_close")
     64
    3365    close:setVisible(closeButton)
     66
    3467    if(not closeButton) then
     68
    3569        close:deactivate();
     70
    3671    else
     72
    3773        close:activate();
     74
    3875    end
     76
    3977end
    4078
     79
     80
    4181-- events for ingamemenu
     82
     83
    4284function P.close(e)
     85
    4386    hideGUI("InfoPopup")
     87
    4488end
     89
     90
    4591
    4692return P
  • code/branches/presentation2/data/gui/scripts/KeyBindMenu.lua

    r6324 r6334  
    11-- KeyBindMenu.lua
    22
     3
     4
    35BasicGUI = require("BasicGUI")
     6
    47local P = BasicGUI:new() --inherit everything from the gui package
     8
     9
    510if _REQUIREDNAME == nil then
     11
    612    KeyBindMenu = P
     13
    714else
    815    _G[_REQUIREDNAME] = P
    9 end
     16
     17end
     18
     19
    1020
    1121P.filename = "KeyBindMenu"
     22
    1223P.layoutString = "KeyBindMenu.layout"
    1324
     25
     26
    1427function P:init()
     28
    1529    commandList = {}
     30
    1631    table.insert(commandList, "fire 0")
     32
    1733    table.insert(commandList, "fire 1 | unfire")
     34
    1835    table.insert(commandList, "onpress fire 2")
     36
    1937    table.insert(commandList, "scale 1 moveFrontBack")
     38
    2039    table.insert(commandList, "scale -1 moveFrontBack")
     40
    2141    table.insert(commandList, "boost")
     42
    2243    table.insert(commandList, "scale 1 moveRightLeft")
     44
    2345    table.insert(commandList, "scale -1 moveRightLeft")
     46
    2447    table.insert(commandList, "scale 1 moveUpDown")
     48
    2549    table.insert(commandList, "scale -1 moveUpDown")
     50
    2651    table.insert(commandList, "scale 1 rotateRoll")
     52
    2753    table.insert(commandList, "scale -1 rotateRoll")
     54
    2855    table.insert(commandList, "switchCamera")
     56
    2957    table.insert(commandList, "openConsole")
     58
    3059    table.insert(commandList, "OverlayGroup toggleVisibility Debug")
     60
    3161    table.insert(commandList, "OverlayGroup toggleVisibility Stats")
     62
    3263    table.insert(commandList, "mouseLook")
     64
    3365    table.insert(commandList, "pause")
    34    
     66
     67   
     68
    3569    nameList = {}
     70
    3671    table.insert(nameList, "Primary Fire")
     72
    3773    table.insert(nameList, "Secondary Fire")
     74
    3875    table.insert(nameList, "Fire Rocket")
     76
    3977    table.insert(nameList, "Accelerate")
     78
    4079    table.insert(nameList, "Break")
    4180    table.insert(nameList, "Boost")
     81
    4282    table.insert(nameList, "Move Right")
     83
    4384    table.insert(nameList, "Move Left")
     85
    4486    table.insert(nameList, "Move Up")
     87
    4588    table.insert(nameList, "Move Down")
     89
    4690    table.insert(nameList, "Roll Right")
     91
    4792    table.insert(nameList, "Roll Left")
     93
    4894    table.insert(nameList, "Switch Camera")
     95
    4996    table.insert(nameList, "Open Console")
     97
    5098    table.insert(nameList, "Show Debug")
     99
    51100    table.insert(nameList, "Show Stats")
     101
    52102    table.insert(nameList, "Look Around")
     103
    53104    table.insert(nameList, "Pause")
    54    
     105
     106   
     107
    55108    linesList = {}
    56109
    57     lineHeight = 35
    58     commandWidth = 200
    59     buttonWidth = 170
     110
     111    lineHeight = 25
     112    commandWidth = 125
     113    buttonWidth = 125
    60114    clearWidth = 20
     115    addWidth = 25
     116
    61117    spaceWidth = 10
    62    
     118
     119   
     120
    63121    P.createLines()
    64    
     122
     123   
     124
    65125    local funct = luaState:createLuaFunctor("KeyBindMenu.callback()")
     126
    66127    orxonox.KeyBinderManager:getInstance():registerKeybindCallback(funct)
    67 end
     128
     129end
     130
     131
    68132
    69133
    70134function P.KeyNameNiceifier(key)
     135
    71136    local name = string.sub(key, string.find(key, '%.(.*)')+1)
    72137    local group = string.sub(key, string.find(key, '(.*)%.'))
     138
    73139    group = string.sub(group,1,string.len(group)-1)
     140
    74141    if( group == "Keys") then
     142
    75143        return "Key " .. string.sub(name, string.find(name, 'Key(.*)')+3)
     144
    76145    elseif( group == "MouseButtons") then
     146
    77147        return "Mouse " .. name
    78     end
     148
     149    end
     150
    79151    return key
    80 end
     152
     153end
     154
     155
    81156
    82157function P.createLine(k)
     158
    83159    local offset = 0
     160
    84161    local line = winMgr:createWindow("DefaultWindow", "orxonox/KeyBindPane/Binding" .. k)
     162
    85163    line:setHeight(CEGUI.UDim(0, lineHeight))
     164
    86165    line:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, lineHeight*(k-1))))
    87    
     166
     167   
     168
    88169    local command = winMgr:createWindow("TaharezLook/StaticText", "orxonox/KeyBindPane/Binding" .. k .. "/Command")
    89     command:setSize(CEGUI.UVector2(CEGUI.UDim(0, commandWidth), CEGUI.UDim(0.9, 0)))
    90     command:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.05, 0)))
     170
     171    command:setSize(CEGUI.UVector2(CEGUI.UDim(0, commandWidth), CEGUI.UDim(1, 0)))
     172
     173    command:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0, 0)))
     174
    91175    command:setText(nameList[k])
    92176    line:addChildWindow(command)
     177
    93178    offset = offset + commandWidth + spaceWidth
    94    
     179
     180   
     181
    95182    local plus = winMgr:createWindow("TaharezLook/TabButton", "orxonox/KeyBindPane/Binding" .. k .. "/Plus")
    96     plus:setSize(CEGUI.UVector2(CEGUI.UDim(0, clearWidth), CEGUI.UDim(0.7, 0)))
     183
     184    plus:setSize(CEGUI.UVector2(CEGUI.UDim(0, addWidth), CEGUI.UDim(0.7, 0)))
     185
    97186    plus:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.15, 0)))
    98     plus:setText("+")
     187
     188    plus:setText("add")
     189
    99190    orxonox.KeyBinderManager:getInstance():subscribeEventHelper(plus, "Clicked", P.filename .. ".KeyBindPlus_clicked")
     191
    100192    line:addChildWindow(plus)
    101     offset = offset + clearWidth + spaceWidth
    102    
     193
     194    offset = offset + addWidth + spaceWidth
     195
     196   
     197
    103198    local numButtons = orxonox.KeyBinderManager:getInstance():getCurrent():getNumberOfBindings(commandList[k]);
     199
    104200    for i=0,(numButtons-1) do
     201
    105202        local button = winMgr:createWindow("TaharezLook/TabButton", "orxonox/KeyBindPane/Binding" .. k .. "/Button" .. i)
     203
    106204        button:setSize(CEGUI.UVector2(CEGUI.UDim(0, buttonWidth), CEGUI.UDim(0.7, 0)))
     205
    107206        button:setPosition(CEGUI.UVector2(CEGUI.UDim(0, offset), CEGUI.UDim(0.15, 0)))
     207
    108208        local name = orxonox.KeyBinderManager:getInstance():getCurrent():getBinding(commandList[k],i)
     209
    109210        name = P.KeyNameNiceifier(name)
     211
    110212        button:setText(name)
     213
    111214        orxonox.KeyBinderManager:getInstance():subscribeEventHelper(button, "Clicked", P.filename .. ".KeyBindButton_clicked")
     215
    112216        --button:subscribeScriptedEvent("EventClicked", P.filename .. ".KeyBindButton_clicked")
     217
    113218        line:addChildWindow(button)
     219
    114220        offset = offset + buttonWidth
     221
    115222       
     223
    116224        local clear = winMgr:createWindow("TaharezLook/TabButton", "orxonox/KeyBindPane/Binding" .. k .. "/Clear" .. i)
     225
    117226        clear:setSize(CEGUI.UVector2(CEGUI.UDim(0, clearWidth), CEGUI.UDim(0.7, 0)))
     227
    118228        clear:setPosition(CEGUI.UVector2(CEGUI.UDim(0, (i*(buttonWidth+clearWidth+spaceWidth)+buttonWidth)+commandWidth+clearWidth+2*spaceWidth), CEGUI.UDim(0.15, 0)))
     229
    119230        clear:setText("X")
     231
    120232        orxonox.KeyBinderManager:getInstance():subscribeEventHelper(clear, "Clicked", P.filename .. ".KeyBindClear_clicked")
     233
    121234        line:addChildWindow(clear)
     235
    122236        offset = offset + clearWidth + spaceWidth
    123     end
    124    
     237
     238    end
     239
     240   
     241
    125242    line:setWidth(CEGUI.UDim(0, offset+clearWidth))
    126    
     243
     244   
     245
    127246    return line
    128 end
     247
     248end
     249
     250
    129251
    130252function P.createLines()
    131253
     254
    132255    local window = winMgr:getWindow("orxonox/KeyBindPane")
    133256
     257
    134258    for k,v in pairs(commandList) do
     259
    135260        local line = P.createLine(k)
     261
    136262        table.insert(linesList, line)
     263
    137264        window:addChildWindow(line)
    138     end
    139 
    140 end
     265
     266    end
     267
     268
     269end
     270
     271
    141272
    142273function P.KeyBindButton_clicked(e)
     274
    143275    local we = CEGUI.toWindowEventArgs(e)
     276
    144277    local name = we.window:getName()
    145278
     279
    146280    local match = string.gmatch(name, "%d+")
     281
    147282    local commandNr = tonumber(match())
     283
    148284    local buttonNr = tonumber(match())
    149    
     285
     286   
     287
    150288    local arguments = {}
     289
    151290    arguments[1] = commandNr
     291
    152292    arguments[2] = buttonNr
     293
    153294    openInfoPopup("Press any button/key or move a mouse/joystick axis.", KeyBindMenu.keybind, false, arguments)
    154295end
    155296
    156297function P.KeyBindPlus_clicked(e)
     298
    157299    local we = CEGUI.toWindowEventArgs(e)
     300
    158301    local name = we.window:getName()
    159    
     302
     303   
     304
    160305    local match = string.gmatch(name, "%d+")
     306
    161307    local commandNr = tonumber(match())
    162308   
     309
    163310    local arguments = {}
     311
    164312    arguments[1] = commandNr
     313
    165314    openInfoPopup("Press any button/key or move a mouse/joystick axis.", KeyBindMenu.keybind, false, arguments)
    166315end
    167316
    168317function P.KeyBindClear_clicked(e)
     318
    169319    local we = CEGUI.toWindowEventArgs(e)
     320
    170321    local name = we.window:getName()
    171    
     322
     323   
     324
    172325    local match = string.gmatch(name, "%d+")
     326
    173327    local commandNr = tonumber(match())
     328
    174329    local buttonNr = tonumber(match())
    175330   
     331 
    176332    orxonox.KeyBinderManager:getInstance():unbind(orxonox.KeyBinderManager:getInstance():getCurrent():getBinding(commandList[commandNr], buttonNr))
    177    
     333
     334   
     335
    178336    P.callback()
    179 end
     337
     338end
     339
     340
    180341
    181342function P.keybind(arguments)
     343
    182344    local commandNr = arguments[1]
     345
    183346    local buttonNr = arguments[2]
     347
    184348    if buttonNr ~= nil then
     349
    185350        orxonox.KeyBinderManager:getInstance():unbind(orxonox.KeyBinderManager:getInstance():getCurrent():getBinding(commandList[commandNr], buttonNr))
    186     end
     351
     352    end
     353
     354
    187355    orxonox.KeyBinderManager:getInstance():keybind(commandList[commandNr])
    188 end
     356
     357end
     358
     359
    189360
    190361function P.callback()
     362
    191363    while table.getn(linesList) ~= 0 do
     364
    192365        if linesList[1] ~= nil then
     366
    193367            winMgr:destroyWindow(linesList[1]:getName())
     368
    194369        end
     370
    195371        table.remove(linesList, 1)
    196     end
    197    
     372
     373    end
     374
     375   
     376
    198377    linesList = {}
    199378
     379
    200380    P.createLines()
    201    
     381
    202382    if(InfoPopup ~= nil) then
     383
    203384        InfoPopup.close()
    204     end
    205 end
     385
     386    end
     387
     388end
     389
     390
    206391
    207392function P.KeyBindBackButton_clicked(e)
     393
    208394    hideGUI("KeyBindMenu")
    209 end
     395
     396end
     397
     398
    210399
    211400return P
Note: See TracChangeset for help on using the changeset viewer.