I'm trying to learn about Android programming by rewriting a C app
I've moved from DOS to X-windows to Windows as a learning tool.  It's
just a silly little app that draws symmetrical 'game of life' patterns
on the screen in a kaleidoscopic fashion.  It's structured so that the
patterns do their own animations.  I.e. there's a 'Life' class that
produces the next generation and redraws itself from the center
outward, inserting delays to produce a kaleidoscopic effect.

I've got it so that the patterns draw - I took the LunarLander sample
as a starting point, and an drawing on a SurfaceView.  But my problem
is with timing the 'animations'.  I'm not doing traditional animation,
where I build a whole frame and then draw it, but  the surface seems
to want to draw itself completely on each iteration of my loop, so my
inserted sleep's don't insert delay in the right places.

So my questions:

1. Is there a more direct way to write to the screen than via a
SurfaceView?  If I did that, would the various steps of my 'animation'
occur as I drew them, producing the desired effect.
2. If such a drawing method exists, would I be wasting my time
learning how to use it?
3. What's the 'standard' way to do this kind of animation?

Thanks.

By the way, my main loop (lifted from the LunarLandar example) looks
like:

        public void run() {
            while (mRun) {
                mCanvas = null;
                try {
                    mCanvas = mSurfaceHolder.lockCanvas(null);
                    synchronized (mSurfaceHolder) {
                        if (mMode == STATE_RUNNING)
                            doUpdate();
                        doDraw();
                    }
                } finally {
                    if (mCanvas != null) {
                        mSurfaceHolder.unlockCanvasAndPost(mCanvas);
                        mCanvas = null;
                    }
                }
            }
        }


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

Reply via email to