Game Development Reference
In-Depth Information
//do something
}
});
The graphics module
The graphics module can be accessed either through
Gdx.getGraphics()
or using
the shortcut variable
Gdx.graphics
.
Querying delta time
Query LibGDX for the time span between the current and the last frame in seconds
by calling
Gdx.graphics.getDeltaTime()
.
Querying display size
Query the device's display size returned in pixels by calling
Gdx.graphics.
getWidth()
and
Gdx.graphics.getHeight()
.
Querying the frames per second (FPS) counter
Query a built-in frame counter provided by LibGDX to find the average number of
frames per second by calling
Gdx.graphics.getFramesPerSecond()
.
The audio module
The audio module can be accessed either through
Gdx.getAudio()
or using the
shortcut variable
Gdx.audio
.
Sound playback
To load sounds for playback, call
Gdx.audio.newSound()
.
The supported file formats are WAV, MP3, and OGC. However, for the iOS version,
OGG is not supported. There is an upper limit of 1 MB for the decoded audio data.
Consider the sounds to be short effects such as bullets or explosions so that the size
limitation is not really an issue.