Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Scrolling background performance — Gideros Forum

Scrolling background performance

totebototebo Member
edited October 2015 in General questions
I'm using textured shapes for a scrolling background. There is a 100ms pause each time I run the code below, which happens in game when I want to load new background blocks. Could I use meshes, or something else, to reduce this delay?
	self.current_background_id = self.current_background_id + 1
 
	local texture_current_bg = Texture.new("gfx_tiled/bg"..self.current_background_id..".png", true, {wrap = Texture.REPEAT})
	local texture_width = texture_current_bg:getWidth()
	local minimum_width = application:getLogicalWidth()*2
	local minimum_repeats = math.toint((minimum_width/texture_width)+3)
	local w = texture_width*minimum_repeats
	local h = texture_current_bg:getHeight() 
	local shape_bg = Shape.new()
	shape_bg:setFillStyle(Shape.TEXTURE, texture_current_bg)
	shape_bg:beginPath()
	shape_bg:moveTo(0,0)
	shape_bg:lineTo(w, 0)
	shape_bg:lineTo(w, -h)
	shape_bg:lineTo(0, -h)
	shape_bg:lineTo(0, 0)
	shape_bg:endPath()
My Gideros games: www.totebo.com

Comments

Sign In or Register to comment.