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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access