vtm/vtm-ios-example/src/org/oscim/ios/test/ExampleLauncher.java
2017-11-12 12:03:47 +02:00

66 lines
2.5 KiB
Java

/*
* Copyright 2016-2017 Longri
* Copyright 2016-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
* 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.ios.test;
import com.badlogic.gdx.backends.iosrobovm.IOSApplication;
import com.badlogic.gdx.backends.iosrobovm.IOSApplicationConfiguration;
import org.oscim.backend.CanvasAdapter;
import org.oscim.utils.Parameters;
import org.robovm.apple.foundation.NSAutoreleasePool;
import org.robovm.apple.glkit.GLKViewDrawableStencilFormat;
import org.robovm.apple.uikit.UIApplication;
import org.robovm.apple.uikit.UIDevice;
import org.robovm.apple.uikit.UIScreen;
public class ExampleLauncher extends IOSApplication.Delegate {
@Override
protected IOSApplication createApplication() {
IOSApplicationConfiguration config = new IOSApplicationConfiguration();
config.orientationLandscape = true;
config.orientationPortrait = true;
config.stencilFormat = GLKViewDrawableStencilFormat._8;
float scale = (float) (getIosVersion() >= 8 ? UIScreen.getMainScreen().getNativeScale() : UIScreen.getMainScreen().getScale());
CanvasAdapter.dpi *= scale;
// IOSMapApp iosMapApp = new IOSMapApp();
// IOSPathLayerTest iosMapApp = new IOSPathLayerTest();
IOSLineTexBucketTest iosMapApp = new IOSLineTexBucketTest();
// iOS needs POT textures for drawing lines with texture
Parameters.POT_TEXTURES = true;
iosMapApp.init();
return new IOSApplication(iosMapApp, config);
}
private int getIosVersion() {
String systemVersion = UIDevice.getCurrentDevice().getSystemVersion();
return Integer.parseInt(systemVersion.split("\\.")[0]);
}
public static void main(String[] argv) {
NSAutoreleasePool pool = new NSAutoreleasePool();
System.setProperty(org.slf4j.impl.SimpleLogger.DEFAULT_LOG_LEVEL_KEY, "TRACE");
UIApplication.main(argv, null, ExampleLauncher.class);
pool.drain();
}
}