當前位置: 首頁>>代碼示例>>Java>>正文


Java ParticleEffect.loadEmitters方法代碼示例

本文整理匯總了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();
}
 
開發者ID:basherone,項目名稱:libgdxcn,代碼行數:29,代碼來源:EffectPanel.java

示例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();
}
 
開發者ID:pyros2097,項目名稱:GdxStudio,代碼行數:29,代碼來源:EffectPanel.java


注:本文中的com.badlogic.gdx.graphics.g2d.ParticleEffect.loadEmitters方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。