本文整理汇总了Java中com.badlogic.gdx.utils.SharedLibraryLoader.isMac方法的典型用法代码示例。如果您正苦于以下问题:Java SharedLibraryLoader.isMac方法的具体用法?Java SharedLibraryLoader.isMac怎么用?Java SharedLibraryLoader.isMac使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.utils.SharedLibraryLoader
的用法示例。
在下文中一共展示了SharedLibraryLoader.isMac方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: initialize
import com.badlogic.gdx.utils.SharedLibraryLoader; //导入方法依赖的package包/类
private void initialize(ApplicationListener listener, LwjglApplicationConfiguration config) {
LwjglNativesLoader.load();
this.setApplicationLogger(new LwjglApplicationLogger());
this.canvas = new Canvas() {
private final Dimension minSize = new Dimension(1, 1);
public final void addNotify() {
super.addNotify();
if (SharedLibraryLoader.isMac) {
EventQueue.invokeLater(new Runnable() {
public void run() {
MyLwjglCanvas.this.create();
}
});
} else {
MyLwjglCanvas.this.create();
}
}
public final void removeNotify() {
MyLwjglCanvas.this.stop();
super.removeNotify();
}
public Dimension getMinimumSize() {
return this.minSize;
}
};
this.canvas.setSize(1, 1);
this.canvas.setIgnoreRepaint(true);
this.graphics = new LwjglGraphics(this.canvas, config) {
public void setTitle(String title) {
super.setTitle(title);
MyLwjglCanvas.this.setTitle(title);
}
public boolean setWindowedMode(int width, int height, boolean fullscreen) {
if (!super.setWindowedMode(width, height)) {
return false;
} else {
if (!fullscreen) {
MyLwjglCanvas.this.setDisplayMode(width, height);
}
return true;
}
}
public boolean setFullscreenMode(DisplayMode displayMode) {
if (!super.setFullscreenMode(displayMode)) {
return false;
} else {
MyLwjglCanvas.this.setDisplayMode(displayMode.width, displayMode.height);
return true;
}
}
};
this.graphics.setVSync(config.vSyncEnabled);
this.files = new LwjglFiles();
this.input = new LwjglInput();
this.net = new LwjglNet();
this.listener = listener;
Gdx.app = this;
Gdx.graphics = this.graphics;
Gdx.files = this.files;
Gdx.input = this.input;
Gdx.net = this.net;
}
示例5: isFullscreenEnabled
import com.badlogic.gdx.utils.SharedLibraryLoader; //导入方法依赖的package包/类
@Override
public boolean isFullscreenEnabled() {
// return Display.getPixelScaleFactor() == 1f;
return !SharedLibraryLoader.isMac;
}
示例6: initialize
import com.badlogic.gdx.utils.SharedLibraryLoader; //导入方法依赖的package包/类
private void initialize (ApplicationListener listener, LwjglApplicationConfiguration config) {
LwjglNativesLoader.load();
canvas = new Canvas() {
private final Dimension minSize = new Dimension(1, 1);
public final void addNotify () {
super.addNotify();
if (SharedLibraryLoader.isMac) {
EventQueue.invokeLater(new Runnable() {
public void run () {
create();
}
});
} else
create();
}
public final void removeNotify () {
stop();
super.removeNotify();
}
public Dimension getMinimumSize () {
return minSize;
}
};
canvas.setSize(1, 1);
canvas.setIgnoreRepaint(true);
graphics = new LwjglGraphics(canvas, config) {
public void setTitle (String title) {
super.setTitle(title);
LwjglCanvas.this.setTitle(title);
}
public boolean setDisplayMode (int width, int height, boolean fullscreen) {
if (!super.setDisplayMode(width, height, fullscreen)) return false;
if (!fullscreen) LwjglCanvas.this.setDisplayMode(width, height);
return true;
}
public boolean setDisplayMode (DisplayMode displayMode) {
if (!super.setDisplayMode(displayMode)) return false;
LwjglCanvas.this.setDisplayMode(displayMode.width, displayMode.height);
return true;
}
};
graphics.setVSync(config.vSyncEnabled);
if (!LwjglApplicationConfiguration.disableAudio) audio = new OpenALAudio();
files = new LwjglFiles();
input = new LwjglInput();
net = new LwjglNet();
this.listener = listener;
Gdx.app = this;
Gdx.graphics = graphics;
Gdx.audio = audio;
Gdx.files = files;
Gdx.input = input;
Gdx.net = net;
}
示例7: 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);
}
示例8: isFullscreenEnabled
import com.badlogic.gdx.utils.SharedLibraryLoader; //导入方法依赖的package包/类
@Override
public boolean isFullscreenEnabled() {
// return Display.getPixelScaleFactor() == 1f;
return !SharedLibraryLoader.isMac;
}