Game Development Reference
In-Depth Information
Chapter 13
Fullscreen Games
13.1 Introduction
In this chapter, we are going to deal with viewing games in full screen mode. We
will start developing the Jewel Jam game by adding some methods for switching
between full screen and window mode. All the examples we have seen until now
were drawn in a window. If you really want to involve your players in your game,
you do not want them distracted by emails, pop ups, other windows or that nice
desktop background of a game of a competitor of yours. So, the solution is to go
into full screen mode. This is not that hard to do, but there are a couple of things to
think about.
13.2 Setting the Resolution
When displaying something in full screen, the full screen resolution often will not
match the desired resolution of the game. This means that we have to scale every-
thing up or down when we go into full screen mode. Downscaling everything might
sometimes even be necessary when we are not in full screen mode, for example,
if the maximum resolution of the screen is lower than the desired resolution of the
game. As we will see later on, the XNA game engine has a few classes and methods
that we can use to achieve this.
Before we start adding fullscreen capabilities to our game, we first need to define
what the desired resolution of our game is. Setting the resolution of the game is
not that hard, we can use the graphics device manager for that. For example, the
following two lines set a resolution of 1024
×
768 pixels:
graphics.PreferredBackBufferWidth = 1024;
graphics.PreferredBackBufferHeight = 768;
Ifweareviewingthegameinawindow(likeinthe Painter game), the game engine
will automatically resize the window so that it can display 1024
×
768 pixels. If we
 
Search WWH ::




Custom Search