[android-developers] Re: Performance issues drawing on a canvas

2011-05-24 Thread String
Rather than having people guess at why that might be slow (I can see a handful of possibilities right away), may I suggest you profile it and find out for sure: http://android-developers.blogspot.com/2010/10/traceview-war-story.html String -- You received this message because you are

[android-developers] Re: Performance issues drawing on a canvas

2011-05-24 Thread neuromit
Thank you both for your suggestions, they are really helpful. I was able to optimise my code quite a bit. My collision detection is pretty primitive, so I'll definitely try to improve that. public boolean detectCollision(Point target, int dist) { return (Math.abs(this.x -

[android-developers] Re: Performance issues drawing on a canvas

2011-05-24 Thread neuromit
Also do you mean that they should be split into separate threads or just separate methods? On May 24, 11:25 am, neuromit stuart.lay...@gmail.com wrote: Thank you both for your suggestions, they are really helpful.   I was able to optimise my code quite a bit. My collision detection is pretty

Re: [android-developers] Re: Performance issues drawing on a canvas

2011-05-24 Thread Miguel Morales
Yeah, drawing sprites on a canvas in general is slow. Not to mention with the added collision detection. I would try doing a game-loop for for the animation/calculation and have a single loop for drawing. This makes sure you draw as fast as possible and your calculations run at a steady rate.

Re: [android-developers] Re: Performance issues drawing on a canvas

2011-05-24 Thread Miguel Morales
They should be in separate threads. On Tue, May 24, 2011 at 8:42 AM, neuromit stuart.lay...@gmail.com wrote: Also do you mean that they should be split into separate threads or just separate methods? On May 24, 11:25 am, neuromit stuart.lay...@gmail.com wrote: Thank you both for your

Re: [android-developers] Re: Performance issues drawing on a canvas

2011-05-24 Thread Daniel Drozdzewski
On Tue, May 24, 2011 at 4:25 PM, neuromit stuart.lay...@gmail.com wrote: Thank you both for your suggestions, they are really helpful.   I was able to optimise my code quite a bit. My collision detection is pretty primitive, so I'll definitely try to improve that. public boolean

[android-developers] Re: Performance issues drawing on a canvas

2011-05-24 Thread neuromit
Daniel, thanks for the link, it is VERY informative. Ok I'll separate the code into two loops. Until I get that finished are there problems with detecting how long the drawing/moving takes and then scaling the timeout appropriately? This won't prevent the frame rate from dropping below