1
local board=director:createSprite(0,200);

for y = 0, w*15, w do
  for x = 0, w*15, w do
    local space = director:createRectangle({x=x, y=y, w=w-1, h=w-1, strokeWidth=0, color=color.grey})

    board:addChild(space)
  end
end

In addition to the above, I have some tiles which should be able to be dragged smoothly..

I was astonished at the performance degradation by adding these 225 static objects to the scenegraph... I was hoping for better performance than this. Am I missing something? Is there a different approach I should be trying? Or is Marmalade Quick just not that quick?

greatwolf
  • 20,287
  • 13
  • 71
  • 105
Tom
  • 7,994
  • 8
  • 45
  • 62
  • How are you measuring performance, and have you tried scaling down your operation and comparing the differences? – Ryan Stein Nov 25 '13 at 03:48
  • The frame rate drops dramatically and the dragging (which worked at a high frame rate before adding these objects) becomes very laggy. Yes, it's proportional to the number of sprites added. – Tom Nov 25 '13 at 03:52
  • Did you try moving the table construction in your inner most loop to outside the loop? – greatwolf Nov 25 '13 at 05:04
  • There wouldn't happen to be anything interacting with these rectangles every frame, would there? Does it become laggier over time, or is the frame rate relatively consistent? – Ryan Stein Nov 25 '13 at 15:23
  • Its not the loop that's slow.. its the effect these 225 rectangles have on the performance. – Tom Nov 28 '13 at 02:06
  • I am just trying to drag another rectangle over them... Its laggy from the start – Tom Nov 28 '13 at 02:07
  • Could it be possible that it's because they're all children of `board`? – Ryan Stein Nov 28 '13 at 15:40

0 Answers0