Hey,
there is no possibility in Slick to draw a sheared Image colored. The setColors function doesn't seem to work with drawSheared and there is no version of drawSheared with a filter parameter.
Thus I added this simple function:
Code:
/**
* Draw this image at a specified location and size
*
* @param x The x location to draw the image at
* @param y The y location to draw the image at
* @param hshear The amount to shear the bottom points by horizontally
* @param vshear The amount to shear the right points by vertically
* @param filter The colour filter to adapt the image with
*/
public void drawSheared(float x,float y, float hshear, float vshear, Color filter) {
if (alpha != 1) {
if (filter == null) {
filter = Color.white;
}
filter = new Color(filter);
filter.a *= alpha;
}
if (filter != null) {
filter.bind();
}
texture.bind();
GL.glTranslatef(x, y, 0);
if (angle != 0) {
GL.glTranslatef(centerX, centerY, 0.0f);
GL.glRotatef(angle, 0.0f, 0.0f, 1.0f);
GL.glTranslatef(-centerX, -centerY, 0.0f);
}
GL.glBegin(SGL.GL_QUADS);
init();
GL.glTexCoord2f(textureOffsetX, textureOffsetY);
GL.glVertex3f(0, 0, 0);
GL.glTexCoord2f(textureOffsetX, textureOffsetY + textureHeight);
GL.glVertex3f(hshear, height, 0);
GL.glTexCoord2f(textureOffsetX + textureWidth, textureOffsetY
+ textureHeight);
GL.glVertex3f(width + hshear, height + vshear, 0);
GL.glTexCoord2f(textureOffsetX + textureWidth, textureOffsetY);
GL.glVertex3f(width, vshear, 0);
GL.glEnd();
if (angle != 0) {
GL.glTranslatef(centerX, centerY, 0.0f);
GL.glRotatef(-angle, 0.0f, 0.0f, 1.0f);
GL.glTranslatef(-centerX, -centerY, 0.0f);
}
GL.glTranslatef(-x, -y, 0);
}