Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 15, 2011, 9:09:58 PM (14 years ago)
Author:
dafrick
Message:

Reverting changes made in revision 8035, that based the menu navigation on console commands, due to implemential difficulties of the hacks to make menu navigation work fully.
So, at the moment, we'll have to make due with the old version of the menu navigation implementation.

Location:
code/branches/usability/data/gui/scripts
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/usability/data/gui/scripts/GUISheet.lua

    r8035 r8078  
    2929
    3030-- Override this function if you want to react on keystrokes
    31 function P:onKeyPressed(mode)
     31function P:onKeyPressed()
    3232end
    3333
     
    8585
    8686-- Handles key pressed while the gui sheed is displayed
    87 function P:keyPressed(mode)
     87function P:keyPressed()
    8888    if self.buttons then
    89         if mode == "down" then     -- key down
     89        if code == "208" then     -- key down
    9090            self:moveSelectionRow(1)
    91         elseif mode == "up" then -- key up
     91        elseif code == "200" then -- key up
    9292            self:moveSelectionRow(-1)
    93         elseif mode == "right" then -- key right
     93        elseif code == "205" then -- key right
    9494            self:moveSelectionColumn(1)
    95         elseif mode == "left" then -- key left
     95        elseif code == "203" then -- key left
    9696            self:moveSelectionColumn(-1)
    97         elseif mode == "enter" then -- key enter or key numpad enter
     97        elseif code == "28" or code == "156" then -- key enter or key numpad enter
    9898            self:pressSelectedButton()
    9999        end
    100100    end
    101101
    102     self:onKeyPressed(mode)
     102    self:onKeyPressed()
    103103end
    104104
  • code/branches/usability/data/gui/scripts/GraphicsMenu.lua

    r8035 r8078  
    11-- GraphicsMenu.lua
    22
    3 local P = createMenuSheet("GraphicsMenu", true, TriBool.True, TriBool.True)
     3local P = createMenuSheet("GraphicsMenu")
    44
    55P.resolutionList = {"custom", "640 x 480", "720 x 480", "720 x 576", "800 x 600", "1024 x 600", "1024 x 768", "1152 x 864", "1280 x 720", "1280 x 800", "1280 x 960", "1280 x 1024", "1360 x 768", "1440 x 900", "1600 x 900", "1600 x 1200", "1680 x 1050"}
  • code/branches/usability/data/gui/scripts/MenuSheet.lua

    r8035 r8078  
    1616    newSheet.bHidePrevious  = handleDefArg(_bHidePrevious,  true)
    1717    newSheet.tShowCursor    = handleDefArg(_tShowCusor,     TriBool.True)
    18     newSheet.tUseKeyboard   = handleDefArg(_tUseKeyboard,   TriBool.Dontcare)
     18    newSheet.tUseKeyboard   = handleDefArg(_tUseKeyboard,   TriBool.True)
    1919    newSheet.bBlockJoyStick = handleDefArg(_bBlockJoyStick, false)
    2020
  • code/branches/usability/data/gui/scripts/SheetManager.lua

    r8035 r8078  
    55local activeMenuSheets = {size = 0, topSheetTuple = nil}
    66local menuSheetsRoot = guiMgr:getMenuRootWindow()
     7local bInGameConsoleClosed = false
    78local mainMenuLoaded = false
    8 --orxonox.GUIManager:subscribeEventHelper(menuSheetsRoot, "KeyDown", "keyPressed")
     9orxonox.GUIManager:subscribeEventHelper(menuSheetsRoot, "KeyDown", "keyPressed")
    910orxonox.GUIManager:subscribeEventHelper(menuSheetsRoot, "Sized", "windowResized")
    1011
     
    131132    if previous and previous.pressedEnter and menuSheet:hasSelection() == false then
    132133        menuSheet:setSelectionNear(1, 1)
    133     end
    134 
    135     if activeMenuSheets.size > 0 then
    136         guiMgr:guisActiveChanged(true)
    137134    end
    138135
     
    207204    end
    208205
    209     if activeMenuSheets.size == 0 then
    210         guiMgr:guisActiveChanged(false)
    211     end
    212 
    213206    sheetTuple.sheet:quit()
    214207end
     
    224217    -- HUGE, very HUGE hacks!
    225218
    226     -- Count the number of sheets that don't need input until the first that does.
     219    -- If the InGameConsole is active, ignore the ESC command.
     220    if bInGameConsoleClosed == true then
     221        bInGameConsoleClosed = false
     222        return
     223    end
     224
     225    -- Count the number of sheets that don't need input till the first that does.
    227226    local counter = noInputSheetIndex()
    228227
     
    238237end
    239238
    240 -- Function to navigate the GUI, is called by the GUIManager, whenever a relevant key is pressed.
    241 -- The mode specifies the action to be taken.
    242 function navigateGUI(mode)
     239function keyPressed(e)
     240    local we = tolua.cast(e, "CEGUI::KeyEventArgs")
    243241    local sheet = activeMenuSheets[activeMenuSheets.size]
    244     sheet.sheet:keyPressed(mode)
     242    code = tostring(we.scancode)
     243    -- Some preprocessing
     244    if not mainMenuLoaded and not sheet.bNoInput then
     245        if code == "1" then
     246            keyESC()
     247        elseif code == "0"then
     248            orxonox.CommandExecutor:execute("InGameConsole openConsole")
     249        end
     250    end
     251    sheet.sheet:keyPressed()
    245252end
    246253
     
    286293    end
    287294    return counter
     295end
     296
     297function inGameConsoleClosed()
     298    bInGameConsoleClosed = not bInGameConsoleClosed;
    288299end
    289300
Note: See TracChangeset for help on using the changeset viewer.