1

I use FitViewport in my libGDX game. it works perfectly on Android & Desktop, but I just can't get it right on iOS.

the pink box contains the game screen & the black parts are just black like that

this is how I initialize the important elements

camera = new OrthographicCamera(MenuScreen.VIRTUAL_WIDTH,
            MenuScreen.VIRTUAL_HEIGHT);
    viewport = new FitViewport(MenuScreen.VIRTUAL_WIDTH,
            MenuScreen.VIRTUAL_HEIGHT, camera);
    viewport.apply();
    camera.position.set(camera.viewportWidth / 2,
            camera.viewportHeight / 2, 0);
    b = new SpriteBatch();
    b.setProjectionMatrix(camera.combined);

MenuScreen.VIRTUAL_WIDTH & HEIGHT are 480 & 800

and this is my resize method:

@Override
public void resize(int width, int height) {
    renderer.getViewport().update(width, height);
    renderer.camera.position.set(renderer.camera.viewportWidth / 2,
            renderer.camera.viewportHeight / 2, 0);
    renderer.getB().setProjectionMatrix(renderer.getCamera().combined);

}

and I am sort of stressed as my license is expiring soon & cannot renew it anymore at RoboVM :S

d.sz.
  • 33
  • 5
  • This issue is in your iOS platform specific code, not your common code. I can't tell you what your problem is but I would recommend targeting one platform (forget about iOS it's not worth it). – Barodapride Apr 20 '16 at 14:56

1 Answers1

0

In case somebody bumps into the same issue, I will leave this link here: App not sized properly iOS 8 iPhone simulator

I managed to solve it based on the link. I never would have guessed!

Community
  • 1
  • 1
d.sz.
  • 33
  • 5