Add platform identification (#286)

This commit is contained in:
Longri
2017-01-27 14:35:36 +01:00
committed by Emux
parent bc7c55b1f8
commit 980e9d5e54
7 changed files with 70 additions and 0 deletions

View File

@@ -1,6 +1,7 @@
/*
* Copyright 2013 Hannes Janetzek
* Copyright 2016 devemux86
* Copyright 2017 Longri
*
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
*
@@ -53,6 +54,11 @@ public abstract class CanvasAdapter {
*/
public static float dpi = DEFAULT_DPI;
/**
* The used platform.
*/
public static Platform platform = Platform.UNKNOWN;
/**
* The scale.
*/

View File

@@ -43,5 +43,6 @@ public class GLAdapter {
public static void init(GL gl20) {
gl = gl20;
GDX_DESKTOP_QUIRKS = CanvasAdapter.platform.GDX_DESKTOP_QUIRKS;
}
}

View File

@@ -0,0 +1,46 @@
/*
* Copyright 2017 Longri
*
* This program is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.oscim.backend;
public enum Platform {
ANDROID(false, false),
IOS(true, false),
MAC_OS(true, true),
LINUX(false, true),
WINDOWS(false, true),
WEB(false, false),
UNKNOWN(false, false);
Platform(boolean buildingLayerTranslucent, boolean desktopQuirks) {
this.BUILDING_LAYER_TRANSLUCENT = buildingLayerTranslucent;
this.GDX_DESKTOP_QUIRKS = desktopQuirks;
}
public boolean BUILDING_LAYER_TRANSLUCENT;
public boolean GDX_DESKTOP_QUIRKS;
/**
* Returns true when This is WINDOWS, LINUX or MAC_OS other, false
*
* @return boolean
*/
public boolean isAnyDesktop() {
return this == LINUX || this == WINDOWS || this == MAC_OS;
}
}