Sunday, July 3, 2011

Re: [android-developers] game engine, how to organize animation and etc. in android ?

You should use the method invalidate() inside a view:

@Override
protected void onDraw (Canvas canvas) 
{
        invalidate();

        // Do all your drawings here

        invalidate();

First, it tells android that the whole screen should be redrawn, afterwards it tells android that the screen should be redrawn again with the drawings you did.

2011/7/3 razor <razorjackes@gmail.com>
Hi.

I'm quite new to android and i want to make some animation (simple
game later) like i did on windows (all programatically).
So I have questions what classes should be responsible for.

Activity
It's a base class for whole logic like updating variables (computing
move etc.)
Should I create a new Thread on onCreate and run it onResume ? (I need
continuous computing for moving objects)

View
Only for drawing animation
onDraw method for clearing Canvas (how to do this quickly? drawRect is
efficent ? ) and drawing objects.
Should I invalidate that view or just call onDraw 30 times per second?

Regards
razor

--
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+unsubscribe@googlegroups.com
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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment