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


Java Log类代码示例

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


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

示例1: init

import org.newdawn.slick.util.Log; //导入依赖的package包/类
/**
 * Initialise offscreen rendering by checking what buffers are supported
 * by the card
 * 
 * @throws SlickException Indicates no buffers are supported
 */
private static void init() throws SlickException {
	init = true;
	
	if (fbo) {
		fbo = GLContext.getCapabilities().GL_EXT_framebuffer_object;
	}
	pbuffer = (Pbuffer.getCapabilities() & Pbuffer.PBUFFER_SUPPORTED) != 0;
	pbufferRT = (Pbuffer.getCapabilities() & Pbuffer.RENDER_TEXTURE_SUPPORTED) != 0;
	
	if (!fbo && !pbuffer && !pbufferRT) {
		throw new SlickException("Your OpenGL card does not support offscreen buffers and hence can't handle the dynamic images required for this application.");
	}
	
	Log.info("Offscreen Buffers FBO="+fbo+" PBUFFER="+pbuffer+" PBUFFERRT="+pbufferRT);
}
 
开发者ID:IngSW-unipv,项目名称:Progetto-C,代码行数:22,代码来源:GraphicsFactory.java

示例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;
}
 
开发者ID:IngSW-unipv,项目名称:Progetto-C,代码行数:25,代码来源:ParticleSystem.java

示例3: createDisplay

import org.newdawn.slick.util.Log; //导入依赖的package包/类
/**
 * Creates display for program, sets title and size among other things.
 */
public static void createDisplay() {

    ContextAttribs attribs = new ContextAttribs(3, 3).withForwardCompatible(true).withProfileCore(true);

    try {

        Display.setDisplayMode(new DisplayMode(Reference.WINDOW_SIZE.width, Reference.WINDOW_SIZE.height));
        Display.create(new PixelFormat().withSamples(8).withDepthBits(24), attribs);
        Display.setTitle(Reference.WINDOW_TITLE);
        GL11.glEnable(GL13.GL_MULTISAMPLE);

    } catch (LWJGLException e) {
        e.printStackTrace();
    }

    GL11.glViewport(0, 0, Reference.WINDOW_SIZE.width, Reference.WINDOW_SIZE.height);
    Log.setVerbose(false);
    lastFrameTime = getCurrentTime();

}
 
开发者ID:Essentria,项目名称:Elgin-Plant-Game,代码行数:24,代码来源:DisplayManager.java

示例4: Music

import org.newdawn.slick.util.Log; //导入依赖的package包/类
/**
 * Create and load a piece of music (either OGG or MOD/XM)
 * @param in The stream to read the music from 
 * @param ref  The symbolic name of this music 
 * @throws SlickException Indicates a failure to read the music from the stream
 */
public Music(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(".xm") || ref.toLowerCase().endsWith(".mod")) {
			sound = SoundStore.get().getMOD(in);
		} else if (ref.toLowerCase().endsWith(".aif") || ref.toLowerCase().endsWith(".aiff")) {
			sound = SoundStore.get().getAIF(in);
		} 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 music: "+ref);
	}
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:27,代码来源:Music.java

示例5: 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:IngSW-unipv,项目名称:Progetto-C,代码行数:29,代码来源:Image.java

示例6: 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:IngSW-unipv,项目名称:Progetto-C,代码行数:30,代码来源:Image.java

示例7: drawString

import org.newdawn.slick.util.Log; //导入依赖的package包/类
/**
 * @see Font#drawString(float, float, String, Color, int, int)
 */
