Book Image

Libgdx Cross-platform Game Development Cookbook

Book Image

Libgdx Cross-platform Game Development Cookbook

Overview of this book

Table of Contents (20 chapters)
Libgdx Cross-platform Game Development Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Managing platform-specific code


One of the strong points of Libgdx is the cross-platform deployment feature since a single Java core project can be published to Android, iOS, HTML, and desktop with the help of RovoVM and Google Web Toolkit. However, in spite of abstracting the programmer from the dirty work, each platform has its particularities and there is still a need to handle them specifically under certain circumstances.

This recipe will deal with a real-life platform-specific problem that involves leading the user to a particular rating interface:

  • Desktop: This will route the user to a custom web

  • Android: This will route the user to the app's Google Play Store section

  • iOS: This will route the user to the app's Apple Store section

  • HTML: This will route the user to a custom web

Getting ready

The code for this recipe is spread across five projects. The first one is samples-core and has a com.cookbook.platforms package containing the PlatformResolver interface. The GdxSample abstract class...