Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 2, 2010, 11:30:44 PM (14 years ago)
Author:
dafrick
Message:

Some improvement on keypressed behaviour. Lua is acting up a little, though, don't yet know why exactly…

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/menu/data/gui/scripts/MainMenu.lua

    r7594 r7607  
    1010    hideAllMenuSheets()
    1111    orxonox.execute("startGame")
     12end
     13
     14function P.onShow()
     15
    1216end
    1317
     
    3236end
    3337
    34 function P.Key_clicked(e)
     38function P.onKeyPressed()
     39    --local we = tolua.cast(e, "CEGUI::KeyEventArgs")
     40    cout(0, code)
     41    if code == "15" then
     42        P.index = P.index + 1
     43        local window = winMgr:getWindow("orxonox/MainMenuBackground")
     44        if P.index == window:getChildCount() then
     45            P.index = 1
     46        end
     47        local child = window:getChildAtIdx(P.index-1)
     48        child:setProperty("NormalImageRightEdge", string.sub(child:getProperty("NormalImageRightEdge"),1,-7) .. "Highlight")
     49        child:setProperty("NormalImageLeftEdge", string.sub(child:getProperty("NormalImageLeftEdge"),1,-7) .. "Highlight")
     50        child:setProperty("NormalImageBackground", string.sub(child:getProperty("NormalImageBackground"),1,-7) .. "Highlight")
     51    elseif code == "28" and P.index ~= 0 then
     52        if P.index == 1 then
     53            P.QuickGameTestButton_clicked()
     54        elseif P.index == 2 then
     55            P.SingleplayerButton_clicked()
     56        elseif P.index == 3 then
     57            P.MultiplayerButton_clicked()
     58        elseif P.index == 4 then
     59            P.SettingsButton_clicked()
     60        elseif P.index == 5 then
     61            P.CreditsButton_clicked()
     62        elseif P.index == 6 then
     63            P.ExitButton_clicked()
     64        end
     65    end
     66end
     67
     68--[[function P.Key_clicked(e)
    3569    local we = tolua.cast(e, "CEGUI::KeyEventArgs")
    3670    cout(0, tostring(we.scancode))
     
    6094        end
    6195    end
    62 end
     96end]]--
    6397
    6498return P
    65 
Note: See TracChangeset for help on using the changeset viewer.