Book Image

LibGDX Game Development By Example

By : James Cook
Book Image

LibGDX Game Development By Example

By: James Cook

Overview of this book

Table of Contents (18 chapters)
LibGDX Game Development By Example
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Keeping it cross-platform friendly


I hope you have managed to keep up with where we are at the moment with the third-party libraries. This sounds a little daunting at first, but once you have done it a couple of times, you will see that it is pretty straightforward.

What we are going to look at now is how you would interact with one of these libraries if you were to use one.

FriendFace for Android

Carrying on with our made-up social network called FriendFace, we are going to implement the social network's Android integration that it has. It doesn't offer anything fancy other than the ability for us to post a player's name and score. Then, FriendFace does whatever it is that it does with the name and score; perhaps it shows it to the player's friends?

The following is how we are going to define the FriendFaceAPI class:

public class FriendFaceAPI {
  public void postScore(String name, int score) {
    //Some code, the library may be opensource or not – who knows!
  }
}

Pretty straight forward!

FriendFace...