(Original: http://www.libgdx.cn/topic/29/4-libgdx%E5%BA%94%E7%94%A8%E6%A1%86%E6%9E%B6)
Module
As the core, libgdx provides six interfaces to interact with the operating system. These interfaces are implemented based on the backend of each operating system.
Application: run an application and notify an API client of application-level events, such as window change size. Provides log systems and query methods, such as memory usage.
Files: exposes the underlying file system. Provides a series of abstraction for file operations.
Input: user input. Such as mouse, keyboard, touch and sensor. Both round robin and event-driven are supported.
Net: provides cross-platform access to resources through HTTP/HTTPS. You can create a TCP server and client sockets.
Audio: provides methods for playback of sound effects and music, and provides direct access to the device to play PCM.
Graphics: the OpenGL ES 2.0 is exposed.
Startup class
For each platform, the startup class is required. The startup class of each platform implements the backend application interface of each platform. For desktop applications, use lwjgl backend as follows:
public class DesktopStarter {public static void main(String[] argv) {LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();new LwjglApplication(new MyGame(), config);}}
For Android, the startup class is as follows:
public class AndroidStarter extends AndroidApplication {public void onCreate(Bundle bundle) {super.onCreate(bundle);AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();initialize(new MyGame(), config);}}
Access Module
The module can be accessed through the static method provided by GDX class.
For example, the audio module can be accessed through the following methods:
AudioDevice audioDevice = Gdx.audio.newAudioDevice(44100, false);
(Www.libgdx.cn is copyrighted. If you need to reprint it, indicate the source)
4. libgdx Application Framework