In my dire need to make TiledMaps render smoother, I figured out the steps needed to modify Slick2D’s TiledMap class (and the classes effected by it) to accept floats instead of ints, that way you can move the map via float*delta, instead of just straight ints. This will allow your maps to move much smoother around the map.
This process actually ended up being a lot more simple than I had originally thought but I figured I should still share the process anyway, it’s only 6 edits in 3 files. I removed a few edits that didn’t need to be done, to keep this as minimally invasive as possible to Slick2d.
(This is done with Slick2d build #237, the exact lines may differ in your copy)
org.newdawn.slick.tiled.TiledMap.class
Line: 417
Change:
public void render(int x, int y, int sx, int sy, int width, int height,
To:
public void render(float x, float y, int sx, int sy, int width, int height,
Line: 502
protected void renderIsometricMap(int x, int y, int sx, int sy, int width,
To:
protected void renderIsometricMap(float x, float y, int sx, int sy, int width,
Lines: 515, 516
int initialLineX = x;
int initialLineY = y;
To:
float initialLineX = x;
float initialLineY = y;
Line: 524
int currentLineX = initialLineX;
To:
float currentLineX = initialLineX;
org.newdawn.slick.tiled.Layer
Line 198
public void render(int x, int y, int sx, int sy, int width, int ty,
To:
public void render(float x, float y, int sx, int sy, int width, int ty,
org.newdawn.slick.SpriteSheet
Line 267
public void renderInUse(int x,int y,int sx,int sy) {
To:
public void renderInUse(float x,float y,int sx,int sy) {