List of usage examples for com.badlogic.gdx.utils SharedLibraryLoader isMac
boolean isMac
To view the source code for com.badlogic.gdx.utils SharedLibraryLoader isMac.
Click Source Link
From source file:es.danirod.rectball.desktop.DesktopPlatform.java
License:Open Source License
protected DesktopPlatform() { sharing = new DesktopSharing(); score = new LegacyScores() { @Override/*from w ww . j av a 2 s . c o m*/ protected FileHandle getScoresFile() { if (SharedLibraryLoader.isWindows) { String location = System.getenv("AppData") + "/rectball/scores"; return Gdx.files.absolute(location); } else if (SharedLibraryLoader.isLinux) { return Gdx.files.external(".rectball/scores"); } else if (SharedLibraryLoader.isMac) { return Gdx.files.external("/Library/Application Support/rectball/scores"); } else { return Gdx.files.local("scores"); } } }; preferences = new LwjglPreferences("rectball", ".prefs/"); statistics = new LegacyStatistics() { @Override protected FileHandle getStatistics() { if (SharedLibraryLoader.isWindows) { String location = System.getenv("AppData") + "/rectball/stats"; return Gdx.files.absolute(location); } else if (SharedLibraryLoader.isLinux) { return Gdx.files.external(".rectball/stats"); } else if (SharedLibraryLoader.isMac) { return Gdx.files.external("/Library/Application Support/rectball/stats"); } else { return Gdx.files.local("stats"); } } }; }
From source file:es.danirod.rectball.desktop.DesktopSharing.java
License:Open Source License
/** * Present a save dialog to the user and get the associated FileHandle. * This method will block the execution of the application. When the * user finally selects a file, it will be converted to a FileHandle * and returned to the user. If the user cancels the dialog this method * will return null.// w w w .ja va 2 s . co m * @return the FileHandle where the user wants to save or null */ private FileHandle requestSave() { String location = null; // Use a JFileChooser on Linux and on Windows. Apparently, Apple's // Java integration recommendations suggest using old AWT FileDialog // because of the better integration with the rest of the system. if (SharedLibraryLoader.isMac) { FileDialog dialog = new FileDialog((Frame) null, "Save screenshot to", FileDialog.SAVE); dialog.setMultipleMode(false); dialog.setVisible(true); if (dialog.getFile() != null) { location = dialog.getDirectory() + dialog.getFile(); } dialog.dispose(); } else { JFileChooser chooser = new JFileChooser(); chooser.setDialogTitle("Save screenshot to"); int status = chooser.showSaveDialog(null); if (status == JFileChooser.APPROVE_OPTION) { location = chooser.getSelectedFile().getAbsolutePath(); } } return location != null ? Gdx.files.absolute(location) : null; }