本文整理匯總了Java中com.badlogic.gdx.graphics.g2d.ParticleEffect.loadEmitters方法的典型用法代碼示例。如果您正苦於以下問題:Java ParticleEffect.loadEmitters方法的具體用法?Java ParticleEffect.loadEmitters怎麽用?Java ParticleEffect.loadEmitters使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.badlogic.gdx.graphics.g2d.ParticleEffect
的用法示例。
在下文中一共展示了ParticleEffect.loadEmitters方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: openEffect
import com.badlogic.gdx.graphics.g2d.ParticleEffect; //導入方法依賴的package包/類
void openEffect () {
FileDialog dialog = new FileDialog(editor, "Open Effect", FileDialog.LOAD);
if (lastDir != null) dialog.setDirectory(lastDir);
dialog.setVisible(true);
final String file = dialog.getFile();
final String dir = dialog.getDirectory();
if (dir == null || file == null || file.trim().length() == 0) return;
lastDir = dir;
ParticleEffect effect = new ParticleEffect();
try {
effect.loadEmitters(Gdx.files.absolute(new File(dir, file).getAbsolutePath()));
editor.effect = effect;
emitterTableModel.getDataVector().removeAllElements();
editor.particleData.clear();
} catch (Exception ex) {
System.out.println("Error loading effect: " + new File(dir, file).getAbsolutePath());
ex.printStackTrace();
JOptionPane.showMessageDialog(editor, "Error opening effect.");
return;
}
for (ParticleEmitter emitter : effect.getEmitters()) {
emitter.setPosition(editor.worldCamera.viewportWidth / 2, editor.worldCamera.viewportHeight / 2);
emitterTableModel.addRow(new Object[] {emitter.getName(), true});
}
editIndex = 0;
emitterTable.getSelectionModel().setSelectionInterval(editIndex, editIndex);
editor.reloadRows();
}
示例2: openEffect
import com.badlogic.gdx.graphics.g2d.ParticleEffect; //導入方法依賴的package包/類
void openEffect () {
FileDialog dialog = new FileDialog((Frame) null, "Open Effect", FileDialog.LOAD);
if (lastDir != null) dialog.setDirectory(lastDir);
dialog.setVisible(true);
final String file = dialog.getFile();
final String dir = dialog.getDirectory();
if (dir == null || file == null || file.trim().length() == 0) return;
lastDir = dir;
ParticleEffect effect = new ParticleEffect();
try {
effect.loadEmitters(Gdx.files.absolute(new File(dir, file).getAbsolutePath()));
editor.effect = effect;
emitterTableModel.getDataVector().removeAllElements();
editor.particleData.clear();
} catch (Exception ex) {
System.out.println("Error loading effect: " + new File(dir, file).getAbsolutePath());
ex.printStackTrace();
JOptionPane.showMessageDialog(editor, "Error opening effect.");
return;
}
for (ParticleEmitter emitter : effect.getEmitters()) {
emitter.setPosition(editor.worldCamera.viewportWidth / 2, editor.worldCamera.viewportHeight / 2);
emitterTableModel.addRow(new Object[] {emitter.getName(), true});
}
editIndex = 0;
emitterTable.getSelectionModel().setSelectionInterval(editIndex, editIndex);
editor.reloadRows();
}