org.newdawn.slick.opengl.TextureLoader Java Examples

The following examples show how to use org.newdawn.slick.opengl.TextureLoader. 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 Project: FEMultiPlayer-V2   Author: eliatlarge   File: FEMultiplayer.java    License: GNU General Public License v3.0 5 votes vote down vote up
public void init(int width, int height, String name) {
	super.init(width, height, name);
	Player p1 = new Player("Player", (byte) 0);
	localPlayer = p1;
	ByteBuffer icon16, icon32;
	icon16 = icon32 = null;
	try {
		icon16 = ByteBuffer.wrap(TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("res/gui/icon16.png")).getTextureData());
		icon32 = ByteBuffer.wrap(TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("res/gui/icon32.png")).getTextureData());
	} catch (IOException e) {
		e.printStackTrace();
	}
	Display.setIcon(new ByteBuffer[]{icon16, icon32});
	FEResources.loadResources();
	FEResources.loadBitmapFonts();
	WeaponFactory.loadWeapons();
	UnitFactory.loadUnits();
	p1.getParty().setColor(Party.TEAM_BLUE);
	
	/* OpenGL final setup */
	glEnable(GL_LINE_SMOOTH);
	
	UnitFactory.getUnit("Lyn");
	connect = new ConnectStage();
	setCurrentStage(new TitleStage());
	SoundTrack.loop("main");
	
}
 
Example #2
Source Project: FEMultiPlayer-V2   Author: eliatlarge   File: AnimationData.java    License: 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 #3
Source Project: FEMultiPlayer-V2   Author: eliatlarge   File: Tileset.java    License: 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 #4
Source Project: FEMultiPlayer-V2   Author: eliatlarge   File: BitmapFont.java    License: 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 #5
Source Project: Slyther   Author: gegy1000   File: TextureManager.java    License: MIT License 5 votes vote down vote up
public Texture getTexture(String path) {
    if (textures.containsKey(path)) {
        return textures.get(path);
    } else {
        try {
            return textures.put(path, TextureLoader.getTexture("png", TextureManager.class.getResourceAsStream(path)));
        } catch (IOException e) {
            Log.error("Failed to load texture {}", path);
            Log.catching(e);
        }
    }
    return null;
}
 
Example #6
Source Project: FEMultiplayer   Author: chudooder   File: FEMultiplayer.java    License: GNU General Public License v3.0 5 votes vote down vote up
public void init(int width, int height, String name) {
	super.init(width, height, name);
	Player p1 = new Player("Player", (byte) 0);
	localPlayer = p1;
	ByteBuffer icon16, icon32;
	icon16 = icon32 = null;
	try {
		icon16 = ByteBuffer.wrap(TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("res/gui/icon16.png")).getTextureData());
		icon32 = ByteBuffer.wrap(TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("res/gui/icon32.png")).getTextureData());
	} catch (IOException e) {
		e.printStackTrace();
	}
	Display.setIcon(new ByteBuffer[]{icon16, icon32});
	FEResources.loadResources();
	FEResources.loadBitmapFonts();
	WeaponFactory.loadWeapons();
	UnitFactory.loadUnits();
	p1.getParty().setColor(Party.TEAM_BLUE);
	
	/* OpenGL final setup */
	glEnable(GL_LINE_SMOOTH);
	
	UnitFactory.getUnit("Lyn");
	connect = new ConnectStage();
	setCurrentStage(new TitleStage());
	messages = new CopyOnWriteArrayList<Message>();
	SoundTrack.loop("main_theme");
	
}
 
Example #7
Source Project: FEMultiplayer   Author: chudooder   File: AnimationData.java    License: 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 #8
Source Project: FEMultiplayer   Author: chudooder   File: Tileset.java    License: 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 #9
Source Project: FEMultiplayer   Author: chudooder   File: BitmapFont.java    License: 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>();
}