I am conducting a learning experiment with Java. I am attempting to create a simple "Megaman" style game using Java and the 3rd party API "LibGDX". I have obtained a rather solid understanding of the relationship between the OrthographicCamera
object from LibGDX and the World
object from LibGDX's implementation of "JBox2d".
However, when I resize the window the objects inside World
stretch. I have made use of the resize(int width, int height)
method of the Screen
interface. Inside of which i reset the OrthographicCamera
's width and height. This does not seem to have any effect of the way the images looks or behaves in the physics simulation.
So my question is this: How do i properly resize a LibGDX/JBox2d application's window without distorting the objects being simulated?
here is the code (in the form of a git repo because i find GitHub faster, easier, and kinder to the SO server...)
EXTERNAL LINK
https://gist.github.com/konnerdroid/8113302
EXTERNAL LINK
AHA!!!! i wasnt updating my camera...
For any changes made to the camera to be visible and their effect to be felt you need to call
camera.update()
either in your loop or after any changes are madewell... at least i learned how to use github =)