org.newdawn.slick.opengl.Texture Java Examples

The following examples show how to use org.newdawn.slick.opengl.Texture. 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: PaletteSwapper.java    License: GNU General Public License v3.0 6 votes vote down vote up
/**
 * Setup.
 *
 * @param u the u
 * @return the shader args
 */
public static ShaderArgs setup(FightUnit u) {
	Unit unit = u.getUnit();
	ShaderArgs args = new ShaderArgs();
	if(unit.getTheClass().name.equals("Lord")) return args;
	String c = unit.functionalClassName();
	
	Texture t = palettes.get(c);
	if(t == null) return args;
	if(lookup.get(c) == null) return args;
	int offset = lookup.get(c).indexOf(unit.name);
	if(offset < 0) return args;
	args.programName = "paletteSwap";
	args.args = new float[] {t.getTextureWidth(), t.getTextureHeight(), offset, t.getImageWidth()};
	GL13.glActiveTexture(GL13.GL_TEXTURE8);
	t.bind();
	GL13.glActiveTexture(GL13.GL_TEXTURE0);
	return args;
}
 
Example #2
Source Project: FEMultiPlayer-V2   Author: eliatlarge   File: Healthbar.java    License: GNU General Public License v3.0 6 votes vote down vote up
public void render(){
	Renderer.drawRectangle(x-24, y-6, x+85, y+20, renderDepth, FightStage.BORDER_DARK);
	Renderer.drawRectangle(x-23, y-5, x+84, y+19, renderDepth, FightStage.BORDER_LIGHT);
	Renderer.drawRectangle(x-22, y-4, x+83, y+18, renderDepth, color);
	int offY = 0;
	int offX = 0;
	int width = FEResources.getBitmapFont("stat_numbers").getStringWidth((int)displayedHealth + "");
	if(totalHealth <= 40) {
		Renderer.drawString("stat_numbers", (int)displayedHealth + "", x-5-width, y-2, renderDepth);
	} else {
		Renderer.drawString("stat_numbers", (int)displayedHealth + "", x-5-width, y+2, renderDepth);
	}
	for (int hp = 1; hp <= totalHealth; hp++) {
		Texture t = hp <= displayedHealth ? tickFilled : tickEmpty;
		Renderer.render(t, 0, 0, 1, 1, x + offX, y + offY, x + offX + 2, y
				+ offY + 6, renderDepth);
		
		if(hp == 40){
			offY = 8;
			offX = 0;
		} else {
			offX +=2;
		}
	}
}
 
Example #3
Source Project: FEMultiPlayer-V2   Author: eliatlarge   File: Healthbar.java    License: GNU General Public License v3.0 6 votes vote down vote up
public void render() {
	int offY = 0;
	int offX = 0;
	int width = FEResources.getBitmapFont("stat_numbers").getStringWidth((int)displayedHealth + "");
	if(totalHealth <= 40) {
		Renderer.drawString("stat_numbers", (int)displayedHealth + "", x-5-width, y-2, renderDepth);
	} else {
		Renderer.drawString("stat_numbers", (int)displayedHealth + "", x-5-width, y+2, renderDepth);
	}
	for (int hp = 1; hp <= totalHealth; hp++) {
		Texture t = hp <= displayedHealth? filled: empty;
		Renderer.render(t, 0, 0, 1, 1, x + offX, y + offY, x + offX + 2, y
				+ offY + 6, renderDepth);
		
		if(hp == 40){
			offY = 8;
			offX = 0;
		} else {
			offX +=2;
		}
	}
}
 
Example #4
Source Project: FEMultiPlayer-V2   Author: eliatlarge   File: Sprite.java    License: GNU General Public License v3.0 6 votes vote down vote up
/**
 * Draws the sprite .
 *
 * @param x the x
 * @param y the y
 * @param depth the depth
 * @param transform the transform
 * @param shader the shader
 */
public void render(float x, float y, float depth, Transform transform, ShaderArgs shader) {
	if(currentAnimation == null) return;
	
	int width = currentAnimation.getWidth();
	int height = currentAnimation.getHeight();
	int frameX = currentAnimation.getFrame() % currentAnimation.getColumns();
	int frameY = currentAnimation.getFrame() / currentAnimation.getColumns();
	int offX = currentAnimation.getOffsetX();
	int offY = currentAnimation.getOffsetY();;
	if(transform != null) {
		if(transform.flipHorizontal) {
			offX = -offX + width;
		}
		if(transform.flipVertical) {
			offY = -offY + height;
		}
	}
	float x0 = ((float)frameX * width)/currentAnimation.getImageWidth();
	float x1 = ((float)(frameX+1) * width)/currentAnimation.getImageWidth();
	float y0 = ((float)frameY * height)/currentAnimation.getImageHeight();
	float y1 = ((float)(frameY+1) * height)/currentAnimation.getImageHeight();
	Texture texture = currentAnimation.getTexture();
	Renderer.render(texture, x0, y0, x1, y1, x - offX, y - offY,
			x + width - offX, y + height - offY, depth, transform, shader, currentAnimation.getBlendMode());
}
 
