If you don’t mind editing Slick itself, you can add drawEmbedded() support to Animation, it’s actually not that complicated. Honestly it’s just a ripoff of the regular draw() code, it just runs drawEmbedded when it’s all said and done.
Add this below line 380:
/**
* Draw the animation to the screen without startUse() and endUse().
*/
public void drawEmbedded() {
drawEmbedded(0,0);
}
/**
* Draw the animation at a specific location without startUse() and endUse().
*
* @param x The x position to draw the animation at
* @param y The y position to draw the animation at
*/
public void drawEmbedded(float x,float y) {
drawEmbedded(x,y,getWidth(),getHeight());
}
/**
* Draw the animation at a specific location without startUse() and endUse().
*
* @param x The x position to draw the animation at
* @param y The y position to draw the animation at
* @param filter The filter to apply
*/
public void drawEmbedded(float x,float y, Color filter) {
drawEmbedded(x,y,getWidth(),getHeight(), filter);
}
/**
* Draw the animation without startUse() and endUse().
*
* @param x The x position to draw the animation at
* @param y The y position to draw the animation at
* @param width The width to draw the animation at
* @param height The height to draw the animation at
*/
public void drawEmbedded(float x,float y,float width,float height) {
drawEmbedded(x,y,width,height,Color.white);
}
/**
* Draw the animation without startUse() and endUse().
*
* @param x The x position to draw the animation at
* @param y The y position to draw the animation at
* @param width The width to draw the animation at
* @param height The height to draw the animation at
* @param col The colour filter to use
*/
public void drawEmbedded(float x,float y,float width, float height, Color col) {
if (frames.size() == 0) {
return;
}
if (autoUpdate) {
long now = getTime();
long delta = now - lastUpdate;
if (firstUpdate) {
delta = 0;
firstUpdate = false;
}
lastUpdate = now;
nextFrame(delta);
}
Frame frame = (Frame) frames.get(currentFrame);
frame.image.drawEmbedded(x,y,x+width,y+height,0,0,width,height,col);
}