Game Development Reference
In-Depth Information
screen with a physical size of 6.5×4.5 centimeters. That's 100 pixels per centimeter on both axes
on the Nexus One, and roughly 71 pixels per centimeter on both axes on the Hero. We can easily
calculate the pixels per centimeter using the following equation:
pixels per centimeter (on x-axis) = width in pixels / width in centimeters
Or:
pixels per centimeter (on y-axis) = height in pixels / height in centimeters
Usually, we only need to calculate this on a single axis since the physical pixels are square
(they're actually three pixels, but we'll ignore that here).
How big would a 100×100-pixel rectangle be in centimeters? On the Nexus One, we have a
1×1-centimeter rectangle, while the Hero has a 1.4×1.4-centimeter rectangle. This is something
we need to account for if, for example, we are trying to provide buttons that are big enough for
the average thumb on all screen sizes. This example implies that this is a major issue that could
present huge problems; however, it usually doesn't. We need to make sure that our buttons are
a decent size on high-density screens (for example, the Nexus One) since they will automatically
be big enough on low-density screens.
Aspect Ratio
Aspect ratio is another problem to consider. The aspect ratio of a screen is the ratio between
the width and height, in either pixels or centimeters. We can calculate aspect ratio using the
following equation:
pixel aspect ratio = width in pixels / height in pixels
Or:
physical aspect ratio = width in centimeters / height in centimeters
Here, width and height usually mean the width and height in landscape mode. The Nexus One
has a pixel and physical aspect ratio of ~1.66. The Hero has a pixel and physical aspect ratio
of 1.5. What does this mean? On the Nexus One, we have more pixels available on the x axis in
landscape mode relative to height than we have available on the Hero. Figure 5-2 illustrates this
with screenshots from Replica Island on both devices.
Note This topic uses the metric system. We know this might be an inconvenience if you are
familiar with inches and pounds. However, as we will be considering some physics problems in the
following chapters, it's best to get used to it now since physics problems are usually defined in the
metric system. Remember that 1 inch is roughly 2.54 centimeters.
 
 
Search WWH ::




Custom Search