Example #5
Source Project: FEMultiplayer   Author: chudooder   File: PaletteSwapper.java    License: GNU General Public License v3.0 6 votes vote down vote up
public static ShaderArgs setup(FightUnit u) {
	Unit unit = u.getUnit();
	ShaderArgs args = new ShaderArgs();
	if(unit.getTheClass().name.equals("Lord")) return args;
	String c = unit.functionalClassName();
	
	Texture t = palettes.get(c);
	if(t == null) return args;
	if(lookup.get(c) == null) return args;
	int offset = lookup.get(c).indexOf(unit.name);
	if(offset < 0) return args;
	args.programName = "paletteSwap";
	args.args = new float[] {t.getTextureWidth(), t.getTextureHeight(), offset, t.getImageWidth()};
	GL13.glActiveTexture(GL13.GL_TEXTURE8);
	t.bind();
	GL13.glActiveTexture(GL13.GL_TEXTURE0);
	return args;
}
 
Example #6
Source Project: FEMultiplayer   Author: chudooder   File: TurnDisplay.java    License: GNU General Public License v3.0 6 votes vote down vote up
public TurnDisplay(boolean yourTurn, Color teamColor) {
	super(0, 0);
	xpos = -512;
	renderDepth = 0.0f;
	Texture t, f;
	text = new Sprite();
	flash = new Sprite();
	if(yourTurn) {
		t = FEResources.getTexture("player_phase");
	} else {
		t = FEResources.getTexture("enemy_phase");
	}
	
	if(teamColor == Party.TEAM_BLUE) {
		f = FEResources.getTexture("blue_flash");
	} else {
		f = FEResources.getTexture("red_flash");
	}
	text.addAnimation("default", t);
	flash.addAnimation("default",f);
	AudioPlayer.playAudio("turn_change", 1, 1);
}
 
Example #7
Source Project: FEMultiplayer   Author: chudooder   File: Healthbar.java    License: GNU General Public License v3.0 6 votes vote down vote up
public void render(){
	Renderer.drawRectangle(x-24, y-6, x+85, y+20, renderDepth, FightStage.BORDER_DARK);
	Renderer.drawRectangle(x-23, y-5, x+84, y+19, renderDepth, FightStage.BORDER_LIGHT);
	Renderer.drawRectangle(x-22, y-4, x+83, y+18, renderDepth, color);
	int offY = 0;
	int offX = 0;
	int width = FEResources.getBitmapFont("stat_numbers").getStringWidth((int)displayedHealth + "");
	if(totalHealth <= 40) {
		Renderer.drawString("stat_numbers", (int)displayedHealth + "", x-5-width, y-2, renderDepth);
	} else {
		Renderer.drawString("stat_numbers", (int)displayedHealth + "", x-5-width, y+2, renderDepth);
	}
	for (int hp = 1; hp <= totalHealth; hp++) {
		Texture t = hp <= displayedHealth ? tickFilled : tickEmpty;
		Renderer.render(t, 0, 0, 1, 1, x + offX, y + offY, x + offX + 2, y
				+ offY + 6, renderDepth);
		
		if(hp == 40){
			offY = 8;
			offX = 0;
		} else {
			offX +=2;
		}
	}
}
 
Example #8
Source Project: FEMultiplayer   Author: chudooder   File: Healthbar.java    License: GNU General Public License v3.0 6 votes vote down vote up
public void render() {
	int offY = 0;
	int offX = 0;
	int width = FEResources.getBitmapFont("stat_numbers").getStringWidth((int)displayedHealth + "");
	if(totalHealth <= 40) {
		Renderer.drawString("stat_numbers", (int)displayedHealth + "", x-5-width, y-2, renderDepth);
	} else {
		Renderer.drawString("stat_numbers", (int)displayedHealth + "", x-5-width, y+2, renderDepth);
	}
	for (int hp = 1; hp <= totalHealth; hp++) {
		Texture t = hp <= displayedHealth? filled: empty;
		Renderer.render(t, 0, 0, 1, 1, x + offX, y + offY, x + offX + 2, y
				+ offY + 6, renderDepth);
		
		if(hp == 40){
			offY = 8;
			offX = 0;
		} else {
			offX +=2;
		}
	}
}
 
