Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 9, 2011, 11:27:05 AM (14 years ago)
Author:
dafrick
Message:

Merging latest changes in usability branch into tutorial branch.

Location:
code/branches/tutorial
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/tutorial

  • code/branches/tutorial/data/gui/scripts/GUISheet.lua

    r7928 r8051  
    2828end
    2929
     30-- Override this function if you want to react on keystrokes
     31function P:onKeyPressed(mode)
     32end
     33
     34-- Override this function if you want to update the gui after the window was resized
     35function P:onWindowResized()
     36end
     37
    3038-- show function for the GUI
    3139function P:show()
     
    7785
    7886-- Handles key pressed while the gui sheed is displayed
    79 function P:keyPressed()
     87function P:keyPressed(mode)
    8088    if self.buttons then
    81         if code == "208" then     -- key down
     89        if mode == "down" then     -- key down
    8290            self:moveSelectionRow(1)
    83         elseif code == "200" then -- key up
     91        elseif mode == "up" then -- key up
    8492            self:moveSelectionRow(-1)
    85         elseif code == "205" then -- key right
     93        elseif mode == "right" then -- key right
    8694            self:moveSelectionColumn(1)
    87         elseif code == "203" then -- key left
     95        elseif mode == "left" then -- key left
    8896            self:moveSelectionColumn(-1)
    89         elseif code == "28"  then -- key enter
     97        elseif mode == "enter" then -- key enter or key numpad enter
    9098            self:pressSelectedButton()
    9199        end
    92100    end
    93101
    94     self.onKeyPressed()
    95 end
    96 
    97 -- Override this function if you want to ract on keystrokes
    98 function P:onKeyPressed()
     102    self:onKeyPressed(mode)
     103end
     104
     105function P:windowResized()
     106    self:onWindowResized()
    99107end
    100108
Note: See TracChangeset for help on using the changeset viewer.