Game Development Reference
In-Depth Information
// is snapped
}else if (newViewState === viewStates.filled) {
// is filled
} else if (newViewState === viewStates.fullScreenLandscape) {
// is full screen
} else if (newViewState === viewStates.fullScreenPortrait) {
//is portrait
}
}
}
Notice how we can also detect screen rotation? You can disable that for your game, but in or-
der to be approved by the store, you need to handle the other three view states properly. As
of now, the majority of Windows 8 devices are probably running in landscape mode. While
portrait mode is the default orientation on phones, you'll find that Windows 8 is designed for
landscape due to its desktop heritage. That's not to say that you should totally ignore portrait
mode, but if you are working on minimizing scope creep, especially for your first Windows 8
game, I would suggest sticking to landscape. Likewise, if your game was designed to run in
portrait mode since it was created for a mobile device first, you may have to consider center-
ing it on a background image while in landscape mode, which is a popular technique many
games are already utilizing in the Windows Store when running on larger resolutions the
game wasn't ideally intended to support.
Scaling Games for Full Screen
By design, all Windows 8 apps run at full screen at any resolution. What that means is that,
given the huge user base of Windows 7 and the potential of upgrading desktops attached to
large monitors, your game will have to support resolutions higher than 1366×768. Let's be
practical. While HTML5 games run great on Windows 8 at normal resolutions, the bigger the
display, the slower your game will run. This is directly attributed by the increase of pixels
your game will be trying to update to the display; the larger the resolution the more pixels
being rendered. Fortunately, we can take advantage of a few techniques to stretch out our
canvas in a way that will help balance performance and maintain the ascetics of your game.
There are two ways to stretch the canvas:
▪ Scale to Fit - This stretches out the canvas to fill the screen, and while most people may
not notice, your game could look wide or squished on odd resolutions.
Search WWH ::




Custom Search