Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
More keyboard mapping — Gideros Forum

More keyboard mapping

hoangnamhaihoangnamhai Member
edited April 2012 in Suggestions & requests
Please allow keyboard mapping so that all mobile key can be use when testing on PC local player.
As I test with Gideros v2012.2.2, only the up, down, left, right keys can generate event, there's no way I can create 'Menu', 'Back', 'Search', 'Center' keycode.

Here is the code that I used to test:

-- ------------------------------------------------------------
local keyNames = {
[KeyCode.BACK] = "back",
[KeyCode.SEARCH] = "search",
[KeyCode.MENU] = "menu",
[KeyCode.CENTER] = "center",
[KeyCode.LEFT] = "left",
[KeyCode.UP] = "up",
[KeyCode.RIGHT] = "right",
[KeyCode.DOWN] = "down",
}

-- ------------------------------------------------------------
local function onKeyDown(event)
print("key down: "..keyNames[event.keyCode])
end

local function onKeyUp(event)
print("key up: "..keyNames[event.keyCode])
end

-- ------------------------------------------------------------
-- MAIN
-- ------------------------------------------------------------
stage:setOrientation(Stage.LANDSCAPE_LEFT)
stage:addEventListener(Event.KEY_DOWN, onKeyDown)
stage:addEventListener(Event.KEY_UP, onKeyUp)
Tagged:

Comments

Sign In or Register to comment.