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

Java RandomValue类代码示例

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

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



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

示例1: valueUpdated

import org.newdawn.slick.particles.ConfigurableEmitter.RandomValue; //导入依赖的package包/类
/**
 * @see org.newdawn.slick.tools.peditor.InputPanelListener#valueUpdated(org.newdawn.slick.tools.peditor.ValuePanel)
 */
public void valueUpdated(ValuePanel source) {
	if (emitter == null) {
		return;
	}
	
	Value value = (Value) controlToData.get(source);
	if (value != null) {
		if( value instanceof SimpleValue)
			((SimpleValue)value).setValue( source.getValue());
		else if( value instanceof RandomValue )
			((RandomValue)value).setValue( source.getValue());
	} else {
		throw new RuntimeException("No data set specified for the GUI source");
	}
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:19,代码来源:ControlPanel.java


示例2: createValueElement

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

import org.newdawn.slick.particles.ConfigurableEmitter.RandomValue; //导入依赖的package包/类
/**
 * Link a emitter configurable value to a value panel
 * 
 * @param value The configurable value from the emitter
 * @param panel The component to link against
 */
private void link(Value value, ValuePanel panel) {
	controlToData.put(panel, value);
	
	if( value instanceof SimpleValue )
		panel.setValue((int) ((SimpleValue)value).getValue( 0 ));
	else if( value instanceof RandomValue )
		panel.setValue((int) ((RandomValue)value).getValue());
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:15,代码来源:ControlPanel.java


示例4: parseValueElement

import org.newdawn.slick.particles.ConfigurableEmitter.RandomValue; //导入依赖的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.RandomValue类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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