当前位置: 首页>>代码示例>>Java>>正文


Java Log.error方法代码示例

本文整理汇总了Java中org.newdawn.slick.util.Log.error方法的典型用法代码示例。如果您正苦于以下问题:Java Log.error方法的具体用法?Java Log.error怎么用?Java Log.error使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.newdawn.slick.util.Log的用法示例。


在下文中一共展示了Log.error方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: Image

import org.newdawn.slick.util.Log; //导入方法依赖的package包/类
/**
 * Create an image based on a file at the specified location
 * 
 * @param ref The location of the image file to load
 * @param flipped True if the image should be flipped on the y-axis on load
 * @param f The filtering method to use when scaling this image
 * @param transparent The color to treat as transparent
 * @throws SlickException Indicates a failure to load the image
 */
public Image(String ref, boolean flipped, int f, Color transparent) throws SlickException {
	this.filter = f == FILTER_LINEAR ? SGL.GL_LINEAR : SGL.GL_NEAREST;
	this.transparent = transparent;
	this.flipped = flipped;
	
	try {
		this.ref = ref;
		int[] trans = null;
		if (transparent != null) {
			trans = new int[3];
			trans[0] = (int) (transparent.r * 255);
			trans[1] = (int) (transparent.g * 255);
			trans[2] = (int) (transparent.b * 255);
		}
		texture = InternalTextureLoader.get().getTexture(ref, flipped, filter, trans);
	} catch (IOException e) {
		Log.error(e);
		throw new SlickException("Failed to load image from: "+ref, e);
	}
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:30,代码来源:Image.java

示例2: load

import org.newdawn.slick.util.Log; //导入方法依赖的package包/类
/**
 * Load the image
 * 
 * @param in The input stream to read the image from
 * @param ref The name that should be assigned to the image
 * @param flipped True if the image should be flipped on the y-axis  on load
 * @param f The filter to use when scaling this image
 * @param transparent The color to treat as transparent
 * @throws SlickException Indicates a failure to load the image
 */
private void load(InputStream in, String ref, boolean flipped, int f, Color transparent) throws SlickException {
	this.filter = f == FILTER_LINEAR ? SGL.GL_LINEAR : SGL.GL_NEAREST;
	
	try {
		this.ref = ref;
		int[] trans = null;
		if (transparent != null) {
			trans = new int[3];
			trans[0] = (int) (transparent.r * 255);
			trans[1] = (int) (transparent.g * 255);
			trans[2] = (int) (transparent.b * 255);
		}
		texture = InternalTextureLoader.get().getTexture(in, ref, flipped, filter, trans);
	} catch (IOException e) {
		Log.error(e);
		throw new SlickException("Failed to load image from: "+ref, e);
	}
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:29,代码来源:Image.java

示例3: setMouseCursor

import org.newdawn.slick.util.Log; //导入方法依赖的package包/类
/**
  * {@inheritDoc}
  */
 public void setMouseCursor(Image image, int hotSpotX, int hotSpotY) throws SlickException {
     try {
        Image temp = new Image(get2Fold(image.getWidth()), get2Fold(image.getHeight()));
        Graphics g = temp.getGraphics();
        
        ByteBuffer buffer = BufferUtils.createByteBuffer(temp.getWidth() * temp.getHeight() * 4);
        g.drawImage(image.getFlippedCopy(false, true), 0, 0);
        g.flush();
        g.getArea(0,0,temp.getWidth(),temp.getHeight(),buffer);
        
        Cursor cursor = CursorLoader.get().getCursor(buffer, hotSpotX, hotSpotY,temp.getWidth(),temp.getHeight());
        Mouse.setNativeCursor(cursor);
     } catch (Throwable e) {
        Log.error("Failed to load and apply cursor.", e);
throw new SlickException("Failed to set mouse cursor", e);
     }
  }
 
开发者ID:IngSW-unipv,项目名称:Progetto-C,代码行数:21,代码来源:AppletGameContainer.java

示例4: Sound

import org.newdawn.slick.util.Log; //导入方法依赖的package包/类
/**
 * Create a new Sound 
 * 
 * @param url The location of the OGG or MOD/XM to load
 * @throws SlickException Indicates a failure to load the sound effect
 */
public Sound(URL url) throws SlickException {
	SoundStore.get().init();
	String ref = url.getFile();
	
	try {
		if (ref.toLowerCase().endsWith(".ogg")) {
			sound = SoundStore.get().getOgg(url.openStream());
		} else if (ref.toLowerCase().endsWith(".wav")) {
			sound = SoundStore.get().getWAV(url.openStream());
		} else if (ref.toLowerCase().endsWith(".aif")) {
			sound = SoundStore.get().getAIF(url.openStream());
		} else if (ref.toLowerCase().endsWith(".xm") || ref.toLowerCase().endsWith(".mod")) {
			sound = SoundStore.get().getMOD(url.openStream());
		} else {
			throw new SlickException("Only .xm, .mod, .aif, .wav and .ogg are currently supported.");
		}
	} catch (Exception e) {
		Log.error(e);
		throw new SlickException("Failed to load sound: "+ref);
	}
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:28,代码来源:Sound.java

示例5: getNextTransitionPair

import org.newdawn.slick.util.Log; //导入方法依赖的package包/类
/**
 * Get the next transition pair that we'lluse
 * 
 * @return The pair of transitions used to enter and leave the next state
 */
public Transition[] getNextTransitionPair() {
	Transition[] pair = new Transition[2];
	
	try {
		if (transitions[index][0] != null) {
			pair[0] = (Transition) transitions[index][0].newInstance();
		}
		if (transitions[index][1] != null) {
			pair[1] = (Transition) transitions[index][1].newInstance();
		}
	} catch (Throwable e) {
		Log.error(e);
	}
	
	index++;
	if (index >= transitions.length) {
		index = 0;
	}
	
	return pair;
}
 
开发者ID:IngSW-unipv,项目名称:Progetto-C,代码行数:27,代码来源:TransitionTest.java

示例6: keyPressed

import org.newdawn.slick.util.Log; //导入方法依赖的package包/类
/**
 * @see org.newdawn.slick.BasicGame#keyPressed(int, char)
 */
public void keyPressed(int key, char c) {
	if (key == Input.KEY_ESCAPE) {
		System.exit(0);
	}
	if (key == Input.KEY_F2) {
		app.setDefaultMouseCursor();
	}
	if (key == Input.KEY_F1) {
		if (app != null) {
			try {
				app.setDisplayMode(640,480,false);		
			} catch (SlickException e) {
				Log.error(e);
			}
		}
	}
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:21,代码来源:GUITest.java

示例7: Music

import org.newdawn.slick.util.Log; //导入方法依赖的package包/类
/**
 * Create and load a piece of music (either OGG or MOD/XM)
 * 
 * @param url The location of the music
 * @param streamingHint A hint to indicate whether streaming should be used if possible
 * @throws SlickException
 */
public Music(URL url, boolean streamingHint) throws SlickException {
	SoundStore.get().init();
	String ref = url.getFile();
	
	try {
		if (ref.toLowerCase().endsWith(".ogg")) {
			if (streamingHint) {
				sound = SoundStore.get().getOggStream(url);
			} else {
				sound = SoundStore.get().getOgg(url.openStream());
			}
		} else if (ref.toLowerCase().endsWith(".wav")) {
			sound = SoundStore.get().getWAV(url.openStream());
		} else if (ref.toLowerCase().endsWith(".xm") || ref.toLowerCase().endsWith(".mod")) {
			sound = SoundStore.get().getMOD(url.openStream());
		} else if (ref.toLowerCase().endsWith(".aif") || ref.toLowerCase().endsWith(".aiff")) {
			sound = SoundStore.get().getAIF(url.openStream());
		} else {
			throw new SlickException("Only .xm, .mod, .ogg, and .aif/f are currently supported.");
		}
	} catch (Exception e) {
		Log.error(e);
		throw new SlickException("Failed to load sound: "+url);
	}
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:33,代码来源:Music.java

示例8: Sound

import org.newdawn.slick.util.Log; //导入方法依赖的package包/类
/**
 * Create a new Sound 
 * 
 * @param in The location of the OGG or MOD/XM to load
 * @param ref The name to associate this stream
 * @throws SlickException Indicates a failure to load the sound effect
 */
public Sound(InputStream in, String ref) throws SlickException {
	SoundStore.get().init();
	
	try {
		if (ref.toLowerCase().endsWith(".ogg")) {
			sound = SoundStore.get().getOgg(in);
		} else if (ref.toLowerCase().endsWith(".wav")) {
			sound = SoundStore.get().getWAV(in);
		} else if (ref.toLowerCase().endsWith(".aif")) {
			sound = SoundStore.get().getAIF(in);
		} else if (ref.toLowerCase().endsWith(".xm") || ref.toLowerCase().endsWith(".mod")) {
			sound = SoundStore.get().getMOD(in);
		} else {
			throw new SlickException("Only .xm, .mod, .aif, .wav and .ogg are currently supported.");
		}
	} catch (Exception e) {
		Log.error(e);
		throw new SlickException("Failed to load sound: "+ref);
	}
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:28,代码来源:Sound.java

示例9: disable

import org.newdawn.slick.util.Log; //导入方法依赖的package包/类
/**
 * @see org.newdawn.slick.Graphics#disable()
 */
protected void disable() {
	GL.flush();
	
	// Bind the texture after rendering.
	GL.glBindTexture(GL11.GL_TEXTURE_2D, image.getTexture().getTextureID());
	pbuffer.bindTexImage(Pbuffer.FRONT_LEFT_BUFFER);
	
	try {
		Display.makeCurrent();
	} catch (LWJGLException e) {
		Log.error(e);
	}
	
	SlickCallable.leaveSafeBlock();
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:19,代码来源:PBufferGraphics.java

示例10: duplicate

import org.newdawn.slick.util.Log; //导入方法依赖的package包/类
/**
 * Create a duplicate of this emitter.
 * The duplicate should be added to a ParticleSystem to be used.
 * @return a copy if no IOException occurred, null otherwise
 */
public ConfigurableEmitter duplicate() {
	ConfigurableEmitter theCopy = null;
	try {
		ByteArrayOutputStream bout = new ByteArrayOutputStream();
		ParticleIO.saveEmitter(bout, this);
		ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
		theCopy = ParticleIO.loadEmitter(bin);
	} catch (IOException e) {
		Log.error("Slick: ConfigurableEmitter.duplicate(): caught exception " + e.toString());
		return null;
	}
	return theCopy;
}
 
开发者ID:IngSW-unipv,项目名称:Progetto-C,代码行数:19,代码来源:ConfigurableEmitter.java

示例11: initGL

import org.newdawn.slick.util.Log; //导入方法依赖的package包/类
/**
 * Initialise GL state
 */
protected void initGL() {
   try {
      InternalTextureLoader.get().clear();
      SoundStore.get().clear();

      container.initApplet();
   } catch (Exception e) {
      Log.error(e);
      container.stopApplet();
   }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:15,代码来源:AppletGameContainer.java

示例12: setMouseCursor

import org.newdawn.slick.util.Log; //导入方法依赖的package包/类
/**
 * @see org.newdawn.slick.GameContainer#setMouseCursor(org.lwjgl.input.Cursor, int, int)
 */
public void setMouseCursor(Cursor cursor, int hotSpotX, int hotSpotY) throws SlickException {
	try {
		Mouse.setNativeCursor(cursor);
	} catch (Throwable e) {
		Log.error("Failed to load and apply cursor.", e);
		throw new SlickException("Failed to set mouse cursor", e);
	}
}
 
开发者ID:IngSW-unipv,项目名称:Progetto-C,代码行数:12,代码来源:AppGameContainer.java

示例13: run

import org.newdawn.slick.util.Log; //导入方法依赖的package包/类
public Object run() {
    		try {
    			Display.getDisplayMode();
    		} catch (Exception e) {
    			Log.error(e);
    		}
return null;
        }
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:9,代码来源:AppGameContainer.java

示例14: setDefaultMouseCursor

import org.newdawn.slick.util.Log; //导入方法依赖的package包/类
/**
 * @see org.newdawn.slick.GameContainer#setDefaultMouseCursor()
 */
public void setDefaultMouseCursor() {
	try {
		Mouse.setNativeCursor(null);
	} catch (LWJGLException e) {
		Log.error("Failed to reset mouse cursor", e);
	}
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:11,代码来源:AppGameContainer.java

示例15: main

import org.newdawn.slick.util.Log; //导入方法依赖的package包/类
/**
 * Entry point in the editor
 * 
 * @param argv The arguments passed on the command line
 */
public static void main(String[] argv) {
	try {
		UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
	
		new ParticleEditor();
	} catch (Exception e) {
		Log.error(e);
	}
}
 
开发者ID:IngSW-unipv,项目名称:Progetto-C,代码行数:15,代码来源:ParticleEditor.java


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