print ("Viewport Test")
local pixel = Pixel.new(0,1,105,107)
pixel:setPosition(51,61)
stage:addChild(pixel)
print("Pixel", pixel:getX(), pixel:getY(), "-", pixel:getWidth(), pixel:getHeight(), "-", pixel:getBounds(stage))
print(pixel:hitTestPoint(110, 110))
local bg = Pixel.new(0xFFAABB,0.5,200,200)
bg:setPosition(212,211)
stage:addChild(bg)
print(bg:getBounds(bg))
print("Background", bg:getX(), bg:getY(), "-", bg:getWidth(), bg:getHeight(), "-", bg:getBounds(stage))
print(bg:hitTestPoint(220, 222))
local vp = Viewport.new()
vp:setClip(0,0,100,100)
vp:setContent(pixel)
vp:setPosition(212, 211)
stage:addChild(vp)
print("Viewport", vp:getX(), vp:getY(), "-", vp:getWidth(), vp:getHeight(), "-", vp:getBounds(stage))
print(vp:hitTestPoint(220, 222))
Comments