https://github.com/dmccuskey/dmc-touchmanager
Enables true multitouch capability in the Corona SDK
https://github.com/dmccuskey/dmc-touchmanager
Last synced: about 1 year ago
JSON representation
Enables true multitouch capability in the Corona SDK
- Host: GitHub
- URL: https://github.com/dmccuskey/dmc-touchmanager
- Owner: dmccuskey
- License: mit
- Created: 2015-02-07T08:14:58.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2015-04-29T15:46:49.000Z (over 11 years ago)
- Last Synced: 2025-05-07T13:58:20.815Z (over 1 year ago)
- Language: Lua
- Homepage: docs.davidmccuskey.com/dmc-touchmanager
- Size: 246 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# dmc-touchmanager
Brings true multi-touch to the Corona SDK
This module was created because to patch the current multitouch capability in Corona SDK so it functions as expected.
Examples can be found in the directory `examples`
**Simple Function Handler Example**
```lua
local TouchMgr = require 'dmc_touchmanager'
-- setup our function-type event call
--
local handler = function( event )
if event.phase == 'began' then
-- set focus if the object (target) wants to
-- always receive this event (blocking all others)
TouchMgr:setFocus( event.target, event.id )
return true
end
if not event.isFocused then return end
if event.phase == 'moved' then
-- handle 'moved' event
elseif event.phase=='cancelled' or event.phase=='ended' then
-- handle 'ended'/'cancelled' event
-- be sure to unset focus
TouchMgr:unsetFocus( event.target, event.id )
end
return true
end
local o = display.newRect( 350, 700, 300, 300 )
o:setFillColor( 1, 1, 1 )
TouchMgr:register( o, handler )
```