Search in sources :

Example 1 with ShatteredPixelDungeon

use of com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon in project shattered-pixel-dungeon-gdx by 00-Evan.

the class AndroidLauncher method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
    String version;
    int versionCode;
    try {
        version = getPackageManager().getPackageInfo(getPackageName(), 0).versionName;
        versionCode = getPackageManager().getPackageInfo(getPackageName(), 0).versionCode;
    } catch (PackageManager.NameNotFoundException e) {
        version = "???";
        versionCode = 0;
    }
    initialize(new ShatteredPixelDungeon(new PDPlatformSupport<GameAction>(version, versionCode, null, new AndroidInputProcessor())), config);
}
Also used : PackageManager(android.content.pm.PackageManager) PDPlatformSupport(com.watabou.utils.PDPlatformSupport) AndroidApplicationConfiguration(com.badlogic.gdx.backends.android.AndroidApplicationConfiguration) ShatteredPixelDungeon(com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon)

Example 2 with ShatteredPixelDungeon

use of com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon in project shattered-pixel-dungeon-gdx by 00-Evan.

the class HtmlLauncher method createApplicationListener.

@Override
public ApplicationListener createApplicationListener() {
    String version = "???";
    int versionCode = 0;
    return new ShatteredPixelDungeon(new PDPlatformSupport(version, versionCode, null, null));
}
Also used : PDPlatformSupport(com.watabou.utils.PDPlatformSupport) ShatteredPixelDungeon(com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon)

Example 3 with ShatteredPixelDungeon

use of com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon in project shattered-pixel-dungeon-gdx by 00-Evan.

the class IOSLauncher method createApplication.

@Override
protected IOSApplication createApplication() {
    IOSApplicationConfiguration config = new IOSApplicationConfiguration();
    final String version = NSBundle.getMainBundle().getInfoDictionaryObject("CFBundleShortVersionString").toString();
    final int versionCode = Integer.parseInt(NSBundle.getMainBundle().getInfoDictionaryObject("CFBundleVersion").toString());
    return new IOSApplication(new ShatteredPixelDungeon(new PDPlatformSupport(version, versionCode, null, new IOSInputProcessor())), config);
}
Also used : IOSApplicationConfiguration(com.badlogic.gdx.backends.iosrobovm.IOSApplicationConfiguration) IOSApplication(com.badlogic.gdx.backends.iosrobovm.IOSApplication) PDPlatformSupport(com.watabou.utils.PDPlatformSupport) ShatteredPixelDungeon(com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon)

Example 4 with ShatteredPixelDungeon

use of com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon in project shattered-pixel-dungeon-gdx by 00-Evan.

the class DesktopLauncher method main.

public static void main(String[] arg) {
    String version = DesktopLauncher.class.getPackage().getSpecificationVersion();
    if (version == null) {
        version = "0.6.4";
    }
    int versionCode;
    try {
        versionCode = Integer.parseInt(DesktopLauncher.class.getPackage().getImplementationVersion());
    } catch (NumberFormatException e) {
        versionCode = 251;
    }
    LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
    if (SharedLibraryLoader.isMac) {
        config.preferencesDirectory = "Library/Application Support/Shattered Pixel Dungeon/";
    } else if (SharedLibraryLoader.isLinux) {
        config.preferencesDirectory = ".shatteredpixel/shattered-pixel-dungeon/";
    } else if (SharedLibraryLoader.isWindows) {
        String winVer = System.getProperties().getProperty("os.name");
        if (winVer.contains("XP")) {
            config.preferencesDirectory = "Application Data/.shatteredpixel/Shattered Pixel Dungeon/";
        } else {
            config.preferencesDirectory = "AppData/Roaming/.shatteredpixel/Shattered Pixel Dungeon/";
        }
    }
    // FIXME: This is a hack to get access to the preferences before we have an application setup
    com.badlogic.gdx.Preferences prefs = new LwjglPreferences(SPDSettings.FILE_NAME, config.preferencesDirectory);
    boolean isFullscreen = prefs.getBoolean(SPDSettings.KEY_WINDOW_FULLSCREEN, false);
    // config.fullscreen = isFullscreen;
    if (!isFullscreen) {
        config.width = prefs.getInteger(SPDSettings.KEY_WINDOW_WIDTH, SPDSettings.DEFAULT_WINDOW_WIDTH);
        config.height = prefs.getInteger(SPDSettings.KEY_WINDOW_HEIGHT, SPDSettings.DEFAULT_WINDOW_HEIGHT);
    }
    config.addIcon("ic_launcher_128.png", Files.FileType.Internal);
    config.addIcon("ic_launcher_32.png", Files.FileType.Internal);
    config.addIcon("ic_launcher_16.png", Files.FileType.Internal);
    // TODO: It have to be pulled from build.gradle, but I don't know how it can be done
    config.title = "Shattered Pixel Dungeon";
    new LwjglApplication(new ShatteredPixelDungeon(new DesktopSupport(version, versionCode, config.preferencesDirectory, new DesktopInputProcessor())), config);
}
Also used : LwjglApplicationConfiguration(com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration) LwjglApplication(com.badlogic.gdx.backends.lwjgl.LwjglApplication) LwjglPreferences(com.badlogic.gdx.backends.lwjgl.LwjglPreferences) ShatteredPixelDungeon(com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon)

Aggregations

ShatteredPixelDungeon (com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon)4 PDPlatformSupport (com.watabou.utils.PDPlatformSupport)3 PackageManager (android.content.pm.PackageManager)1 AndroidApplicationConfiguration (com.badlogic.gdx.backends.android.AndroidApplicationConfiguration)1 IOSApplication (com.badlogic.gdx.backends.iosrobovm.IOSApplication)1 IOSApplicationConfiguration (com.badlogic.gdx.backends.iosrobovm.IOSApplicationConfiguration)1 LwjglApplication (com.badlogic.gdx.backends.lwjgl.LwjglApplication)1 LwjglApplicationConfiguration (com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration)1 LwjglPreferences (com.badlogic.gdx.backends.lwjgl.LwjglPreferences)1