O'Reilly logo

LibGDX Game Development By Example by James Cook

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Handling different screen sizes

On to the final topic of this chapter. One important aspect of game development that needs to be addressed, especially in the world of mobile gaming, is the varying screen sizes that a game can be played on.

Currently, our Snake game is just running against whatever native screen size we have configured in our DesktopLauncher class. If you look at this you will see that in fact we haven't configured any; we have just used the default LibGDX desktop configuration of 640 x 480 pixels.

You might now be wondering why this actually matters. Let's take our Snake game as an example. We currently create a grid of 32 x 32 pixels in which our snake moves around. If the screen size is suddenly doubled, our grid will double in ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required