Alexey Furi
Alexey Furi

Reputation: 45

Incorrect resolution while nunning app in android emulator LibGDX

Making an app with 1280 x 720 resolution using LibGDX.

config.height = 720;
config.width = 1280;

Works well on desktop launcher even with resize. When i'm running it on android emulator with 1920 x 1080 resolution, the app becomes uncomplete. How to scale it for any resolutions on android emulators?

Upvotes: 1

Views: 73

Answers (1)

Shox
Shox

Reputation: 84

All you need to use is viewports with your orthographic camera.

There are five viewports.

Extend Viewport , Fit viewport , Fill Viewport , stretch viewport , screen viewport.

If you want fill the whole screen without any worries about aspect ratio you can use fill or extend .

Otherwise you should use fit viewport but some black bars may appear on screen to maintain aspect ratio.

On how to use ports https://github.com/libgdx/libgdx/wiki/Viewports this link can be useful.

Upvotes: 1

Related Questions