Platform identification improvements #286, closes #285

This commit is contained in:
Emux
2017-01-27 20:09:33 +02:00
parent 980e9d5e54
commit 8397d5a3be
7 changed files with 39 additions and 35 deletions

View File

@@ -1,6 +1,6 @@
/*
* Copyright 2013 Hannes Janetzek
* Copyright 2016 devemux86
* Copyright 2016-2017 devemux86
*
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
*
@@ -17,6 +17,8 @@
*/
package org.oscim.backend;
import org.oscim.layers.tile.buildings.BuildingLayer;
public class GLAdapter {
public final static boolean debug = false;
@@ -43,6 +45,12 @@ public class GLAdapter {
public static void init(GL gl20) {
gl = gl20;
GDX_DESKTOP_QUIRKS = CanvasAdapter.platform.GDX_DESKTOP_QUIRKS;
GDX_DESKTOP_QUIRKS = CanvasAdapter.platform.isDesktop();
GDX_WEBGL_QUIRKS = (CanvasAdapter.platform == Platform.WEBGL);
// Buildings translucency does not work on macOS, see #61
if (CanvasAdapter.platform == Platform.MACOS)
BuildingLayer.TRANSLUCENT = false;
}
}

View File

@@ -1,5 +1,6 @@
/*
* Copyright 2017 Longri
* Copyright 2017 devemux86
*
* 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
@@ -14,33 +15,26 @@
*/
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;
ANDROID,
IOS,
LINUX,
MACOS,
UNKNOWN,
WEBGL,
WINDOWS;
/**
* Returns true when This is WINDOWS, LINUX or MAC_OS other, false
*
* @return boolean
* @return true if on desktop (Windows, macOS, Linux)
*/
public boolean isAnyDesktop() {
return this == LINUX || this == WINDOWS || this == MAC_OS;
public boolean isDesktop() {
switch (this) {
case LINUX:
case MACOS:
case WINDOWS:
return true;
}
return false;
}
}