changed tests/checkerpick.lua to use ag.pickOne() instead of ag.pickObjects() for efficiency

git-svn-id: svn://anubis/anaglym/trunk@311 99a6e188-d820-4881-8870-2d33a10e2619
This commit is contained in:
Josh Holtrop 2010-09-17 14:48:24 +00:00
parent bfb0760ef1
commit ea623bdf65

View File

@ -11,16 +11,14 @@ function init_event()
end
function mouse_motion_event(x, y, xrel, yrel)
objects = ag.pickObjects(x, y)
for i, obj in ipairs(objects) do
if obj == ground then
x = obj.pick_pos[1]
y = obj.pick_pos[2]
xp = 2 * math.floor(x / 2) + 1
yp = 2 * math.floor(y / 2) + 1
if xp >= -3 and xp <= 3 and yp >= -3 and yp <= 3 then
hilite:setPosition(xp, yp, 0.1)
end
local hit = ag.pickOne(x, y, ground)
if hit then
x = ground.pick_pos[1]
y = ground.pick_pos[2]
xp = 2 * math.floor(x / 2) + 1
yp = 2 * math.floor(y / 2) + 1
if xp >= -3 and xp <= 3 and yp >= -3 and yp <= 3 then
hilite:setPosition(xp, yp, 0.1)
end
end
end