I'm making a 2D side scroller game with Scala & libGDX. My problem is that I want to have a fixed room size, say 4000px * 720px.
I want the window size to be 1280px * 720px and I need to have a orthographic camera that I can move and display the correct part of the "room"/"map". The problem is how I can set the room size to be that specific size and then use orthographic camera to display a part of it?
Currently I'm trying to use this tutorial: https://github.com/libgdx/libgdx/wiki/Orthographic-camera
I can set the window size when I launch the program like this:
object DesktopLauncher {
def main(args: Array[String]) {
var config: LwjglApplicationConfiguration = new LwjglApplicationConfiguration
config.foregroundFPS = 60
config.width = 1280
config.height = 720
new LwjglApplication(new Controller, config)
}
}
And I can set the camera size like this:
val h: Float = Gdx.graphics.getHeight()
val w: Float = Gdx.graphics.getWidth()
cam = new OrthographicCamera(100, 100 * (h / w))
cam.position.set(cam.viewportWidth / 2f, cam.viewportHeight / 2f, 0)
But how can I specify the camera and room size to be the size I want in pixels?