Reputation: 6025
I need to offer slightly different app logic depending on the deployment platform my LibGDX app is running on, i.e. Desktop or Android, etc., does the LibGDX API offer a method of identifying the current runtime platform?
This post, "abstracting platform specific code in libGDX" offers a solution of sorts, I'm just wondering if there is something directly available in the API itself (?).
Upvotes: 15
Views: 6440
Reputation: 444
If people are having trouble figuring out where you actually get the ApplicationType from, it's accessed from:
Gdx.app.getType()
And for a working example this would do:
if(Gdx.app.getType() == ApplicationType.iOS) {
//Do awesome stuff for iOS here
}
Upvotes: 18
Reputation: 45493
You could potentially use Application#getType()
, which will return one of the values defined by Application.ApplicationType
:
Upvotes: 17