Example #9
Source Project: FEMultiplayer   Author: chudooder   File: Sprite.java    License: GNU General Public License v3.0 6 votes vote down vote up
/**
 * Draws the sprite 
 * @param x
 * @param y
 * @param depth
 * @param transform
 * @param shader 
 */
public void render(float x, float y, float depth, Transform transform, ShaderArgs shader) {
	if(currentAnimation == null) return;
	
	int width = currentAnimation.getWidth();
	int height = currentAnimation.getHeight();
	int frameX = currentAnimation.getFrame() % currentAnimation.getColumns();
	int frameY = currentAnimation.getFrame() / currentAnimation.getColumns();
	int offX = currentAnimation.getOffsetX();
	int offY = currentAnimation.getOffsetY();;
	if(transform != null) {
		if(transform.flipHorizontal) {
			offX = -offX + width;
		}
		if(transform.flipVertical) {
			offY = -offY + height;
		}
	}
	float x0 = ((float)frameX * width)/currentAnimation.getImageWidth();
	float x1 = ((float)(frameX+1) * width)/currentAnimation.getImageWidth();
	float y0 = ((float)frameY * height)/currentAnimation.getImageHeight();
	float y1 = ((float)(frameY+1) * height)/currentAnimation.getImageHeight();
	Texture texture = currentAnimation.getTexture();
	Renderer.render(texture, x0, y0, x1, y1, x - offX, y - offY,
			x + width - offX, y + height - offY, depth, transform, shader);
}
 
Example #10
Source Project: slick2d-maven   Author: nguillaumin   File: PBufferGraphics.java    License: BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * 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());
		
		final RenderTexture rt = new RenderTexture(false, true, false, false, RenderTexture.RENDER_TEXTURE_2D, 0);
		pbuffer = new Pbuffer(screenWidth, screenHeight, new PixelFormat(8, 0, 0), rt, null);

		// Initialise state of the pbuffer context.
		pbuffer.makeCurrent();

		initGL();
		GL.glBindTexture(GL11.GL_TEXTURE_2D, tex.getTextureID());
		pbuffer.releaseTexImage(Pbuffer.FRONT_LEFT_BUFFER);
		image.draw(0,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?");
	}
}
 
Example #11
Source Project: slick2d-maven   Author: nguillaumin   File: PBufferUniqueGraphics.java    License: BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * 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?");
	}
}
 
Example #12
Source Project: slick2d-maven   Author: nguillaumin   File: ShapeRenderer.java    License: BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Draw the outline of the given shape.  Only the vertices are set.  
 * The colour has to be set independently of this method.
 * 
 * @param shape The shape to draw.
 */
public static final void draw(Shape shape) {
    Texture t = TextureImpl.getLastBind();
    TextureImpl.bindNone();
    
    float points[] = shape.getPoints();
    
    LSR.start();
    for(int i=0;i<points.length;i+=2) {
    	LSR.vertex(points[i], points[i + 1]);
    }
    
    if (shape.closed()) {
    	LSR.vertex(points[0], points[1]);
    }
    
    LSR.end();
    
    if (t == null) {
    	TextureImpl.bindNone();
    } else {
    	t.bind();
    }
}
 
Example #13
Source Project: opsu-dance   Author: yugecin   File: TextureData.java    License: GNU General Public License v3.0 5 votes vote down vote up
public TextureData(Image image)
{
	this.image = image;
	this.width = image.getWidth();
	this.height = image.getHeight();
	this.width2 = this.width / 2f;
	this.height2 = this.height / 2f;
	Texture text = image.getTexture();
	this.id = text.getTextureID();
	this.txtw = text.getWidth();
	this.txth = text.getHeight();
}
 
Example #14
Source Project: opsu-dance   Author: yugecin   File: MainMenu.java    License: GNU General Public License v3.0 5 votes vote down vote up
private void drawMenuButton(
	Image img,
	int x,
	int y,
	int clipxtop,
	int clipxbot,
	Color col)
{
	col.bind();
	final Texture t = img.getTexture();
	t.bind(); 
	
	final int width = img.getWidth();
	final int height = img.getHeight();
	final float twidth = t.getWidth();
	final float theight = t.getHeight();
	y -= height / 2;
	
	final float texXtop = clipxtop > 0 ? (float) clipxtop / width * twidth : 0f;
	final float texXbot = clipxbot > 0 ? (float) clipxbot / width * twidth : 0f;

	GL11.glBegin(SGL.GL_QUADS); 
	GL11.glTexCoord2f(texXtop, 0);
	GL11.glVertex3i(x + clipxtop, y, 0);
	GL11.glTexCoord2f(twidth, 0);
	GL11.glVertex3i(x + width, y, 0);
	GL11.glTexCoord2f(twidth, theight);
	GL11.glVertex3i(x + width, y + height, 0);
	GL11.glTexCoord2f(texXbot, theight);
	GL11.glVertex3i(x + clipxbot, y + height, 0);
	GL11.glEnd(); 
}
 
