September 2013
Beginner to intermediate
388 pages
8h 19m
English
The next step after making assets, such as making our texture atlas available to the game, is to load and use them. Loading an asset such as a texture can be as simple as the following line of code:
Texture texture = new Texture(Gdx.files.internal("texture.png"));In the preceding example, we ask Libgdx to get an internal file handle to the texture.png file. Invoking an internal file means that Libgdx has to resolve the file's path by scanning the assets folder of the game. Then, the handle is passed over as an argument to the constructor of the Texture class to instantiate a new object of this type. This texture instance can now be directly rendered to the screen with another line of code, as shown in the following ...
Read now
Unlock full access