Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Graphics 2.0 Snapshot - fast update problem?
Started by jwnder Mar 02 2014 11:26 PM

No replies to this topic
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

jwnder

[GLOBAL: userInfoPane.html]
jwnder
  • Observer

  • 1 posts
  • Corona SDK

I had some troubles when i am create a snapshot and then add a moving body inside it.

It seems that there is a problem updating the position of the body continously.

 

Is a bug?

 

local w = display.contentWidth
local h = display.contentHeight 
local cx = display.contentCenterX
local cy = display.contentCenterY 

local snapshot = display.newSnapshot(w,h)
snapshot:translate( cx, cy ) 
--display.setDrawMode( "forceRender" )
--snapshot.canvasMode = "discard"
 
local obj = display.newRect( 0, 0, 20, 20 )
obj.x = 0; obj.y = 0;
snapshot.canvas:insert(obj);
snapshot:invalidate("canvas")

local function update()
	local nx, ny = obj.x, obj.y;
	
	obj.x = nx + 1;
	obj.y = ny + 1;
	snapshot:invalidate("canvas")
end

Runtime:addEventListener( "enterFrame", update );


 




[topic_controls]
[/topic_controls]