Java Code Examples for org.newdawn.slick.util.Log#debug()

The following examples show how to use org.newdawn.slick.util.Log#debug() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SkinLoader.java    From opsu-dance with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Splits line into two strings: tag, value.
 * If no ':' character is present, null will be returned.
 */
private static String[] tokenize(String line) {
	int index = line.indexOf(':');
	if (index == -1) {
		Log.debug(String.format("Failed to tokenize line: '%s'.", line));
		return null;
	}

	String[] tokens = new String[2];
	tokens[0] = line.substring(0, index).trim();
	tokens[1] = line.substring(index + 1).trim();
	return tokens;
}
 
Example 2
Source File: TimingPoint.java    From opsu-dance with GNU General Public License v3.0 5 votes vote down vote up
/**
	 * Constructor.
	 * @param line the line to be parsed
	 */
	public TimingPoint(String line) {
		/**
		 * [TIMING POINT FORMATS]
		 * Non-inherited:
		 *   offset,msPerBeat,meter,sampleType,sampleSet,volume,inherited,kiai
		 *
		 * Inherited:
		 *   offset,velocity,meter,sampleType,sampleSet,volume,inherited,kiai
		 */
		// TODO: better support for old formats
		String[] tokens = line.split(",");
		try {
			this.time = (int) Float.parseFloat(tokens[0]);  // rare float
			this.meter = Integer.parseInt(tokens[2]);
			this.sampleType = Byte.parseByte(tokens[3]);
			this.sampleTypeCustom = Byte.parseByte(tokens[4]);
			this.sampleVolume = Integer.parseInt(tokens[5]);
//			this.inherited = Utils.parseBoolean(tokens[6]);
			if (tokens.length > 7)
				this.kiai = Utils.parseBoolean(tokens[7]);
		} catch (ArrayIndexOutOfBoundsException e) {
			Log.debug(String.format("Error parsing timing point: '%s'", line));
		}

		// tokens[1] is either beatLength (positive) or velocity (negative)
		float beatLength = Float.parseFloat(tokens[1]);
		if (beatLength > 0)
			this.beatLength = beatLength;
		else {
			this.velocity = (int) beatLength;
			this.inherited = true;
		}
	}
 
Example 3
Source File: BeatmapParser.java    From opsu-dance with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Splits line into two strings: tag, value.
 * If no ':' character is present, null will be returned.
 */
private String[] tokenize(String line) {
	int index = line.indexOf(':');
	if (index == -1) {
		Log.debug(String.format("Failed to tokenize line: '%s'.", line));
		return null;
	}

	String[] tokens = new String[2];
	tokens[0] = line.substring(0, index).trim();
	tokens[1] = line.substring(index + 1).trim();
	return tokens;
}
 
Example 4
Source File: SkinLoader.java    From opsu with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Splits line into two strings: tag, value.
 * If no ':' character is present, null will be returned.
 */
private static String[] tokenize(String line) {
	int index = line.indexOf(':');
	if (index == -1) {
		Log.debug(String.format("Failed to tokenize line: '%s'.", line));
		return null;
	}

	String[] tokens = new String[2];
	tokens[0] = line.substring(0, index).trim();
	tokens[1] = line.substring(index + 1).trim();
	return tokens;
}
 