public void drawString(float x, float y, String text, Color col, int startIndex, int endIndex) {
	try {
		byte[] data = text.getBytes("US-ASCII");
		for (int i = 0; i < data.length; i++) {
			int index = data[i] - startingCharacter;
			if (index < numChars) {
				int xPos = (index % horizontalCount);
				int yPos = (index / horizontalCount);
				
				if ((i >= startIndex) || (i <= endIndex)) {
					font.getSprite(xPos, yPos)
							.draw(x + (i * charWidth), y, col);
				}
			}
		}
	} catch (UnsupportedEncodingException e) {
		// Should never happen, ASCII is supported pretty much anywhere
		Log.error(e);
	}
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:24,代码来源:SpriteSheetFont.java

示例8: initGL

import org.newdawn.slick.util.Log; //导入依赖的package包/类
/**
 * Initialise the GL context
 */
protected void initGL() {
	Log.info("Starting display "+width+"x"+height);
	GL.initDisplay(width, height);
	
	if (input == null) {
		input = new Input(height);
	}
	input.init(height);
	// no need to remove listeners?
	//input.removeAllListeners();
	if (game instanceof InputListener) {
		input.removeListener((InputListener) game);
		input.addListener((InputListener) game);
	}

	if (graphics != null) {
		graphics.setDimensions(getWidth(), getHeight());
	}
	lastGame = game;
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:24,代码来源:GameContainer.java

示例9: Graphics

import org.newdawn.slick.util.Log; //导入依赖的package包/类
/**
 * Create a new graphics context. Only the container should be doing this
 * really
 * 
 * @param width
 *            The width of the screen for this context
 * @param height
 *            The height of the screen for this context
 */
public Graphics(int width, int height) {
	if (DEFAULT_FONT == null) {
		AccessController.doPrivileged(new PrivilegedAction() {
			public Object run() {
				try {
					DEFAULT_FONT = new AngelCodeFont(
							"org/newdawn/slick/data/defaultfont.fnt",
							"org/newdawn/slick/data/defaultfont.png");
				} catch (SlickException e) {
					Log.error(e);
				}
				return null; // nothing to return
			}
		});
	}
	
	this.font = DEFAULT_FONT;
	screenWidth = width;
	screenHeight = height;
}
 
开发者ID:IngSW-unipv,项目名称:Progetto-C,代码行数:30,代码来源:Graphics.java

示例10: checkProperty

import org.newdawn.slick.util.Log; //导入依赖的package包/类
/**
 * Check PNG loader property. If set the native PNG loader will
 * not be used.
 */
private static void checkProperty() {
	if (!pngLoaderPropertyChecked) {
		pngLoaderPropertyChecked = true;

		try {
			AccessController.doPrivileged(new PrivilegedAction() {
	            public Object run() {
					String val = System.getProperty(PNG_LOADER);
					if ("false".equalsIgnoreCase(val)) {
						usePngLoader = false;
					}
					
					Log.info("Use Java PNG Loader = " + usePngLoader);
					return null;
	            }
			});
		} catch (Throwable e) {
			// ignore, security failure - probably an applet
		}
	}
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:26,代码来源:ImageDataFactory.java

示例11: setMouseCursor

import org.newdawn.slick.util.Log; //导入依赖的package包/类
/**
 * @see org.newdawn.slick.GameContainer#setMouseCursor(org.newdawn.slick.Image, int, int)
 */
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(),image.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:j-dong,项目名称:trashjam2017,代码行数:21,代码来源:AppGameContainer.java

示例12: 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:j-dong,项目名称:trashjam2017,代码行数:28,代码来源:Sound.java

示例13: init

import org.newdawn.slick.util.Log; //导入依赖的package包/类
/**
 * Initialise the PBuffer that will be used to render to
 * 
 * @throws SlickException
 */
private void init() throws SlickException {
	try {
		Texture tex = InternalTextureLoader.get().createTexture(image.getWidth(), image.getHeight(), image.getFilter());

		pbuffer = new Pbuffer(screenWidth, screenHeight, new PixelFormat(8, 0, 0), null, null);
		// Initialise state of the pbuffer context.
		pbuffer.makeCurrent();

		initGL();
		image.draw(0,0);
		GL11.glBindTexture(GL11.GL_TEXTURE_2D, tex.getTextureID());
		GL11.glCopyTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGBA, 0, 0, 
							  tex.getTextureWidth(), 
							  tex.getTextureHeight(), 0);
		image.setTexture(tex);
		
		Display.makeCurrent();
	} catch (Exception e) {
		Log.error(e);
		throw new SlickException("Failed to create PBuffer for dynamic image. OpenGL driver failure?");
	}
}
 
开发者ID:IngSW-unipv,项目名称:Progetto-C,代码行数:28,代码来源:PBufferUniqueGraphics.java

示例14: getCursor

import org.newdawn.slick.util.Log; //导入依赖的package包/类
/**
 * Get a cursor based on a set of image data
 * 
 * @param buf The image data (stored in RGBA) to load the cursor from
 * @param x The x-coordinate of the cursor hotspot (left -> right)
 * @param y The y-coordinate of the cursor hotspot (bottom -> top)
 * @param width The width of the image data provided
 * @param height The height of the image data provided
 * @return The create cursor
 * @throws IOException Indicates a failure to load the image
 * @throws LWJGLException Indicates a failure to create the hardware cursor
 */
public Cursor getCursor(ByteBuffer buf,int x,int y,int width,int height) throws IOException, LWJGLException {
	for (int i=0;i<buf.limit();i+=4) {
		byte red = buf.get(i);
		byte green = buf.get(i+1);
		byte blue = buf.get(i+2);
		byte alpha = buf.get(i+3);
		
		buf.put(i+2, red);
		buf.put(i+1, green);
		buf.put(i, blue);
		buf.put(i+3, alpha);
	}
	
	try {
		int yspot = height - y - 1;
		if (yspot < 0) {
			yspot = 0;
		}
		return new Cursor(width,height, x, yspot, 1, buf.asIntBuffer(), null);
	} catch (Throwable e) {
		Log.info("Chances are you cursor is too small for this platform");
		throw new LWJGLException(e);
	}
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:37,代码来源:CursorLoader.java

示例15: 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");
}
 
开发者ID:IngSW-unipv,项目名称:Progetto-C,代码行数:30,代码来源:GraphicsFactory.java


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