KeyPress

From OxeyeWiki

Revision as of 14:34, 29 January 2010 by Jeb (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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