本文整理汇总了Java中org.newdawn.slick.particles.ConfigurableEmitter类的典型用法代码示例。如果您正苦于以下问题:Java ConfigurableEmitter类的具体用法?Java ConfigurableEmitter怎么用?Java ConfigurableEmitter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConfigurableEmitter类属于org.newdawn.slick.particles包,在下文中一共展示了ConfigurableEmitter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: update
import org.newdawn.slick.particles.ConfigurableEmitter; //导入依赖的package包/类
public void update(GameContainer container, int delta)
throws SlickException {
if (!paused) {
ypos += delta * 0.002 * systemMove;
if (ypos > 300) {
ypos = -300;
}
if (ypos < -300) {
ypos = 300;
}
for (int i = 0; i < emitters.size(); i++) {
((ConfigurableEmitter) emitters.get(i)).replayCheck();
}
for (int i = 0; i < delta; i++) {
system.update(1);
}
}
Display.sync(100);
}
示例2: browseForImage
import org.newdawn.slick.particles.ConfigurableEmitter; //导入依赖的package包/类
/**
* Browse for a particle image and set the value into both the emitter and text field
* on successful completion
*/
private void browseForImage() {
if (emitter != null) {
int resp = chooser.showOpenDialog(this);
if (resp == JFileChooser.APPROVE_OPTION) {
File file = chooser.getSelectedFile();
String path = file.getParentFile().getAbsolutePath();
String name = file.getName();
ConfigurableEmitter.setRelativePath(path);
emitter.setImageName(name);
imageName.setText(name);
}
}
}
示例3: cloneEmitter
import org.newdawn.slick.particles.ConfigurableEmitter; //导入依赖的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());
}
}
示例4: init
import org.newdawn.slick.particles.ConfigurableEmitter; //导入依赖的package包/类
@Override
public void init(GameContainer container, StateBasedGame game) throws SlickException {
try {
this.barks = Utils.loadParticleSystem("data/particles/drawing.xml");
this.drawingEffectEmitter = (ConfigurableEmitter)this.barks.getEmitter(0);
this.segment = Utils.loadParticleSystem("data/particles/segment.xml");
} catch (IOException e) {
e.printStackTrace();
}
this.hud.init(container, game);
this.drawingPositions = new Vec2[MAX_DRAWING_LENGTH];
for (int i = 0; i < this.drawingPositions.length; i++) this.drawingPositions[i] = new Vec2();
this.drawings = new LinkedList<Body>();
}
示例5: init
import org.newdawn.slick.particles.ConfigurableEmitter; //导入依赖的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);
}
}
示例6: render
import org.newdawn.slick.particles.ConfigurableEmitter; //导入依赖的package包/类
/**
* @see org.newdawn.slick.BasicGame#render(org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics)
*/
public void render(GameContainer container, Graphics g) {
((ConfigurableEmitter) trail.getEmitter(0)).setPosition(rx+14,ry+35);
trail.render();
image.draw((int) rx,(int) ry);
g.translate(400, 300);
fire.render();
}
示例7: mousePressed
import org.newdawn.slick.particles.ConfigurableEmitter; //导入依赖的package包/类
public void mousePressed(int button, int x, int y) {
super.mousePressed(button, x, y);
for (int i=0;i<fire.getEmitterCount();i++) {
((ConfigurableEmitter) fire.getEmitter(i)).setPosition(x - 400, y - 300, true);
}
}
示例8: linkEmitterToFields
import org.newdawn.slick.particles.ConfigurableEmitter; //导入依赖的package包/类
/**
* @see org.newdawn.slick.tools.peditor.ControlPanel#linkEmitterToFields(org.newdawn.slick.particles.ConfigurableEmitter)
*/
protected void linkEmitterToFields(ConfigurableEmitter emitter) {
link(emitter.spawnInterval, "spawnInterval");
link(emitter.spawnCount, "spawnCount");
link(emitter.initialSize, "initialSize");
link(emitter.initialLife, "initialLife");
link(emitter.speed, "speed");
link(emitter.growthFactor, "growth");
}
示例9: linkEmitterToFields
import org.newdawn.slick.particles.ConfigurableEmitter; //导入依赖的package包/类
/**
* @see org.newdawn.slick.tools.peditor.ControlPanel#linkEmitterToFields(org.newdawn.slick.particles.ConfigurableEmitter)
*/
protected void linkEmitterToFields(ConfigurableEmitter emitter) {
this.emitter = emitter;
// register the new emitter
editor.setLinkedEmitter(emitter);
valueMap.clear();
linkToEmitter("Alpha", emitter.alpha);
linkToEmitter("Size", emitter.size);
linkToEmitter("Velocity", emitter.velocity);
linkToEmitter("ScaleY", emitter.scaleY);
editor.setFirstProperty();
}
示例10: addEmitter
import org.newdawn.slick.particles.ConfigurableEmitter; //导入依赖的package包/类
/**
* Add an emitter to the particle system held here
*
* @param emitter
* The emitter to add
*/
public void addEmitter(ConfigurableEmitter emitter) {
emitters.add(emitter);
if (system == null) {
waiting.add(emitter);
} else {
system.addEmitter(emitter);
}
}
示例11: getListCellRendererComponent
import org.newdawn.slick.particles.ConfigurableEmitter; //导入依赖的package包/类
/**
* @see javax.swing.DefaultListCellRenderer#getListCellRendererComponent(javax.swing.JList, java.lang.Object, int, boolean, boolean)
*/
public Component getListCellRendererComponent(JList list, final Object value, int index, boolean isSelected, boolean cellHasFocus) {
JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected,
cellHasFocus);
final JCheckBox box = new JCheckBox(label.getText());
box.setBackground(label.getBackground());
box.setSelected(((ConfigurableEmitter) value).isEnabled());
checks.put(value, box);
return box;
}
示例12: linkEmitterToFields
import org.newdawn.slick.particles.ConfigurableEmitter; //导入依赖的package包/类
/**
* @see org.newdawn.slick.tools.peditor.ControlPanel#linkEmitterToFields(org.newdawn.slick.particles.ConfigurableEmitter)
*/
protected void linkEmitterToFields(ConfigurableEmitter emitter) {
name.setText(emitter.name);
String value = emitter.getImageName();
if (value != null) {
value = value.substring(value.lastIndexOf(File.separatorChar)+1);
imageName.setText(value);
}
link(emitter.gravityFactor, "gravity");
link(emitter.windFactor, "wind");
}
示例13: setCurrentEmitter
import org.newdawn.slick.particles.ConfigurableEmitter; //导入依赖的package包/类
/**
* Set the currently selected and edited particle emitter
*
* @param emitter The emitter that should be selected or null for none
*/
public void setCurrentEmitter(ConfigurableEmitter emitter) {
this.selected = emitter;
if (emitter == null) {
emissionControls.setEnabled(false);
settingsPanel.setEnabled(false);
positionControls.setEnabled(false);
colorPanel.setEnabled(false);
limitPanel.setEnabled(false);
whiskasPanel.setEnabled(false);
} else {
emissionControls.setEnabled(true);
settingsPanel.setEnabled(true);
positionControls.setEnabled(true);
colorPanel.setEnabled(true);
limitPanel.setEnabled(true);
whiskasPanel.setEnabled(true);
emissionControls.setTarget(emitter);
settingsPanel.setTarget(emitter);
positionControls.setTarget(emitter);
settingsPanel.setTarget(emitter);
colorPanel.setTarget(emitter);
limitPanel.setTarget(emitter);
whiskasPanel.setTarget(emitter);
}
}
示例14: setLinkedEmitter
import org.newdawn.slick.particles.ConfigurableEmitter; //导入依赖的package包/类
/**
* Set the emitter that is being controlled
*
* @param emitter The emitter that is configured by this panel
*/
public void setLinkedEmitter(ConfigurableEmitter emitter) {
// set the title
Window w = SwingUtilities.windowForComponent(this);
if (w instanceof Frame)
((Frame) w).setTitle("Whiskas Gradient Editor (" + emitter.name
+ ")");
// clear all values
properties.removeAllItems();
values.clear();
panel.setInterpolator(null);
enableControls();
}
示例15: linkEmitterToFields
import org.newdawn.slick.particles.ConfigurableEmitter; //导入依赖的package包/类
/**
* @see org.newdawn.slick.tools.peditor.ControlPanel#linkEmitterToFields(org.newdawn.slick.particles.ConfigurableEmitter)
*/
protected void linkEmitterToFields(ConfigurableEmitter emitter) {
link(emitter.xOffset, "x");
link(emitter.yOffset, "y");
link(emitter.spread, "spread");
link(emitter.angularOffset, "angularOffset");
link(emitter.initialDistance, "initialDistance");
}