Explanation of JetBoy example for dev.android.com?

I have developed many desktop or web applications in java, but not for Android.

What I practiced a bit was weird because I'm used to SWING. Since it uses .xml files for applications, I was wondering if you also need this in games?

For example, there is a good example at http://developer.android.com/resources/samples/JetBoy/index.html . I was hoping someone could explain two things to me.

  • How is the image drawn on the screen?
  • How do you listen to user input? (E.g. clicks, draw, scroll, ect ...)

I made games on the desktop, so you do not need to go deeper, but it was difficult for me to understand the code. (What I had to do specifically for android.)


(Another way to express it :)

I assume that basically what I ask is how to make an image, which in turn will listen for clicks, etc. without adding a button? Or do I need to add an invisible button? Then, if I had to add a button, how would I listen to scrolling and drawing?

I also saw some methods, such as doDraw (), but did not see where they placed the image so that it appeared on the Android device.

+4
source share
3 answers

JetBoy is quite complicated for beginners, check out these simple examples, which are based on the same principles as JetBoy: How can I use the animation structure inside the canvas?

Everything is done by drawing raster images on the canvas of the presentation and event, which determines when and where the screen was touched.

+4
source

I think this will tell you everything you need to know in the comprehensive 31st series dedicated to creating Light Racer 3d for Android.

+2
source

If you are not going to use any game engine,
basically you extend android.view.SurfaceHolder
and then overide these methods,
public boolean onTouchEvent (MotionEvent event)
protected void onDraw (canvas canvas)

go through these articles . He teaches everything you need from scratch

+1
source

All Articles