Example #15
Source Project: FEMultiPlayer-V2   Author: eliatlarge   File: PaletteSwapper.java    License: GNU General Public License v3.0 5 votes vote down vote up
/**
 * Setup.
 *
 * @param u the u
 * @return the shader args
 */
public static ShaderArgs setup(Unit u) {
	ShaderArgs args = new ShaderArgs();
	int offset = u.getPartyColor().equals(Party.TEAM_BLUE) ? 0 : 1;
	if(offset == 0) return args;
	
	Texture t = palettes.get("overworld");
	args.programName = "paletteSwap";
	args.args = new float[] {t.getTextureWidth(), t.getTextureHeight(), offset, t.getImageWidth()};
	GL13.glActiveTexture(GL13.GL_TEXTURE8);
	t.bind();
	GL13.glActiveTexture(GL13.GL_TEXTURE0);
	return args;
}
 
Example #16
Source Project: FEMultiPlayer-V2   Author: eliatlarge   File: TurnDisplay.java    License: GNU General Public License v3.0 5 votes vote down vote up
/**
 * Instantiates a new turn display.
 *
 * @param yourTurn the your turn
 * @param teamColor the team color
 */
public TurnDisplay(boolean yourTurn, Color teamColor, boolean spec) {
	super(0, 0);
	xpos = -512;
	renderDepth = 0.0f;
	Texture t, f;
	text = new Sprite();
	flash = new Sprite();
	if(yourTurn) {
		t = FEResources.getTexture("player_phase");
	} else {
		if(spec){
			if(teamColor == Party.TEAM_BLUE) {
				t = FEResources.getTexture("blue_phase");
			} else {
				t = FEResources.getTexture("red_phase");
			}
		}else{ t = FEResources.getTexture("enemy_phase");}
	}
	
	if(teamColor == Party.TEAM_BLUE) {
		f = FEResources.getTexture("blue_flash");
	} else {
		f = FEResources.getTexture("red_flash");
	}
	text.addAnimation("default", t);
	flash.addAnimation("default",f);
	AudioPlayer.playAudio("turn_change");
}
 
Example #17
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 #18
Source Project: FEMultiPlayer-V2   Author: eliatlarge   File: Animation.java    License: GNU General Public License v3.0 5 votes vote down vote up
/**
 * Instantiates a new single-frame animation.
 *
 * @param t the texture
 * @param blend the blend mode to use when drawing this animation
 */
public Animation(Texture t, BlendModeArgs blend) {
	texture = t;
	width = t.getImageWidth();
	height = t.getImageHeight();
	length = 1;
	rows = 1;
	columns = 1;
	speed = 0;
	currentFrame = 0;
	counter = 0;
	this.blend = blend;
}
 
Example #19
Source Project: FEMultiPlayer-V2   Author: eliatlarge   File: Animation.java    License: GNU General Public License v3.0 5 votes vote down vote up
/**
 * Instantiates a new animation.
 *
 * @param t the t
 * @param width the width
 * @param height the height
 * @param length the length
 * @param columns the columns
 * @param speed the speed
 * @param blend the blend mode to use when drawing this animation
 */
public Animation(Texture t, int width, int height, int length, int columns, float speed, BlendModeArgs blend) {
	this(t, blend);
	this.width = width;
	this.height = height;
	this.columns = columns;
	this.rows = (length/columns)+1;
	this.length = length;
	this.speed = speed;
	this.offsetX = 0;
	this.offsetY = 0;
	this.currentFrame = 0;
	counter = 0;
}
 
Example #20
Source Project: FEMultiPlayer-V2   Author: eliatlarge   File: Animation.java    License: GNU General Public License v3.0 5 votes vote down vote up
/**
 * Instantiates a new animation.
 *
 * @param t the t
 * @param width the width
 * @param height the height
 * @param length the length
 * @param columns the columns
 * @param offsetX the offset x
 * @param offsetY the offset y
 * @param speed the speed
 * @param blend the blend mode to use when drawing this animation
 */
