parent
980e9d5e54
commit
8397d5a3be
vtm-desktop/src/org/oscim
vtm-web-app/src/org/oscim/web/client
vtm-web-js/src/org/oscim/web/client
vtm-web/src/org/oscim/gdx/client
vtm/src/org/oscim/backend
@ -31,17 +31,20 @@ import java.awt.RenderingHints;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Locale;
|
||||
|
||||
public class AwtGraphics extends CanvasAdapter {
|
||||
|
||||
public static void init() {
|
||||
CanvasAdapter.init(new AwtGraphics());
|
||||
|
||||
String os = System.getProperty("os.name").toLowerCase();
|
||||
|
||||
if(os.contains("win")) CanvasAdapter.platform = Platform.WINDOWS;
|
||||
else if(os.contains("mac")) CanvasAdapter.platform = Platform.MAC_OS;
|
||||
else CanvasAdapter.platform = Platform.LINUX;
|
||||
String os = System.getProperty("os.name").toLowerCase(Locale.ENGLISH);
|
||||
if (os.contains("win"))
|
||||
CanvasAdapter.platform = Platform.WINDOWS;
|
||||
else if (os.contains("mac"))
|
||||
CanvasAdapter.platform = Platform.MACOS;
|
||||
else
|
||||
CanvasAdapter.platform = Platform.LINUX;
|
||||
}
|
||||
|
||||
public static BufferedImage getBitmap(Bitmap bitmap) {
|
||||
|
@ -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).
|
||||
*
|
||||
@ -41,7 +41,6 @@ public class GdxMapApp extends GdxMap {
|
||||
AwtGraphics.init();
|
||||
GdxAssets.init("assets/");
|
||||
GLAdapter.init(new LwjglGL20());
|
||||
GLAdapter.GDX_DESKTOP_QUIRKS = true;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
* Copyright 2016 Izumi Kawashima
|
||||
* Copyright 2017 devemux86
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@ -66,7 +67,6 @@ class GwtMap extends GdxMap {
|
||||
|
||||
log.debug("GLAdapter.init");
|
||||
GLAdapter.init((GL) Gdx.graphics.getGL20());
|
||||
GLAdapter.GDX_WEBGL_QUIRKS = true;
|
||||
MapRenderer.setBackgroundColor(0xffffff);
|
||||
//Gdx.app.setLogLevel(Application.LOG_DEBUG);
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
* Copyright 2017 devemux86
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@ -43,7 +44,6 @@ public class GwtMap extends GdxMap {
|
||||
GdxAssets.init("");
|
||||
CanvasAdapter.textScale = 0.7f;
|
||||
GLAdapter.init((GL) Gdx.graphics.getGL20());
|
||||
GLAdapter.GDX_WEBGL_QUIRKS = true;
|
||||
MapRenderer.setBackgroundColor(0xffffff);
|
||||
|
||||
JsMap.init(mMap);
|
||||
|
@ -84,6 +84,6 @@ public class GwtGdxGraphics extends CanvasAdapter {
|
||||
|
||||
public static void init() {
|
||||
CanvasAdapter.init(new GwtGdxGraphics());
|
||||
CanvasAdapter.platform = Platform.WEB;
|
||||
CanvasAdapter.platform = Platform.WEBGL;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user