Book Image

Libgdx Cross-platform Game Development Cookbook

Book Image

Libgdx Cross-platform Game Development Cookbook

Overview of this book

Table of Contents (20 chapters)
Libgdx Cross-platform Game Development Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Handling multiple screen sizes with viewports


The diversity of devices users play games on is vast and overwhelming, especially when targeting different platforms including phones, tablets, and browsers. This presents a lot of challenges for developers. Hundreds of different specs, processing power, screen sizes, APIs... It is a real mess. When it comes to games, it is not only the programmers who are affected, but designers, animators, and artists are also affected. The same level may not look the same on two devices and both level layout and assets need to cater for that.

Nowadays, it is not rare at all to find a situation like the one shown in the following figure:

There is a range of strategies to tackle the varying screen resolution and different aspect ratios problem. Unsurprisingly, Libgdx has an out-of-the-box solution for this covering a subset of these strategies. Fortunately enough, its flexibility lets you implement your own in case your requirements are special.

These strategies...