本文整理汇总了Java中org.newdawn.slick.particles.ConfigurableEmitter.LinearInterpolator类的典型用法代码示例。如果您正苦于以下问题:Java LinearInterpolator类的具体用法?Java LinearInterpolator怎么用?Java LinearInterpolator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LinearInterpolator类属于org.newdawn.slick.particles.ConfigurableEmitter包,在下文中一共展示了LinearInterpolator类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: setInterpolator
import org.newdawn.slick.particles.ConfigurableEmitter.LinearInterpolator; //导入依赖的package包/类
/**
* Set the interpolator being configured
*
* @param value The value to be configured
*/
public void setInterpolator(LinearInterpolator value) {
if (value == null) {
this.value = null;
this.curve = null;
} else {
this.value = value;
curve = convertToCurvePointCurve(value.getCurve());
minSpinner.setValue(new Integer(value.getMin()));
maxSpinner.setValue(new Integer(value.getMax()));
worldMinY = value.getMin();
worldMaxY = value.getMax();
repaint();
}
}
开发者ID:j-dong,项目名称:trashjam2017,代码行数:23,代码来源:GraphEditorWindow.java
示例2: createValueElement
import org.newdawn.slick.particles.ConfigurableEmitter.LinearInterpolator; //导入依赖的package包/类
/**
* Create an XML element based on a configured value
*
* @param document
* The document the element will be part of
* @param name
* The name to give the new element
* @param value
* The configured value
* @return A configure XML element based on the value
*/
private static Element createValueElement(Document document, String name,
ConfigurableEmitter.Value value) {
Element element = document.createElement(name);
// void: now writes the value type
if (value instanceof SimpleValue) {
element.setAttribute("type", "simple");
element.setAttribute("value", "" + value.getValue(0));
} else if (value instanceof RandomValue) {
element.setAttribute("type", "random");
element
.setAttribute("value", ""
+ ((RandomValue) value).getValue());
} else if (value instanceof LinearInterpolator) {
element.setAttribute("type", "linear");
element.setAttribute("min", ""
+ ((LinearInterpolator) value).getMin());
element.setAttribute("max", ""
+ ((LinearInterpolator) value).getMax());
element.setAttribute("active", ""
+ ((LinearInterpolator) value).isActive());
ArrayList curve = ((LinearInterpolator) value).getCurve();
for (int i = 0; i < curve.size(); i++) {
Vector2f point = (Vector2f) curve.get(i);
Element pointElement = document.createElement("point");
pointElement.setAttribute("x", "" + point.x);
pointElement.setAttribute("y", "" + point.y);
element.appendChild(pointElement);
}
} else {
Log.warn("unkown value type ignored: " + value.getClass());
}
return element;
}
开发者ID:j-dong,项目名称:trashjam2017,代码行数:50,代码来源:ParticleIO.java
示例3: itemStateChangedHandler
import org.newdawn.slick.particles.ConfigurableEmitter.LinearInterpolator; //导入依赖的package包/类
/**
* Notificaiton that one of the configuration option has changed state
*
* @param e The event describing the change of state
*/
public void itemStateChangedHandler(ItemEvent e) {
String valueName = (String) controlToValueName.get(e.getSource());
LinearInterpolator value = (LinearInterpolator) valueMap.get(valueName);
if (e.getStateChange() == ItemEvent.SELECTED) {
value.setActive(true);
editor.registerValue(value, valueName);
} else {
value.setActive(false);
editor.removeValue(valueName);
}
}
开发者ID:j-dong,项目名称:trashjam2017,代码行数:18,代码来源:WhiskasPanel.java
示例4: linkToEmitter
import org.newdawn.slick.particles.ConfigurableEmitter.LinearInterpolator; //导入依赖的package包/类
/**
* Link this set of controls to a linear interpolater within the particle emitter
*
* @param name The name of the article emitter being linked
* @param interpol The interpolator being configured
*/
private void linkToEmitter(String name, LinearInterpolator interpol) {
// put to value map
valueMap.put(name, interpol);
// now update the checkbox to represent the state of the given
// interpolator
boolean checked = interpol.isActive();
JCheckBox enableControl = (JCheckBox) valueNameToControl.get(name);
enableControl.setSelected(false);
if (checked)
enableControl.setSelected(checked);
}
开发者ID:j-dong,项目名称:trashjam2017,代码行数:19,代码来源:WhiskasPanel.java
示例5: registerValue
import org.newdawn.slick.particles.ConfigurableEmitter.LinearInterpolator; //导入依赖的package包/类
/**
* Register a configurable value with the graph panel
*
* @param value The value to be registered
* @param name The name to display for this value
*/
public void registerValue(LinearInterpolator value, String name) {
// add to properties combobox
properties.addItem(name);
// add to value map
values.put(name, value);
// set as current interpolator
panel.setInterpolator(value);
// enable all input fields
enableControls();
}
开发者ID:j-dong,项目名称:trashjam2017,代码行数:20,代码来源:GraphEditorWindow.java
示例6: setFirstProperty
import org.newdawn.slick.particles.ConfigurableEmitter.LinearInterpolator; //导入依赖的package包/类
/**
* Indicate that the first property should be displayed
*/
public void setFirstProperty() {
if (properties.getItemCount() > 0) {
properties.setSelectedIndex(0);
LinearInterpolator currentValue = (LinearInterpolator) values
.get(properties.getSelectedItem());
panel.setInterpolator(currentValue);
}
}
开发者ID:j-dong,项目名称:trashjam2017,代码行数:13,代码来源:GraphEditorWindow.java
示例7: parseValueElement
import org.newdawn.slick.particles.ConfigurableEmitter.LinearInterpolator; //导入依赖的package包/类
/**
* Parse an XML element into a configured value
*
* @param element
* The XML element to parse
* @param value
* The value to configure based on the XML
*/
private static void parseValueElement(Element element,
ConfigurableEmitter.Value value) {
if (element == null) {
return;
}
String type = element.getAttribute("type");
String v = element.getAttribute("value");
if (type == null || type.length() == 0) {
// support for old style which did not write the type
if (value instanceof SimpleValue) {
((SimpleValue) value).setValue(Float.parseFloat(v));
} else if (value instanceof RandomValue) {
((RandomValue) value).setValue(Float.parseFloat(v));
} else {
Log.warn("problems reading element, skipping: " + element);
}
} else {
// type given: this is the new style
if (type.equals("simple")) {
((SimpleValue) value).setValue(Float.parseFloat(v));
} else if (type.equals("random")) {
((RandomValue) value).setValue(Float.parseFloat(v));
} else if (type.equals("linear")) {
String min = element.getAttribute("min");
String max = element.getAttribute("max");
String active = element.getAttribute("active");
NodeList points = element.getElementsByTagName("point");
ArrayList curve = new ArrayList();
for (int i = 0; i < points.getLength(); i++) {
Element point = (Element) points.item(i);
float x = Float.parseFloat(point.getAttribute("x"));
float y = Float.parseFloat(point.getAttribute("y"));
curve.add(new Vector2f(x, y));
}
((LinearInterpolator) value).setCurve(curve);
((LinearInterpolator) value).setMin(Integer.parseInt(min));
((LinearInterpolator) value).setMax(Integer.parseInt(max));
((LinearInterpolator) value).setActive("true".equals(active));
} else {
Log.warn("unkown type detected: " + type);
}
}
}
开发者ID:j-dong,项目名称:trashjam2017,代码行数:59,代码来源:ParticleIO.java
注:本文中的org.newdawn.slick.particles.ConfigurableEmitter.LinearInterpolator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论