This is the fifth day of my participation in Gwen Challenge

preface

In the previous chapter (juejin.cn/post/696995…) We were introduced to libGDX and set up a simple development environment. LibGDX: LibGDX: LibGDX: LibGDX: LibGDX: LibGDX: LibGDX: LibGDX: LibGDX: LibGDX: LibGDX: LibGDX: LibGDX So, without further ado, let’s get started at once.

Common concepts in games

The examples in this article will cover several concepts commonly used in several game engines, including file IO, input IO, graphics and sound. Specifically, they are:

  1. Basic file access
  2. Clear the screen
  3. The plot
  4. Use the camera
  5. Basic input processing (mouse, keyboard)
  6. Play sound

Project configuration

1. Generate the libGDX project

The libGDX project generates the following information from the generator in the previous chapter: drop Package name: com.badLogic. drop Game class: drop

2. Import libGDX project into IDE

After the project is generated, you can import it directly into the IDE (this step was covered in the previous chapter). Generally speaking, after the import, you can see that the project contains the following modules:

core / drop-core, desktop / drop-desktop, and html / drop-html.

3. Run the project

Once imported into the IDE, we can run it directly and a window will appear containing the BadLogic Games image:

It doesn’t matter if we find the title is still garbled, at least we have got the libGDX project running, we have taken the first step successfully, no matter how many difficulties there are, I believe that at this moment, every reader like me is still feeling a little excited.

Functions of each module

If you are curious about the various modules in the libGDX project, let’s talk about what each module does. The structure of the generated module is shown as follows:

Project Name Sub-module name Drop Core Desktop Android HTML iosCopy the code

When we write code, the Core module is a common code module. We write the logical code and common resources of the game in core module. Other platforms (desktop, Android, HTML, ios) rely on core module. However, each platform (Desktop, Android, HTML, and ios) module has its own launcher. This is because each platform has a different launching mechanism. It is convenient to obtain hardware information from different platforms and pass it to the core module, so you can reuse a set of core code. It’s universal across platforms.

About Resource Paths

As you can see, each module has its own assets directory (including Core). This is because it is convenient for you to adapt to different platforms. For example, common resources can be placed in core directory, and different customized resources can be placed in their respective platforms for isolated use, which is convenient for development.

Now that we have the libGDX project up and running, the next chapter will start with the libGDX mini-game development.

If you think the blogger wrote well, you are welcome to “like, favorites, follow”.