本文整理汇总了Java中com.badlogic.gdx.utils.SharedLibraryLoader.isLinux方法的典型用法代码示例。如果您正苦于以下问题:Java SharedLibraryLoader.isLinux方法的具体用法?Java SharedLibraryLoader.isLinux怎么用?Java SharedLibraryLoader.isLinux使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.utils.SharedLibraryLoader
的用法示例。
在下文中一共展示了SharedLibraryLoader.isLinux方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import com.badlogic.gdx.utils.SharedLibraryLoader; //导入方法依赖的package包/类
public static void main (String[] arg) {
String version = DesktopLauncher.class.getPackage().getSpecificationVersion();
if (version == null) {
version = "1.0";
}
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
if (SharedLibraryLoader.isMac) {
config.preferencesDirectory = "Library/Application Support/Pixel Dungeon/";
} else if (SharedLibraryLoader.isLinux) {
config.preferencesDirectory = ".watabou/pixel-dungeon/";
} else if (SharedLibraryLoader.isWindows) {
config.preferencesDirectory = "Saved Games/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(Preferences.FILE_NAME, config.preferencesDirectory);
boolean isFullscreen = prefs.getBoolean(Preferences.KEY_WINDOW_FULLSCREEN, false);
config.fullscreen = isFullscreen;
if (!isFullscreen) {
config.width = prefs.getInteger(Preferences.KEY_WINDOW_WIDTH, Preferences.DEFAULT_WINDOW_WIDTH);
config.height = prefs.getInteger(Preferences.KEY_WINDOW_HEIGHT, Preferences.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 = "Pixel Dungeon";
new LwjglApplication(new PixelDungeon(
new DesktopSupport(version, config.preferencesDirectory, new DesktopInputProcessor())
), config);
}
示例2: copyToTempFile
import com.badlogic.gdx.utils.SharedLibraryLoader; //导入方法依赖的package包/类
@Override
protected File copyToTempFile(String resourcePath) {
File file = super.copyToTempFile(resourcePath);
if (file == null) return null;
if (SharedLibraryLoader.isLinux || SharedLibraryLoader.isMac) {
try {
// Change access permission for temp file
System.out.println("Call \"chmod\" for a temp file");
Process process = Runtime.getRuntime().exec("chmod +x " + file.getAbsolutePath());
InputStream is = process.getInputStream();
BufferedReader br = new BufferedReader(new InputStreamReader(is));
String line = null;
while ((line = br.readLine()) != null) {
System.out.println(line);
}
int result = process.waitFor(); // Let the process finish.
if (result != 0) {
throw new RuntimeException("\"chmod\" call finished with error");
}
} catch (IOException | InterruptedException e) {
throw new RuntimeException("Error changing file access permission for: " + file.getAbsolutePath(), e);
}
}
return file;
}
示例3: main
import com.badlogic.gdx.utils.SharedLibraryLoader; //导入方法依赖的package包/类
public static void main (String[] arg) {
String version = DesktopLauncher.class.getPackage().getSpecificationVersion();
if (version == null) {
version = "???";
}
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
if (SharedLibraryLoader.isMac) {
config.preferencesDirectory = "Library/Application Support/BravePixel/Pixel Dungeon/";
} else if (SharedLibraryLoader.isLinux) {
config.preferencesDirectory = ".bravepixel/pixel-dungeon/";
} else if (SharedLibraryLoader.isWindows) {
config.preferencesDirectory = "Saved Games/BravePixel/PixelDungeon";
}
// FIXME: This is a hack to get access to the preferences before we have an application setup
com.badlogic.gdx.Preferences prefs = new LwjglPreferences(Preferences.FILE_NAME, config.preferencesDirectory);
boolean isFullscreen = prefs.getBoolean(Preferences.KEY_WINDOW_FULLSCREEN, false);
config.fullscreen = isFullscreen;
if (!isFullscreen) {
config.width = prefs.getInteger(Preferences.KEY_WINDOW_WIDTH, Preferences.DEFAULT_WINDOW_WIDTH);
config.height = prefs.getInteger(Preferences.KEY_WINDOW_HEIGHT, Preferences.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 = "Pixel Dungeon";
new LwjglApplication(new PixelDungeon(
new DesktopSupport(version, config.preferencesDirectory, new DesktopInputProcessor())
), config);
}
示例4: main
import com.badlogic.gdx.utils.SharedLibraryLoader; //导入方法依赖的package包/类
public static void main (String[] arg) {
String version = DesktopLauncher.class.getPackage().getSpecificationVersion();
if (version == null) {
version = "0.6.2d";
}
int versionCode;
try {
versionCode = Integer.parseInt(DesktopLauncher.class.getPackage().getImplementationVersion());
} catch (NumberFormatException e) {
versionCode = 228;
}
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(Preferences.FILE_NAME, config.preferencesDirectory);
boolean isFullscreen = prefs.getBoolean(Preferences.KEY_WINDOW_FULLSCREEN, false);
//config.fullscreen = isFullscreen;
if (!isFullscreen) {
config.width = prefs.getInteger(Preferences.KEY_WINDOW_WIDTH, Preferences.DEFAULT_WINDOW_WIDTH);
config.height = prefs.getInteger(Preferences.KEY_WINDOW_HEIGHT, Preferences.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);
}