Glad to see people using LibGDX :D
It's quite simple actually, you need to take advantage of the Viewports, more specifically FitViewport.
Documentation: https://github.com/libgdx/libgdx/wiki/Viewports
Let me show you some snippet for a Screen class which will always maintain the 64x64 aspect:
public class LowResTest implements Screen {
private Color color = Color.BLACK;
private Viewport gameView;
private SpriteBatch batch;
private Texture texture;
@Override
public void show() {
gameView = new FitViewport(64, 64); // This is the internal resolution your game will display regardless of window size
batch = new SpriteBatch();
texture = new Texture(Gdx.files.internal("badlogic.jpg"));
}
@Override
public void render(float delta) {
Gdx.gl.glClearColor(color.r, color.g, color.b, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
gameView.apply(); // we set this as the current viewport (we could have more viewports, for example a hudView)
OrthographicCamera cam = (OrthographicCamera) gameView.getCamera();
batch.setProjectionMatrix(cam.combined); // Don't forget this else your viewport won't be used when rendering
batch.begin();
batch.draw(texture, 0, 0);
batch.end();
}
@Override
public void resize(int width, int height) {
gameView.update(width, height); // also don't forget this
} ...
Hope this helps!
And good jamming to all! I still have to spend some day to brainstorm ideas :P