当前位置: 首页>>代码示例>>Java>>正文


Java ConfigurableEmitter.setImageName方法代码示例

本文整理汇总了Java中org.newdawn.slick.particles.ConfigurableEmitter.setImageName方法的典型用法代码示例。如果您正苦于以下问题:Java ConfigurableEmitter.setImageName方法的具体用法?Java ConfigurableEmitter.setImageName怎么用?Java ConfigurableEmitter.setImageName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.newdawn.slick.particles.ConfigurableEmitter的用法示例。


在下文中一共展示了ConfigurableEmitter.setImageName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: importEmitter

import org.newdawn.slick.particles.ConfigurableEmitter; //导入方法依赖的package包/类
/**
 * Import an emitter XML file
 */
public void importEmitter() {
	chooser.setDialogTitle("Open");
	int resp = chooser.showOpenDialog(this);
	if (resp == JFileChooser.APPROVE_OPTION) {
		File file = chooser.getSelectedFile();
		File path = file.getParentFile();
		
		try {
			final ConfigurableEmitter emitter = ParticleIO.loadEmitter(file);
			
			
			if (emitter.getImageName() != null) {
				File possible = new File(path, emitter.getImageName());
				
				if (possible.exists()) {
					emitter.setImageName(possible.getAbsolutePath());
				} else {
					chooser.setDialogTitle("Locate the image: "+emitter.getImageName());
					resp = chooser.showOpenDialog(this);
					FileFilter filter = new FileFilter() {
						public boolean accept(File f) {
							if (f.isDirectory()) {
								return true;
							}
							
							return (f.getName().equals(emitter.getImageName()));
						}

						public String getDescription() {
							return emitter.getImageName();
						}
					};
					chooser.addChoosableFileFilter(filter);
					if (resp == JFileChooser.APPROVE_OPTION) {
						File image = chooser.getSelectedFile();
						emitter.setImageName(image.getAbsolutePath());
						path = image.getParentFile();
					}
					chooser.resetChoosableFileFilters();
					chooser.addChoosableFileFilter(xmlFileFilter);
				}
			}
			
			addEmitter(emitter);
			emitters.setSelected(emitter);
		} catch (IOException e) {
			Log.error(e);
			JOptionPane.showMessageDialog(this, e.getMessage());
		}
	}
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:55,代码来源:ParticleEditor.java

示例2: loadSystem

import org.newdawn.slick.particles.ConfigurableEmitter; //导入方法依赖的package包/类
/**
 * Load a complete particle system XML description
 */
public void loadSystem() {
	chooser.setDialogTitle("Open");
	int resp = chooser.showOpenDialog(this);
	if (resp == JFileChooser.APPROVE_OPTION) {
		File file = chooser.getSelectedFile();
		File path = file.getParentFile();
		
		try {
			ParticleSystem system = ParticleIO.loadConfiguredSystem(file);
			game.setSystem(system);
			emitters.clear();
			
			for (int i=0;i<system.getEmitterCount();i++) {
				final ConfigurableEmitter emitter = (ConfigurableEmitter) system.getEmitter(i);
				
				if (emitter.getImageName() != null) {
					File possible = new File(path, emitter.getImageName());
					if (possible.exists()) {
						emitter.setImageName(possible.getAbsolutePath());
					} else {
						chooser.setDialogTitle("Locate the image: "+emitter.getImageName());
						FileFilter filter = new FileFilter() {
							public boolean accept(File f) {
								if (f.isDirectory()) {
									return true;
								}
								
								return (f.getName().equals(emitter.getImageName()));
							}

							public String getDescription() {
								return emitter.getImageName();
							}
						};
						
						chooser.addChoosableFileFilter(filter);
						resp = chooser.showOpenDialog(this);
						if (resp == JFileChooser.APPROVE_OPTION) {
							File image = chooser.getSelectedFile();
							emitter.setImageName(image.getAbsolutePath());
							path = image.getParentFile();
						}
						chooser.setDialogTitle("Open");
						chooser.resetChoosableFileFilters();
						chooser.addChoosableFileFilter(xmlFileFilter);
					}
				}
				
				emitters.add(emitter);
			}
			additive.setSelected(system.getBlendingMode() == ParticleSystem.BLEND_ADDITIVE);
			pointsEnabled.setSelected(system.usePoints());
			
			emitters.setSelected(0);
		} catch (IOException e) {
			Log.error(e);
			JOptionPane.showMessageDialog(this, e.getMessage());
		}
	}
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:64,代码来源:ParticleEditor.java


注:本文中的org.newdawn.slick.particles.ConfigurableEmitter.setImageName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。