1
\$\begingroup\$

Well I've finnaly decided to start Android game dev, and my first project will be simple 2d canvas based game. I have some experience in game developing with C# and XNA, and I'm a bit confused now. Back in XNA we have Game class with Initialize, Update and Draw methods.

In Android I have to extend SurfaceView class, run draw and update in their own thread, and receive touch input from user.

I'm looking for a proper way to structure my code.

Some of my questions are :

  • How to deal with Activities (Should I run everything in one activity, or split whole game in 2 or more) ?
  • Where should I run game loop ?
  • Where to put Draw and Update methods ?
  • How to respond to touch events ?

Hope I came to the right place for answers...

\$\endgroup\$
2
  • 1
    \$\begingroup\$ I suggest you want to look at LibGDX. Just like XNA it's a library for games. It has a pretty big community and lots of documentations. \$\endgroup\$
    – Sidar
    Commented Jan 6, 2013 at 4:20
  • \$\begingroup\$ Well, I'll give it a try sometime. \$\endgroup\$ Commented Jan 6, 2013 at 10:13

1 Answer 1

2
\$\begingroup\$

A minimal Breakout game, demonstrating the use of Activities, touch event handling, and draw/update with GLSurfaceView can be found here.

\$\endgroup\$
1
  • \$\begingroup\$ Google Code is being discontinued, and the project has been moved to Github. Here's the repository. \$\endgroup\$
    – beatgammit
    Commented Aug 28, 2016 at 19:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .