Converting the Collision Game's Screen Size
The final thing that you'll need to do is change the size of the screen. In the
Game1
class, you currently set the screen
size to 1024 Ã 768 with the following code:
graphics.PreferredBackBufferHeight = 768; graphics.PreferredBackBufferWidth = 1024;
Change that code as follows:
#if !ZUNE graphics.PreferredBackBufferHeight = 768; graphics.PreferredBackBufferWidth = 1024; #else graphics.PreferredBackBufferHeight = 320; graphics.PreferredBackBufferWidth = 240; #endif
Along with the screen size, you'll want to revisit other issues that your game
will have because of the small size of the screen on the Zune. For example, if you
deployed the game as it's currently written, your sprites would be nearly as wide as
the screen. Luckily, you already have an easy way to change the scale of all sprites
built into your code. In the Sprite
class, you
have the following variables that cause all sprites to be drawn at their original
sizes (a scale factor of 1):
protected float scale = 1; protected float originalScale = 1;
Change that code to draw the sprites much smaller if you're working in a Zune game:
#if(!ZUNE) protected float scale = 1; protected float originalScale = 1; #else protected float scale = .3f; protected float originalScale = .3f; #endif
Your project is now ready to be deployed to the Zune! Make sure that your Zune is connected to your PC, as described earlier in this chapter, and that the Zune is not currently syncing with your PC. Once you're ...
Get Learning XNA 3.0 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.