public Animation(Texture t, int width, int height, int length, int columns,
		int offsetX, int offsetY, float speed, BlendModeArgs blend) {
	this(t, blend);
	this.width = width;
	this.height = height;
	this.columns = columns;
	this.rows = (length/columns)+1;
	this.length = length;
	this.speed = speed;
	this.offsetX = offsetX;
	this.offsetY = offsetY;
	this.currentFrame = 0;
	counter = 0;
}
 
Example #21
Source Project: FEMultiPlayer-V2   Author: eliatlarge   File: Sprite.java    License: GNU General Public License v3.0 5 votes vote down vote up
/**
 * Add a new single-image animation.
 * @param name Name of the animation
 * @param tex Texture to use as the static image
 */
public void addAnimation(String name, Texture tex) {
	Animation anim = new Animation(tex, BlendModeArgs.ALPHA_BLEND);
	animations.put(name.toUpperCase(), anim);
	currentAnimation = anim;
	curAnimName = name;
	anim.setSprite(this);
}
 
Example #22
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 t the t
 * @param tileWidth the tile width
 * @param tileHeight the tile height
 */
public Tileset(Texture t, int tileWidth, int tileHeight) {
	tileset = t;
	this.tileWidth = tileWidth;
	this.tileHeight = tileHeight;
	width = tileset.getImageWidth();
	height = tileset.getImageHeight();

}
 
Example #23
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 #24
Source Project: FEMultiplayer   Author: chudooder   File: PaletteSwapper.java    License: GNU General Public License v3.0 5 votes vote down vote up
public static ShaderArgs setup(Unit u) {
	ShaderArgs args = new ShaderArgs();
	int offset = u.getPartyColor().equals(Party.TEAM_BLUE) ? 0 : 1;
	if(offset == 0) return args;
	
	Texture t = palettes.get("overworld");
	args.programName = "paletteSwap";
	args.args = new float[] {t.getTextureWidth(), t.getTextureHeight(), offset, t.getImageWidth()};
	GL13.glActiveTexture(GL13.GL_TEXTURE8);
	t.bind();
	GL13.glActiveTexture(GL13.GL_TEXTURE0);
	return args;
}
 
Example #25
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 #26
Source Project: FEMultiplayer   Author: chudooder   File: Animation.java    License: GNU General Public License v3.0 5 votes vote down vote up
public Animation(Texture t) {
	texture = t;
	width = t.getImageWidth();
	height = t.getImageHeight();
	length = 1;
	rows = 1;
	columns = 1;
	speed = 0;
	currentFrame = 0;
	counter = 0;
}
 
Example #27
Source Project: FEMultiplayer   Author: chudooder   File: Animation.java    License: GNU General Public License v3.0 5 votes vote down vote up
public Animation(Texture t, int width, int height, int length, int columns, float speed) {
	this(t);
	this.width = width;
	this.height = height;
	this.columns = columns;
	this.rows = (length/columns)+1;
	this.length = length;
	this.speed = speed;
	this.offsetX = 0;
	this.offsetY = 0;
	this.currentFrame = 0;
	counter = 0;
}
 
Example #28
Source Project: FEMultiplayer   Author: chudooder   File: Animation.java    License: GNU General Public License v3.0 5 votes vote down vote up
public Animation(Texture t, int width, int height, int length, int columns,
		int offsetX, int offsetY, float speed) {
	this(t);
	this.width = width;
	this.height = height;
	this.columns = columns;
	this.rows = (length/columns)+1;
	this.length = length;
	this.speed = speed;
	this.offsetX = offsetX;
	this.offsetY = offsetY;
	this.currentFrame = 0;
	counter = 0;
}
 
Example #29
Source Project: FEMultiplayer   Author: chudooder   File: Sprite.java    License: GNU General Public License v3.0 5 votes vote down vote up
/**
 * Add a new single-image animation.
 * @param name Name of the animation
 * @param tex Texture to use as the static image
 */
public void addAnimation(String name, Texture tex) {
	Animation anim = new Animation(tex);
	animations.put(name.toUpperCase(), anim);
	currentAnimation = anim;
	curAnimName = name;
	anim.setSprite(this);
}
 
Example #30
Source Project: FEMultiplayer   Author: chudooder   File: Tileset.java    License: GNU General Public License v3.0 5 votes vote down vote up
public Tileset(Texture t, int tileWidth, int tileHeight) {
	tileset = t;
	this.tileWidth = tileWidth;
	this.tileHeight = tileHeight;
	width = tileset.getImageWidth();
	height = tileset.getImageHeight();

}