parent
980e9d5e54
commit
8397d5a3be
@ -31,17 +31,20 @@ import java.awt.RenderingHints;
|
|||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
public class AwtGraphics extends CanvasAdapter {
|
public class AwtGraphics extends CanvasAdapter {
|
||||||
|
|
||||||
public static void init() {
|
public static void init() {
|
||||||
CanvasAdapter.init(new AwtGraphics());
|
CanvasAdapter.init(new AwtGraphics());
|
||||||
|
|
||||||
String os = System.getProperty("os.name").toLowerCase();
|
String os = System.getProperty("os.name").toLowerCase(Locale.ENGLISH);
|
||||||
|
if (os.contains("win"))
|
||||||
if(os.contains("win")) CanvasAdapter.platform = Platform.WINDOWS;
|
CanvasAdapter.platform = Platform.WINDOWS;
|
||||||
else if(os.contains("mac")) CanvasAdapter.platform = Platform.MAC_OS;
|
else if (os.contains("mac"))
|
||||||
else CanvasAdapter.platform = Platform.LINUX;
|
CanvasAdapter.platform = Platform.MACOS;
|
||||||
|
else
|
||||||
|
CanvasAdapter.platform = Platform.LINUX;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BufferedImage getBitmap(Bitmap bitmap) {
|
public static BufferedImage getBitmap(Bitmap bitmap) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013 Hannes Janetzek
|
* Copyright 2013 Hannes Janetzek
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 devemux86
|
||||||
*
|
*
|
||||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
*
|
*
|
||||||
@ -41,7 +41,6 @@ public class GdxMapApp extends GdxMap {
|
|||||||
AwtGraphics.init();
|
AwtGraphics.init();
|
||||||
GdxAssets.init("assets/");
|
GdxAssets.init("assets/");
|
||||||
GLAdapter.init(new LwjglGL20());
|
GLAdapter.init(new LwjglGL20());
|
||||||
GLAdapter.GDX_DESKTOP_QUIRKS = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013 Hannes Janetzek
|
* Copyright 2013 Hannes Janetzek
|
||||||
* Copyright 2016 Izumi Kawashima
|
* Copyright 2016 Izumi Kawashima
|
||||||
|
* Copyright 2017 devemux86
|
||||||
*
|
*
|
||||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
*
|
*
|
||||||
@ -66,7 +67,6 @@ class GwtMap extends GdxMap {
|
|||||||
|
|
||||||
log.debug("GLAdapter.init");
|
log.debug("GLAdapter.init");
|
||||||
GLAdapter.init((GL) Gdx.graphics.getGL20());
|
GLAdapter.init((GL) Gdx.graphics.getGL20());
|
||||||
GLAdapter.GDX_WEBGL_QUIRKS = true;
|
|
||||||
MapRenderer.setBackgroundColor(0xffffff);
|
MapRenderer.setBackgroundColor(0xffffff);
|
||||||
//Gdx.app.setLogLevel(Application.LOG_DEBUG);
|
//Gdx.app.setLogLevel(Application.LOG_DEBUG);
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013 Hannes Janetzek
|
* Copyright 2013 Hannes Janetzek
|
||||||
|
* Copyright 2017 devemux86
|
||||||
*
|
*
|
||||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
*
|
*
|
||||||
@ -43,7 +44,6 @@ public class GwtMap extends GdxMap {
|
|||||||
GdxAssets.init("");
|
GdxAssets.init("");
|
||||||
CanvasAdapter.textScale = 0.7f;
|
CanvasAdapter.textScale = 0.7f;
|
||||||
GLAdapter.init((GL) Gdx.graphics.getGL20());
|
GLAdapter.init((GL) Gdx.graphics.getGL20());
|
||||||
GLAdapter.GDX_WEBGL_QUIRKS = true;
|
|
||||||
MapRenderer.setBackgroundColor(0xffffff);
|
MapRenderer.setBackgroundColor(0xffffff);
|
||||||
|
|
||||||
JsMap.init(mMap);
|
JsMap.init(mMap);
|
||||||
|
@ -84,6 +84,6 @@ public class GwtGdxGraphics extends CanvasAdapter {
|
|||||||
|
|
||||||
public static void init() {
|
public static void init() {
|
||||||
CanvasAdapter.init(new GwtGdxGraphics());
|
CanvasAdapter.init(new GwtGdxGraphics());
|
||||||
CanvasAdapter.platform = Platform.WEB;
|
CanvasAdapter.platform = Platform.WEBGL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013 Hannes Janetzek
|
* Copyright 2013 Hannes Janetzek
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 devemux86
|
||||||
*
|
*
|
||||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
*
|
*
|
||||||
@ -17,6 +17,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.oscim.backend;
|
package org.oscim.backend;
|
||||||
|
|
||||||
|
import org.oscim.layers.tile.buildings.BuildingLayer;
|
||||||
|
|
||||||
public class GLAdapter {
|
public class GLAdapter {
|
||||||
|
|
||||||
public final static boolean debug = false;
|
public final static boolean debug = false;
|
||||||
@ -43,6 +45,12 @@ public class GLAdapter {
|
|||||||
|
|
||||||
public static void init(GL gl20) {
|
public static void init(GL gl20) {
|
||||||
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 Longri
|
||||||
|
* Copyright 2017 devemux86
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify it under the
|
* 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
|
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
@ -14,33 +15,26 @@
|
|||||||
*/
|
*/
|
||||||
package org.oscim.backend;
|
package org.oscim.backend;
|
||||||
|
|
||||||
|
|
||||||
public enum Platform {
|
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);
|
|
||||||
|
|
||||||
|
ANDROID,
|
||||||
Platform(boolean buildingLayerTranslucent, boolean desktopQuirks) {
|
IOS,
|
||||||
this.BUILDING_LAYER_TRANSLUCENT = buildingLayerTranslucent;
|
LINUX,
|
||||||
this.GDX_DESKTOP_QUIRKS = desktopQuirks;
|
MACOS,
|
||||||
}
|
UNKNOWN,
|
||||||
|
WEBGL,
|
||||||
|
WINDOWS;
|
||||||
public boolean BUILDING_LAYER_TRANSLUCENT;
|
|
||||||
|
|
||||||
public boolean GDX_DESKTOP_QUIRKS;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true when This is WINDOWS, LINUX or MAC_OS other, false
|
* @return true if on desktop (Windows, macOS, Linux)
|
||||||
*
|
|
||||||
* @return boolean
|
|
||||||
*/
|
*/
|
||||||
public boolean isAnyDesktop() {
|
public boolean isDesktop() {
|
||||||
return this == LINUX || this == WINDOWS || this == MAC_OS;
|
switch (this) {
|
||||||
|
case LINUX:
|
||||||
|
case MACOS:
|
||||||
|
case WINDOWS:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user