KeyPress

From OxeyeWiki

(Difference between revisions)
Jump to: navigation, search
Jeb (Talk | contribs)
(Created page with '{{EngineHook| keyPress(key) | This hook is called when-ever the user presses a key. You can also get current key states using daisy.isKeyPressed(). | {{MethodPar...')

Latest revision as of 14:34, 29 January 2010

keyPress(key)

This hook is called when-ever the user presses a key. You can also get current key states using daisy.isKeyPressed().

Parameter Type Description
key An integer The key that was pressed. See KeyCodes for a list of keys.
Daisymoon Video Lib

Example

  local function onKeyPress(key)

    if key == 37 then
       -- LEFT
    elseif key == 38 then
       -- UP
    elseif key == 39 then
       -- RIGHT
    elseif key == 40 then
       -- DOWN
    end

  end

  hook.add("keyPress", onKeyPress)
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox