Android threads trouble wrapping my head around design
Posted
by
semajhan
on Game Development
See other posts from Game Development
or by semajhan
Published on 2011-01-14T23:16:18Z
Indexed on
2011/01/15
0:00 UTC
Read the original article
Hit count: 358
I am having trouble wrapping my head around game design. On the android platform, I have an activity and set its content view with a custom surface view. The custom surface view acts as my panel and I create instances of all classes and do all the drawing and calculation in there.
Question: Should I instead create the instances of other classes in my activity?
Now I create a custom thread class that handles the game loop.
Question: How do I use this one class in all my activities? Or do I have to create a separate thread each time?
In my previous game, I had multiple levels that had to create an instance of the thread class and in the thread class I had to set constructor methods for each separate level and in the loop use a switch statement to check which level it needs to render and update. Sorry if that sounds confusing.
I just want to know if the method I am using is inefficient (which it probably is) and how to go about designing it the correct way. I have read many tutorials out there and I am still having lots of trouble with this particular topic. Maybe a link to a some tutorials that explain this? Thanks.
© Game Development or respective owner