本文整理汇总了Java中org.newdawn.slick.util.Log.warn方法的典型用法代码示例。如果您正苦于以下问题:Java Log.warn方法的具体用法?Java Log.warn怎么用?Java Log.warn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.newdawn.slick.util.Log
的用法示例。
在下文中一共展示了Log.warn方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createGraphics
import org.newdawn.slick.util.Log; //导入方法依赖的package包/类
/**
* Create an underlying graphics context for the given image
*
* @param image The image we want to render to
* @return The graphics context created
* @throws SlickException
*/
private static Graphics createGraphics(Image image) throws SlickException {
init();
if (fbo) {
try {
return new FBOGraphics(image);
} catch (Exception e) {
fbo = false;
Log.warn("FBO failed in use, falling back to PBuffer");
}
}
if (pbuffer) {
if (pbufferRT) {
return new PBufferGraphics(image);
} else {
return new PBufferUniqueGraphics(image);
}
}
throw new SlickException("Failed to create offscreen buffer even though the card reports it's possible");
}
示例2: getNewParticle
import org.newdawn.slick.util.Log; //导入方法依赖的package包/类
/**
* Get a new particle from the system. This should be used by emitters to
* request particles
*
* @param emitter The emitter requesting the particle
* @param life The time the new particle should live for
* @return A particle from the system
*/
public Particle getNewParticle(ParticleEmitter emitter, float life)
{
ParticlePool pool = (ParticlePool) particlesByEmitter.get(emitter);
ArrayList available = pool.available;
if (available.size() > 0)
{
Particle p = (Particle) available.remove(available.size()-1);
p.init(emitter, life);
p.setImage(sprite);
return p;
}
Log.warn("Ran out of particles (increase the limit)!");
return dummy;
}
示例3: load
import org.newdawn.slick.util.Log; //导入方法依赖的package包/类
/**
* Loads the image.
* @param threaded true to load the image data in a new thread
*/
public void load(boolean threaded) {
if (!file.isFile())
return;
if (threaded) {
if (loaderThread != null && loaderThread.isAlive())
loaderThread.interrupt();
loaderThread = new ImageLoaderThread();
loaderThread.start();
} else {
try {
image = new Image(file.getAbsolutePath());
} catch (SlickException e) {
Log.warn(String.format("Failed to load background image '%s'.", file), e);
}
}
}
示例4: timingPointsFromString
import org.newdawn.slick.util.Log; //导入方法依赖的package包/类
/**
* Sets the {@link #timingPoints} field from a string.
* @param s the string
*/
public void timingPointsFromString(String s) {
this.timingPoints = new ArrayList<TimingPoint>();
if (s == null)
return;
String[] tokens = s.split("\\|");
for (int i = 0; i < tokens.length; i++) {
try {
timingPoints.add(new TimingPoint(tokens[i]));
} catch (Exception e) {
Log.warn(String.format("Failed to read timing point '%s'.", tokens[i]), e);
}
}
timingPoints.trimToSize();
}
示例5: setDefaultFont
import org.newdawn.slick.util.Log; //导入方法依赖的package包/类
/**
* Set the default font that will be intialised in the graphics held in this container
*
* @param font The font to use as default
*/
public void setDefaultFont(Font font) {
if (font != null) {
this.defaultFont = font;
} else {
Log.warn("Please provide a non null font");
}
}
示例6: loadImage
import org.newdawn.slick.util.Log; //导入方法依赖的package包/类
/**
* @see org.newdawn.slick.opengl.LoadableImageData#loadImage(java.io.InputStream, boolean, boolean, int[])
*/
public ByteBuffer loadImage(InputStream is, boolean flipped, boolean forceAlpha, int[] transparent) throws IOException {
CompositeIOException exception = new CompositeIOException();
ByteBuffer buffer = null;
BufferedInputStream in = new BufferedInputStream(is, is.available());
in.mark(is.available());
// cycle through our source until one of them works
for (int i=0;i<sources.size();i++) {
in.reset();
try {
LoadableImageData data = (LoadableImageData) sources.get(i);
buffer = data.loadImage(in, flipped, forceAlpha, transparent);
picked = data;
break;
} catch (Exception e) {
Log.warn(sources.get(i).getClass()+" failed to read the data", e);
exception.addException(e);
}
}
if (picked == null) {
throw exception;
}
return buffer;
}
示例7: createValueElement
import org.newdawn.slick.util.Log; //导入方法依赖的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;
}
示例8: destroy
import org.newdawn.slick.util.Log; //导入方法依赖的package包/类
/**
* Releases all resources.
*/
public void destroy() {
interrupt();
loaderThread = null;
if (image != null && !image.isDestroyed()) {
try {
image.destroy();
} catch (SlickException e) {
Log.warn(String.format("Failed to destroy image '%s'.", image.getResourceReference()), e);
}
image = null;
}
data = null;
}
示例9: run
import org.newdawn.slick.util.Log; //导入方法依赖的package包/类
@Override
public void run() {
// load image data into a ByteBuffer to use constructor Image(ImageData)
LoadableImageData imageData = ImageDataFactory.getImageDataFor(file.getAbsolutePath());
try (BufferedInputStream in = this.in = new BufferedInputStream(new FileInputStream(file))) {
ByteBuffer textureBuffer = imageData.loadImage(in, false, null);
if (!isInterrupted())
data = new LoadedImageData(imageData, textureBuffer);
} catch (Exception e) {
if (!isInterrupted())
Log.warn(String.format("Failed to load background image '%s'.", file), e);
}
this.in = null;
}
示例10: parseValueElement
import org.newdawn.slick.util.Log; //导入方法依赖的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);
}
}
}