Java Code Examples for org.newdawn.slick.opengl.TextureLoader#getTexture()

The following examples show how to use org.newdawn.slick.opengl.TextureLoader#getTexture() . 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: AnimationData.java    From FEMultiPlayer-V2 with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Gets the texture.
 *
 * @return the texture
 */
public Texture getTexture() {
	try {
		Texture t = TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream(path));
		System.out.println("Loaded "+path);
		return t;
	} catch (IOException e) {
		System.err.println("Texture not found: "+path);
		e.printStackTrace();
		return null;
	}
}
 
Example 2
Source File: Tileset.java    From FEMultiPlayer-V2 with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Instantiates a new tileset.
 *
 * @param path the path
 * @param tileWidth the tile width
 * @param tileHeight the tile height
 */
public Tileset(String path, int tileWidth, int tileHeight) {
	try {
		tileset = TextureLoader.getTexture("PNG",
				ResourceLoader.getResourceAsStream(path));
		System.out.println("Loaded: "+path);
	} catch (IOException e) {
		e.printStackTrace();
	}
	this.tileWidth = tileWidth;
	this.tileHeight = tileHeight;
	width = tileset.getImageWidth();
	height = tileset.getImageHeight();
}
 
Example 3
Source File: BitmapFont.java    From FEMultiPlayer-V2 with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Instantiates a new bitmap font.
 *
 * @param texName the tex name
 */
public BitmapFont(String texName) {
	try {
		texture = TextureLoader.getTexture("PNG", 
				ResourceLoader.getResourceAsStream("res/fonts/"+texName+".png"));
	} catch (IOException e) {
		e.printStackTrace();
	}
	glyphs = new HashMap<Character, Glyph>();
}
 
Example 4
Source File: AnimationData.java    From FEMultiplayer with GNU General Public License v3.0 5 votes vote down vote up
public Texture getTexture() {
	try {
		Texture t = TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream(path));
		System.out.println("Loaded "+path);
		return t;
	} catch (IOException e) {
		System.err.println("Texture not found: "+path);
		e.printStackTrace();
		return null;
	}
}
 
Example 5
Source File: Tileset.java    From FEMultiplayer with GNU General Public License v3.0 5 votes vote down vote up
public Tileset(String path, int tileWidth, int tileHeight) {
	try {
		tileset = TextureLoader.getTexture("PNG",
				ResourceLoader.getResourceAsStream(path));
		System.out.println("Loaded: "+path);
	} catch (IOException e) {
		e.printStackTrace();
	}
	this.tileWidth = tileWidth;
	this.tileHeight = tileHeight;
	width = tileset.getImageWidth();
	height = tileset.getImageHeight();
}
 
Example 6
Source File: BitmapFont.java    From FEMultiplayer with GNU General Public License v3.0 5 votes vote down vote up
public BitmapFont(String texName) {
	try {
		texture = TextureLoader.getTexture("PNG", 
				ResourceLoader.getResourceAsStream("res/fonts/"+texName+".png"));
	} catch (IOException e) {
		e.printStackTrace();
	}
	glyphs = new HashMap<Character, Glyph>();
}