local scheduler = require(cc.PACKAGE_NAME .. ".scheduler") local TestScene = class("TestScene", function() return display.newScene("TestScene") end) function TestScene:ctor() self.cursors = {} self.sprite=display.newSprite("background.png",display.cx,display.cy):addTo(self) self.sprite:setTouchEnabled(true) self.sprite:setTouchMode(cc.TOUCH_MODE_ALL_AT_ONCE) self.sprite:addNodeEventListener(cc.NODE_TOUCH_EVENT, function(event) if event.name == "began" or event.name == "added" then for id, point in pairs(event.points) do local cursor=point self.cursors[id] = cursor end elseif event.name == "moved" then elseif event.name == "removed" then for id, point in pairs(event.points) do --self.cursors[id]:removeSelf() --self.cursors[id] self.cursors[id] = nil end else --[[ for _, cursor in pairs(self.cursors) do cursor:removeSelf() end ]] self.cursors = {} end if event.name == "ended" or event.name == "cancelled" then end return true end) cc.ui.UILabel.new({ UILabelType = 2, text = "QuickGame3", size = 64}) :align(display.CENTER, display.cx, display.cy+80) :addTo(self) self.label=cc.ui.UILabel.new({ UILabelType = 2, text = "Hello, World", size = 64}) :align(display.CENTER, display.cx, display.cy) :addTo(self) -- add listener self:addNodeEventListener(cc.NODE_ENTER_FRAME_EVENT,handler(self , self.update)) self:scheduleUpdate() end function TestScene:update( dt ) local sum=0 for id, point in pairs(self.cursors) do sum=sum+1 end self.label:setString(tostring(sum)) end return TestScene