Search code examples
javalibgdxscreenrenderscaling

Libgdx assets background scaling


NOTE: This is more of a logic question then an exact answer.

So I am working on a game, this game does not move the screen at all, it just goes from screen to screen (no screen movement). SO the question is would I still use a camera and view-port? or is that a better way to handle all my images and text being scaled? for right now im just setting the screen background using the Gdx.graphics.getHeight() and getWidth(), but that doesnt increase my fonts or images to fit better into say a tablet!? would love some ideas on this as most of the videos and other questions refer to 2d or 3d moving games thanks!


Solution

  • If you want to prepare for every possible screen resolutions manually, sure scale your images by hand. Or let libgdx do the job. It doesn't matter if your camera wont move. Using stage with your preferred viewport and actors will help you a lot and will save you time and lines of code if you get familiar with them.

    Viewport types and usage examples: https://github.com/libgdx/libgdx/wiki/Viewports

    For preparing with fonts to different resolutions is a little more tricky but gdx smart font: https://github.com/jrenner/gdx-smart-font provides an elegant way, generating bitmap fonts according to screen size.