Example 5
Source File: TimingPoint.java    From opsu with GNU General Public License v3.0 5 votes vote down vote up
/**
	 * Constructor.
	 * @param line the line to be parsed
	 */
	public TimingPoint(String line) {
		/**
		 * [TIMING POINT FORMATS]
		 * Non-inherited:
		 *   offset,msPerBeat,meter,sampleType,sampleSet,volume,inherited,kiai
		 *
		 * Inherited:
		 *   offset,velocity,meter,sampleType,sampleSet,volume,inherited,kiai
		 */
		// TODO: better support for old formats
		String[] tokens = line.split(",");
		try {
			this.time = (int) Float.parseFloat(tokens[0]);  // rare float
			this.meter = Integer.parseInt(tokens[2]);
			this.sampleType = Byte.parseByte(tokens[3]);
			this.sampleTypeCustom = Byte.parseByte(tokens[4]);
			this.sampleVolume = Integer.parseInt(tokens[5]);
//			this.inherited = Utils.parseBoolean(tokens[6]);
			if (tokens.length > 7)
				this.kiai = Utils.parseBoolean(tokens[7]);
		} catch (ArrayIndexOutOfBoundsException e) {
			Log.debug(String.format("Error parsing timing point: '%s'", line));
		}

		// tokens[1] is either beatLength (positive) or velocity (negative)
		float beatLength = Float.parseFloat(tokens[1]);
		if (beatLength > 0)
			this.beatLength = beatLength;
		else {
			this.velocity = (int) beatLength;
			this.inherited = true;
		}
	}
 
Example 6
Source File: BeatmapParser.java    From opsu with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Splits line into two strings: tag, value.
 * If no ':' character is present, null will be returned.
 */
private static String[] tokenize(String line) {
	int index = line.indexOf(':');
	if (index == -1) {
		Log.debug(String.format("Failed to tokenize line: '%s'.", line));
		return null;
	}

	String[] tokens = new String[2];
	tokens[0] = line.substring(0, index).trim();
	tokens[1] = line.substring(index + 1).trim();
	return tokens;
}
 
Example 7
Source File: PBufferGraphics.java    From slick2d-maven with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Create a new graphics context around a pbuffer
 * 
 * @param image The image we're rendering to
 * @throws SlickException Indicates a failure to use pbuffers
 */
public PBufferGraphics(Image image) throws SlickException {
	super(image.getTexture().getTextureWidth(), image.getTexture().getTextureHeight());
	this.image = image;
	
	Log.debug("Creating pbuffer(rtt) "+image.getWidth()+"x"+image.getHeight());
	if ((Pbuffer.getCapabilities() & Pbuffer.PBUFFER_SUPPORTED) == 0) {
		throw new SlickException("Your OpenGL card does not support PBuffers and hence can't handle the dynamic images required for this application.");
	}
	if ((Pbuffer.getCapabilities() & Pbuffer.RENDER_TEXTURE_SUPPORTED) == 0) {
		throw new SlickException("Your OpenGL card does not support Render-To-Texture and hence can't handle the dynamic images required for this application.");
	}

	init();
}
 
Example 8
Source File: FBOGraphics.java    From slick2d-maven with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Create a new graphics context around an FBO
 * 
 * @param image The image we're rendering to
 * @throws SlickException Indicates a failure to use pbuffers
 */
public FBOGraphics(Image image) throws SlickException {
	super(image.getTexture().getTextureWidth(), image.getTexture().getTextureHeight());
	this.image = image;
	
	Log.debug("Creating FBO "+image.getWidth()+"x"+image.getHeight());
	
	boolean FBOEnabled = GLContext.getCapabilities().GL_EXT_framebuffer_object;
	if (!FBOEnabled) {
		throw new SlickException("Your OpenGL card does not support FBO and hence can't handle the dynamic images required for this application.");
	}

	init();
}
 
Example 9
Source File: PBufferUniqueGraphics.java    From slick2d-maven with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Create a new graphics context around a pbuffer
 * 
 * @param image The image we're rendering to
 * @throws SlickException Indicates a failure to use pbuffers
 */
public PBufferUniqueGraphics(Image image) throws SlickException {
	super(image.getTexture().getTextureWidth(), image.getTexture().getTextureHeight());
	this.image = image;
	
	Log.debug("Creating pbuffer(unique) "+image.getWidth()+"x"+image.getHeight());
	if ((Pbuffer.getCapabilities() & Pbuffer.PBUFFER_SUPPORTED) == 0) {
		throw new SlickException("Your OpenGL card does not support PBuffers and hence can't handle the dynamic images required for this application.");
	}

	init();
}