Hey,
in my current game I create a minimap like this
public void init(GameContainer gameContainer, Map map) throws SlickException {
this.map = map;
miniMap = new Image(map.getMapWidth(), map.getMapHeight());
mapGraphics = miniMap.getGraphics();
for (int y = 0; y < miniMap.getHeight(); y++) {
for (int x = 0; x < miniMap.getWidth(); x++) {
if (map.getTileAt(x, y) == 0) {
mapGraphics.setColor(Color.green);
} else if (map.getTileAt(x, y) == 66) {
mapGraphics.setColor(Color.blue);
}
else {
mapGraphics.setColor(Color.white);
}
mapGraphics.drawRect(x, y, 1, 1);
}
}
mapGraphics.flush();
}
and this is the rendering code
public void render(GameContainer gameContainer, Graphics graphics) throws SlickException {
int posX = gameContainer.getWidth() - (int)mapScale*miniMap.getWidth();
miniMap.draw(posX, 0, mapScale);
}
Works ok, but it uses the default GL_LINEAER filter for scaling. Now I need this to use GL_NEAREST as filter, but when I
miniMap.setFilter(Image.FILTER_NEAREST);
before the draw call, slick crashes with
java.lang.RuntimeException: Resource not found: org.newdawn.slick.Image@5dd6b6fa
at org.newdawn.slick.util.ResourceLoader.getResourceAsStream(ResourceLoader.java:69)
at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:169)
I guess it’s because there is no resource-texture availabe and it’s a slick-limitation. Is there a known workaround maybe?