• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ParticleIO类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



ParticleIO类属于org.newdawn.slick.particles包,在下文中一共展示了ParticleIO类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: init

import org.newdawn.slick.particles.ParticleIO; //导入依赖的package包/类
/**
 * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
 */
public void init(GameContainer container) throws SlickException {
	this.container = container;
	
	try {
		fire = ParticleIO.loadConfiguredSystem("testdata/system.xml");
	} catch (IOException e) {
		throw new SlickException("Failed to load particle systems", e);
	}
	
	copy = new Image(400,300);
	String[] formats = ImageOut.getSupportedFormats();
	message = "Formats supported: ";
	for (int i=0;i<formats.length;i++) {
		message += formats[i];
		if (i < formats.length - 1) {
			message += ",";
		}
	}
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:23,代码来源:ImageOutTest.java


示例2: cloneEmitter

import org.newdawn.slick.particles.ParticleIO; //导入依赖的package包/类
/**
 * Clone the selected emitter
 */
public void cloneEmitter() {
	if (selected == null) {
		return;
	}
	
	try {
		ByteArrayOutputStream bout = new ByteArrayOutputStream();
		ParticleIO.saveEmitter(bout, selected);
		ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
		ConfigurableEmitter emitter = ParticleIO.loadEmitter(bin);
		emitter.name = emitter.name + "_clone";
		
		addEmitter(emitter);
		emitters.setSelected(emitter);
	} catch (IOException e) {
		Log.error(e);
		JOptionPane.showMessageDialog(this, e.getMessage());
	}
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:23,代码来源:ParticleEditor.java


示例3: exportEmitter

import org.newdawn.slick.particles.ParticleIO; //导入依赖的package包/类
/**
 * Export an emitter XML file
 */
public void exportEmitter() {
	if (selected == null) {
		return;
	}

	chooser.setDialogTitle("Save");
	int resp = chooser.showSaveDialog(this);
	if (resp == JFileChooser.APPROVE_OPTION) {
		File file = chooser.getSelectedFile();
		if (!file.getName().endsWith(".xml")) {
			file = new File(file.getAbsolutePath()+".xml");
		}
		
		try {
			ParticleIO.saveEmitter(file, selected);
		} catch (IOException e) {
			Log.error(e);
			JOptionPane.showMessageDialog(this, e.getMessage());
		}
	}
}
 
开发者ID:oldmud0,项目名称:Disparity-RHE,代码行数:25,代码来源:ParticleEditor.java


示例4: saveSystem

import org.newdawn.slick.particles.ParticleIO; //导入依赖的package包/类
/**
 * Save a complete particle system XML description
 */
public void saveSystem() {
	int resp = chooser.showSaveDialog(this);
	if (resp == JFileChooser.APPROVE_OPTION) {
		File file = chooser.getSelectedFile();
		if (!file.getName().endsWith(".xml")) {
			file = new File(file.getAbsolutePath()+".xml");
		}
		
		try {
			ParticleIO.saveConfiguredSystem(file, game.getSystem());
		} catch (IOException e) {
			Log.error(e);
			JOptionPane.showMessageDialog(this, e.getMessage());
		}
	}
}
 
开发者ID:oldmud0,项目名称:Disparity-RHE,代码行数:20,代码来源:ParticleEditor.java


示例5: init

import org.newdawn.slick.particles.ParticleIO; //导入依赖的package包/类
/**
 * load ressources (the particle system) and create our duplicate emitters
 * and place them nicely on the screen
 * @param container The surrounding game container
 */
public void init(GameContainer container) throws SlickException {
	this.container = container;
	
	try {
		// load the particle system containing our explosion emitter
		explosionSystem = ParticleIO.loadConfiguredSystem("testdata/endlessexplosion.xml");
		// get the emitter, it's the first (and only one) in this particle system
		explosionEmitter = (ConfigurableEmitter) explosionSystem.getEmitter(0);
		// set the original emitter in the middle of the screen at the top
		explosionEmitter.setPosition(400,100);
		// create 5 duplicate emitters
		for (int i = 0; i < 5; i++) {
			// a single duplicate of the first emitter is created here
			ConfigurableEmitter newOne = explosionEmitter.duplicate();
			// we might get null as a result - protect against that
			if (newOne == null)
				throw new SlickException("Failed to duplicate explosionEmitter");
			// give the new emitter a new unique name
			newOne.name = newOne.name + "_" + i;
			// place it somewhere on a row below the original emitter
			newOne.setPosition((i+1)* (800/6), 400);
			// and add it to the original particle system to get the new emitter updated and rendered
			explosionSystem.addEmitter(newOne);
		}
	} catch (IOException e) {
		throw new SlickException("Failed to load particle systems", e);
	}
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:34,代码来源:DuplicateEmitterTest.java


示例6: init

import org.newdawn.slick.particles.ParticleIO; //导入依赖的package包/类
/**
 * @see org.newdawn.slick.BasicGame#init(org.newdawn.slick.GameContainer)
 */
public void init(GameContainer container) throws SlickException {
	this.container = container;
	
	try {
		fire = ParticleIO.loadConfiguredSystem("testdata/system.xml");
		trail = ParticleIO.loadConfiguredSystem("testdata/smoketrail.xml");
		
	} catch (IOException e) {
		throw new SlickException("Failed to load particle systems", e);
	}
	image = new Image("testdata/rocket.png");

	spawnRocket();
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:18,代码来源:PedigreeTest.java


示例7: AnimSpace

import org.newdawn.slick.particles.ParticleIO; //导入依赖的package包/类
public AnimSpace(){
  try {
    smoke = ParticleIO.loadConfiguredSystem("resources/space.xml");
  } catch (IOException e) {
    e.printStackTrace();
  }
  v.x = Window.WIDTH -100;
  v.y = Window.HEIGHT/2;

  smoke.setPosition(v.x, v.y);
}
 
开发者ID:Hettomei,项目名称:SpaceInvaderSlick,代码行数:12,代码来源:AnimSpace.java


示例8: importEmitter

import org.newdawn.slick.particles.ParticleIO; //导入依赖的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


示例9: loadSystem

import org.newdawn.slick.particles.ParticleIO; //导入依赖的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


示例10: init

import org.newdawn.slick.particles.ParticleIO; //导入依赖的package包/类
@Override
public void init(GameContainer arg0, StateBasedGame arg1) throws SlickException {
    player = new Player();
    buildings = new ArrayList<>();
    goons = new ArrayList<>();
    bullets = new ArrayList<>();
    playerImage = new Image("res/player.png");
    playerImage.setFilter(Image.FILTER_NEAREST);
    playerJump = new Image("res/playerjump.png");
    playerJump.setFilter(Image.FILTER_NEAREST);
    cannonImage = new Image("res/cannon.png");
    cannonImage.setFilter(Image.FILTER_LINEAR);
    cannonImage.setCenterOfRotation(Player.CANNON_CENTER_X, Player.CANNON_CENTER_Y);
    SpriteSheet playerSS = new SpriteSheet("res/player_run.png", 60, 75);
    playerRunRight = new Animation(playerSS, RUN_ANIMATION_SPEED);
    playerRunLeft  = new Animation();
    int ssw = playerSS.getHorizontalCount(), ssh = playerSS.getVerticalCount();
    for (int y = 0; y < ssh; y++) {
        for (int x = 0; x < ssw; x++) {
            playerRunLeft.addFrame(playerSS.getSprite(x, y).getFlippedCopy(true, false), RUN_ANIMATION_SPEED);
        }
    }
    bulletAnim = new Animation(new SpriteSheet("res/bullet.png", 30, 30), BULLET_ANIMATION_SPEED);
    buildingTexture = new Image("res/building.png");
    buildingLastRow = buildingTexture.getSubImage(0, buildingTexture.getHeight() - 1, buildingTexture.getWidth(), 1);
    buildingTexture.setFilter(Image.FILTER_NEAREST);
    buildingLastRow.setFilter(Image.FILTER_NEAREST);
    graffitiImages = new Image[NUM_GRAFFITI * 2];
    for (int i = 0; i < NUM_GRAFFITI; i++) {
        graffitiImages[i] = new Image("res/graffiti" + i + ".png");
        graffitiImages[i + NUM_GRAFFITI] = graffitiImages[i].getFlippedCopy(true, false);
    }
    graffiti = new ArrayList<>();
    mainTheme = new Music("res/main.ogg");
    try {
        partsys = ParticleIO.loadConfiguredSystem("res/particle.xml");
    } catch (IOException e) {
        e.printStackTrace();
    }
    fireExplosion = (ConfigurableEmitter)partsys.getEmitter(0);
    blueExplosion = (ConfigurableEmitter)partsys.getEmitter(1);
    fireExplosion.setEnabled(false);
    blueExplosion.setEnabled(false);
    fireCannon = new Sound("res/firecannon.ogg");
    highExplosion = new Sound("res/highexplosion.ogg");
    softExplosion = new Sound("res/softexplosion.ogg");
    hurtSound = new Sound("res/hurt.ogg");
    basicGoon = new Image("res/plasticbag.png");
    strongGoon = new Image("res/trashbag.png");
    flyingGoon = new Animation(new SpriteSheet("res/tshirt.png", 50, 50), 200);
    background = new Image("res/sunset.png");
    background.setFilter(Image.FILTER_NEAREST);
    camx = 0;
    camy = 0;
    camvx = 0;
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:57,代码来源:Game.java


示例11: loadParticleSystem

import org.newdawn.slick.particles.ParticleIO; //导入依赖的package包/类
/**
 * Carrega um sistema de part�culas.
 * @param path Caminho do arquivo XML do sistema de part�culas.
 * @return Sistema de part�culas carregado.
 * @throws IOException 
 */
public static ParticleSystem loadParticleSystem(String path) throws IOException {
	ParticleSystem system = ParticleIO.loadConfiguredSystem(path);
	system.setDefaultImageName("data/particles/particle.tga");
	return system;
}
 
开发者ID:intentor,项目名称:telyn,代码行数:12,代码来源:Utils.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DefaultCreator类代码示例发布时间:2022-05-22
下一篇:
Java DiagramEditPart类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap