Draw sprite on canvas in Android or Linux
For programming sprites, as a rule, rather the four functions for draw on canvas:
- Draw the bitmap in the coordinates (X, Y)
- Rotate the bitmap around the point (X0, Y0) at the angle alpha
- 开发者_如何学GoMake transparent colorRGB = 0xXXXXXX in the bitmap (for non-squareness of the sprite)
- Transparency of the sprite as a percentage
I know how to program it in Windows, but how to do it in Android or Linux?
OpenGL
Android uses OpenGL-ES graphics library to perform those actions and you can install OpenGL software development kit on Linux and Windows for that matter.
Using OpenGL the steps are pretty much the same, only the actual underlying calls and the order may be different. The concepts are usually the same.
The main difference between DirextX and OpenGL graphics libraries is that OpenGL uses the right hand rule so rotating a vector x y z points toward the user, the rotation will be counterclockwise. This rule permeates the entire library including construction of polygons, etc.
Here is a great post on how to get started with OpenGL-ES programming in Android.
- Tutorials and libraries for OpenGL-ES games on Android
General OpenGL
- http://www.opengl.org/wiki/Getting_started
OpenGL on Windows
- http://nehe.gamedev.net/
精彩评论