This brings me back some years! I remember when trying to dabble in this
area of game/graphics drawing, thinking to myself.. if I have multiple
objects on the screen, and one goes behind another, I don't want to draw the
one behind it. It should speed things up a bit. I never could figure out how
to do it right. I was just doing a loop and drawing everything as fast I
could, not using a timing loop like 60 times a second and trying to get all
the drawing in there each 60th of a second.

I don't know if this is the right way to do this, but I would guess each
"draw" object, be it a background or any object at any layer in between,
would have it's own drawing handler. You would have some sort of logic that
would figure out if a given layer is completely hidden.. obstructed by an
object in a layer above it. However, like I said above, I could never figure
out how you figure out if a given object is completely covering an object
below it. Each object could have transparency sections, like a plane with
windows, where part of the object below it might actually be seen through
the window of the object above it. I always figured draw from bottom up
allowing for transparency so that bottom objects would appear through. This
would of course mean you end up drawing everything, all the time,
completely. I figured that would be faster than trying to figure out code
that would determine if an object was partially hidden or completely hidden
using some sort of algorithm that determines the shape or not. If you could
use a pure square outline, that was fine, but then it wouldn't look right if
you had say a triangle bitmap over a square bitmap.. you'd have to account
for the portion of the square that is visible beyond the triangle edges. I
sucked in math, hence why this sort of stuff always frustrated me.


On Sun, Jan 23, 2011 at 8:17 AM, Paolo Russian <[email protected]>wrote:

> Hello. I thought it was an easy find over all these android forums but
> it seems i cannot find if there is a pre-built way to draw my sprite
> (made up with a couple of shapes) over a static bitmap as background.
> What I currently do is redrawing the background and drawing over same
> canvas the sprite, for each onDraw() event, with some performance
> issues ofcourse.
> I remember some mode 0x13h experiments in old C, so there surely are
> ways to copy-pixels behind the sprite, move the sprite, rederaw the
> copied part of background to cover the old sprite, and draw the new
> sprite position.
> My question is different: is there a way to set up a certain number of
> layers/levels and leave the bitmap on the bottom layer and going on
> erasing-drawing only the sprite in the top layer? That would you
> normally do for instance in actionscript3, you create 2 canvas, and
> operate them individually. But if you want to be old-school you can
> work with copypixel but there is almost never the need.
> But whenever I search for "layers" or "overlays" searches spit out
> GoogleMaps layers coding, MapView overlays stuff which really don't
> matter :D
> So what classes am I missing for doing this very basic thing?
>
> Thanks
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to