Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Unified Diff: nacltoons/data/res/touch_handler.lua

Issue 15070003: [nacltoons] Add compound shapes. (Closed) Base URL: https://nativeclient-sdk.googlecode.com/svn/trunk/src
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « nacltoons/data/res/sample_game/level3.def ('k') | nacltoons/data/res/util.lua » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: nacltoons/data/res/touch_handler.lua
diff --git a/nacltoons/data/res/touch_handler.lua b/nacltoons/data/res/touch_handler.lua
index c387f93cd63306a42a6d823af786578be683b0d3..e5d1f39b0502af0354298cb38709dc39d9b87703 100644
--- a/nacltoons/data/res/touch_handler.lua
+++ b/nacltoons/data/res/touch_handler.lua
@@ -20,14 +20,16 @@ local touch_state = {
local function FindTaggedBodiesAt(x, y)
local b2pos = util.b2VecFromCocos(ccp(x, y))
local found_bodies = {}
+ local found_something = false
local function handler(body)
+ found_something = true
local tag = body:GetUserData()
if tag ~= 0 then
-- FindBodiesAt can report the same bodies more than
-- once since it reports the body for each fixture that
-- exists at a given point, so filter out duplicates here.
if not found_bodies[tag] then
- util.Log("got body.. " .. tag)
+ util.Log("found body.. " .. tag)
assert(level_obj.object_map[tag])
found_bodies[tag] = level_obj.object_map[tag]
end
@@ -35,6 +37,9 @@ local function FindTaggedBodiesAt(x, y)
end
level_obj.layer:FindBodiesAt(b2pos, handler)
+ if found_something and #found_bodies == 0 then
+ util.Log("Found untagged bodies")
+ end
return found_bodies
end
@@ -64,7 +69,7 @@ local function OnTouchBegan(x, y, touchid)
lasttap_location = { x, y }
tapcount = lasttap_count
- util.Log('tap ' .. tapcount)
+ util.Log('tapcount ' .. tapcount)
local objects = FindTaggedBodiesAt(x, y, 0x1)
« no previous file with comments | « nacltoons/data/res/sample_game/level3.def ('k') | nacltoons/data/res/util.lua » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698