Game Development Reference
In-Depth Information
Client/server sockets
You can create client/server sockets by calling either
Gdx.net.newClientSocket()
or
Gdx.net.newServerSocket()
.
Opening a URI in a web browser
To open a
Uniform Resource Identifier
(
URI
) in the default web browser, call
Gdx.
net.openURI(URI)
.
LibGDX's application life cycle and
interface
The application life cycle in LibGDX is a well-defined set of distinct system states. The
list of these states is pretty short: create, resize, render, pause, resume, and dispose.
LibGDX defines an
ApplicationListener
interface that contains six methods, one
for each system state. The following code listing is a copy that is directly taken from
LibGDX's sources. For the sake of readability, all comments have been stripped:
public interface ApplicationListener {
public void create ();
public void resize (int width, int height);
public void render ();
public void pause ();
public void resume ();
public void dispose ();
}
All you need to do is implement these methods in your main class of the shared
game code project. LibGDX will then call each of these methods at the right time.
Downloading the example code
You can download the example code iles for all Packt topics you
If you purchased this topic elsewhere, you can visit
http://www.
packtpub.com/support
and register to have the files e-mailed
directly to you.