- Module description (Modules overview)
- Input: Provides a unified input model and handler for all platforms.
Get Touch Example:
1 if (Gdx.input.isTouched ()) {2 SYSTEM.OUT.PRINTLN ("Input occurred at x=" +gdx.input.getx () + ", y=" +3 }
- Graphics: Ability to draw pictures on the screen using OpenGL ES provided by hardware
Get OpenGL API 2.0 implementation, if the hardware does not support OpenGL ES 2.0 will return null
1 GL20 gl =Gdx.graphics.getGL20 (); 2 Gl.glclearcolor (1f, 0.0f, 0.0f, 1); 3 gl.glclear (gl20.gl_color_buffer_bit);
- Files: File access on all platforms provides a convenient way to read and write.
To create an example of a texture from file $app_dir/assets/textures:
1 Texture mytexture =newtexture (Gdx.files.internal ("assets/texture/brick.png"));
- Audio: Play and record sound on all platforms
Example of playing sounds:
1 Music Music =gdx.audio.newmusic (Gdx.files.getFileHandle ("Data/mymusicfile.mp3", filetype.internal)) ; 2 music.setvolume (0.5f); 3 Music.play (); 4 music.setlooping (true);
- Networking: Provides a way to perform network operations.
- Basic Game Frame
- Acquisition of the application environment (context)
1 switch (Gdx.app.getType ()) { 2 case android:// Android specific Codebreak; 3 case desktop:// desktop specific codebreak; 4 case WebGl: // HTML5 specific codebreak; 5 default : // Other platforms specific code 6 }
If it is an Android app, you can also get the version:
1 int androidversion =gdx.app.getversion ();
- Memory consumption situation
Here are two ways to get Java and local memory availability
1 long javaheap =Gdx.app.getJavaHeap (); 2 Long nativeheap =gdx.app.getnativeheap ();
The original is written by Bo Master Le Zhi Editor, the copyright belongs to the Bo owner. The original address http://www.dtblog.cn/1126.html reprint please specify the source!
"Open source Java Game Framework libgdx topic" -05-Module description and context