* update README

This commit is contained in:
YuLei Liao 2011-11-30 21:55:40 +08:00
parent a680ba4a8a
commit 0874a38baa
1 changed files with 29 additions and 0 deletions

View File

@ -47,6 +47,7 @@ Lua Support FIX Readme
* Remove needless class and functions from tolua++ .pkg files, improved performance
* CCMenuItem support script function
* CCScene script callback
* CCLayer touch & multi-touches events handler
**How to use:**
@ -116,6 +117,34 @@ Lua Support FIX Readme
CCDirector:sharedDirector():runWithScene(myScene)
- - -
-- use CCLayer touch event handler
local layer = CCLayer:node()
local function onTouch(event, x, y)
-- event: CCTOUCHBEGAN, CCTOUCHMOVED, CCTOUCHENDED, CCTOUCHCANCELLED
print(event, x, y)
if event == CCTOUCHBEGAN then return true end
end
layer:registerScriptTouchHandler(onTouch, false)
- - -
-- use CCLayer multi-touches event handler
local layer = CCLayer:node()
local function onTouches(event, points)
-- event: CCTOUCHBEGAN, CCTOUCHMOVED, CCTOUCHENDED, CCTOUCHCANCELLED
print(event)
for i = 1, #points, 2 do
print(string.format("x: 0.2f, y: 0.2f", points[i], points[i + 1]))
end
end
layer:registerScriptTouchHandler(onTouches, true)
**TODO:**