System requirements for xna games




















This ends up working out, because the SpriteBatch and GameTime classes do not have any methods or properties that can be accessed outside of an instance of the classes, while Mouse does.

If the mouse reports that the left button is pressed, the code checks with the currentSquare object by calling its Contains method to determine if the mouse's coordinates fall within its area. If they do, then the player has "caught" the square and scores a point. The timeRemaining counter is set to 0 , indicating that the next time Update is called, it should create a new square.

After dealing with the user input, the MathHelper. Max method is used to decrease timeRemaining by an amount equal to the elapsed game time, since the last call to Update.

Max is used to ensure that the value does not go below zero. The Microsoft. Framework namespace provides a class called MathHelper that contains lots of goodies to make your life easier when dealing with numeric data, including converting degrees to and from radians, clamping values between a certain range, and generating smooth arcs between a starting and ending value.

The final method in the default Game1. Draw is normally called once after each call to Update , unless something is happening to slow down the execution of your game. In that case, Draw calls may be skipped in order to call Update more frequently. There will always be at least one call to Update between calls to Draw , however, as sequential Draw calls would provide no benefit—nothing in the game state will have changed. The default Draw method simply clears the display window to the Cornflower Blue color.

Alter the GraphicsDevice. Clear Color. CornflowerBlue call and replace Color. CornflowerBlue with Color. Gray to make the game a bit easier on the eyes. Any time you use a SpriteBatch object to draw to the display, you need to wrap the calls inside a Begin and End pair. Any number of calls to spriteBatch. Draw can be included in a single batch, and it is common practice to simply start a Begin at the top of your Draw code, use it for all of your drawing, and then End it right before the Draw method exits.

While not benefiting our SquareChase game, batching sprite drawing calls greatly speeds up the process of drawing a large number of images, by submitting them to the rendering system all at once instead of processing each image individually. The SpriteBatch. Draw method is used to draw a Texture2D object to the screen. There are a number of different options for how to specify what will be drawn. In this case, the simplest call requires a Texture2D object squareTexture , a destination Rectangle currentSquare , and a tint color to apply to the sprite.

The expression " playerScore Mod 3 " takes the player's score, divides it by 3, and returns the remainder. The result will always be 0 , 1 , or 2. This fits perfectly as an index to the elements in the colors array, allowing us to easily change the color of the square each time the player catches one. Finally, the spriteBatch. End tells XNA that we have finished queuing up sprites to draw and it should actually push them all out to the graphics card.

Run your game by clicking on Start Debugging from the Debug menu or hitting F5 on the keyboard. Play an exciting game of SquareChase , by holding down the mouse button and trying to catch the squares with your mouse cursor:.

Granted, it is not exactly the next blockbuster, but at only around 30 lines of code, it implements a simple game mechanic, user input, score tracking and display, and clock-based timing. Not bad for a few minutes' work. As simple as it is, here are a couple of enhancements you could make to SquareChase :. Vary the size of the square, making it smaller every few times the player catches one, until you reach a size of 10 pixels.

Start off with a higher setting for TimePerSquare and decrease it a little each time the player catches a square hint : you'll need to remove the Const declaration in front of TimePerSquare if you wish to change it at runtime. We also saw how the XNA game loop initializes, executes, and constructs an elementary game by expanding on the default methods provided by the Windows Game template.

It is time to dive headfirst into game creation with XNA. In the next chapter, we will begin building the puzzle game Flood Control in which the player is challenged to pump water out of their flooding underwater research station before the entire place really is underwater! He has built games for everything from the Commodore 64 to the Xbox He is the owner of xnaresources. About this book XNA Game Studio enables hobbyists and independent game developers to easily create video games, and now gives that power to Visual Basic developers.

Publication date: December Publisher Packt. Pages ISBN Chapter 1. Tip What does XNA stand for, anyway? Overview of the games. System requirements. Graphics Card Shader Model 1. Close Visual Studio Express. What just happened?

Building your first game. Tip Visual Basic versus C - tutorials and samples on the web With a five-year headstart on Visual Basic developers, there are a host of XNA tutorials, code samples, and forum posts written for C out on the Internet. Time for action — creating a new Windows game project. Click on OK. Tip Back up your projects When you create your project, the Location field specifies where it will be saved.

Anatomy of an XNA game. The declarations area. Time for action — adding variables to the class declaration area. Red, Color. Green, Color.

Tip Data types If your experience with Visual Basic is primarily VBScript-related, you may not be used to specifying data types integer, single, Texture2D, and so on to your variables. In the case of SquareChase, we are using two basic data types: Integer : It is a whole-number value between -2,,, and 2,,, The Game1 class constructor. Tip Objects, classes, and methods Many of the items that we define in our code will be classes.

The Initialize method. Time for action — customizing the Initialize method. Add the following before the call to MyBase. Initialize : Me. Tip Input types on other platforms The Xbox and Windows Phone do not have mice, so what happens when the code to enable the mouse runs on these platforms? The LoadContent method.

Time for action — creating the squareTexture. BMP " in a temporary location. Tip Powers of two Very old graphics cards required that all texture images be sized to "powers of two" 2, 4, 8, 16, 32, 64, , , and so on. Tip Asset names If you create subdirectories inside your Content project as we will do in the other games in this book , the asset name will include the path to the file. The Update method. Tip Exiting a game under Windows The default Update code provides anyone with a gamepad a way to end the game, but what if you do not have a gamepad?

Time for action — coding Update for SquareChase. Next 0, Me. Width - 25 ,rand. GetState If mouseInfo. Pressed And currentSquare. Contains mouseInfo.

X, mouseInfo. Max 0, timeRemaining -CType gameTime. TotalSeconds, Single Me. ToString Copy. Details required :. This is the file I have been trying to install. Also just realized that under system requirements it doesn't list windows Does that mean I can't use it?

And if that's the case, how do I play any game that uses the framework? Hi, Owen, Try installing the game in compatibility mode and check. Right-click on the set up file and select Properties.

Select Compatibility tab. Check Run this program in Compatibility mode. Let the game install and then check the functionality. This ensures that the square will always be fully within the game window.

Next, the current position and button state of the mouse is captured into the "mouse" variable via Mouse. Both the Keyboard and the GamePad classes also use a GetState method that captures all of the data about that input device when the method is executed. If the mouse reports that the left button is pressed, the code checks with the currentSquare object by calling its Contains method to determine if the mouse's coordinates fall within its area.

If they do, then the player has "caught" the square and scores a point. The timeRemaining counter is set to 0, indicating that the next time Update is called it should create a new square.

After dealing with the user input, the MathHelper. Max method is used to decrease timeRemaining by an amount equal to the elapsed game time since the last call to Update. Max is used to ensure that the value does not go below zero.

The Microsoft. Framework namespace provides a class called MathHelper that contains lots of goodies to make your life easier when dealing with numeric data, including converting degrees to and from radians, clamping values between a certain range, and generating smooth arcs between a starting and ending value.

The final method in the default Game1. Draw is normally called once after each call to Update unless something is happening to slow down the execution of your game. In that case, Draw calls may be skipped in order to call Update m ore frequently. There will always be at least one call to Update between calls to Draw , however, as sequential Draw calls would provide no benefit—nothing in the game state will have changed.

The default Draw method simply clears the display window in the Cornflower Blue color. Alter the GraphicsDevice. Clear Color. CornflowerBlue ; call and replace Color. CornflowerBlue with Color. Gray to make the game a bit easier on the eyes. Any time you use a SpriteBatch object to draw to the display, you need to wrap the calls inside a Begin and End pair. Any number of calls to spriteBatch. Draw can be included in a single batch and it is common practice to simply start a Begin at the top of your Draw code, use it for all of your drawing, and then End it right before the Draw method exits.

While not benefiting our SquareChase game, batching sprite drawing calls greatly speeds up the process of drawing a large number of images by submitting them to the rendering system all at once instead of processing each image individually.

The SpriteBatch. Draw method is used to draw a Texture2D object to the screen. There are a number of different options for how to specify what will be drawn. In this case, the simplest call requires a Texture2D object squareTexture , a destination Rectangle currentSquare , and a tint color to apply to the sprite.

The result will always be 0, 1, or 2. This fits perfectly as an index to the elements in the colors array, allowing us to easily change the color of the square each time the player catches one. Finally, the spriteBatch. End tells XNA that we have finished queuing up sprites to draw and it should actually push them all out to the graphics card. Run your game by clicking on Start Debugging from the Debug menu or hit F5 on the keyboard.

Play an exciting game of SquareChase by holding down the mouse button and trying to catch the squares with your mouse cursor:. Granted it is not exactly the next blockbuster, but at only 33 lines of code, it implements a simple game mechanic, user input, score tracking and display, and clock-based timing. Not bad for a few minutes work. Vary the size of the square, making it smaller every few times the player catches one, until you reach a size of 10 pixels.

Start off with a higher setting for TimePerSquare and decrease it a little each time the player catches a square. Hint: You'll need to remove the const declaration in front of TimePerSquare if you wish to change it at runtime. We also saw how the XNA game loop initializes and executes, and constructs an elementary game by expanding on the default methods provided by the Windows Game template.

It is time to dive head first into game creation with XNA. In the next chapter, we will begin building the puzzle game Flood Control in which the player is challenged to pump water out of their flooding underwater research station before the entire place really is underwater!

He has built games for everything from the Commodore 64 to the Xbox He is the owner of xnaresources. About this book XNA Game Studio enables hobbyists and independent game developers to easily create video games. Publication date: September Publisher Packt.

Pages ISBN Chapter 1. Tip What does XNA stand for, anyway? Overview of the games. System requirements. Graphics card Shader Model 1. Optional requirements Windows Phone DirectX 10 or later, Compatible Video Card Development tools include a Windows Phone emulator to test applications without deployment to a physical device. Zune platform Zune Software 3. Tip HiDef vs. Reach As of version 4. Close Visual Studio Express.

Extract the ZIP file contents to a temporary folder leave this folder open. Drag the fonts from the temporary folder to the Fonts folder. Close both Explorer windows. What just happened? Tip The redistributable fonts package To use its integrated text drawing methods, XNA games need to convert normal Windows fonts into an internal format called a SpriteFont. Building your first game. Time for action — creating a new Windows game project. Click on OK :.

Tip Backup your projects When you create your project, the Location field specifies where it will be saved. Anatomy of an XNA game. The declarations area. Time for action — adding variables to the class declaration area. Red, Color. Green, Color. The Game1 class constructor. The Initialize method. Time for action — customizing the Initialize method. Initialize : this. Tip Input types on other platforms The Xbox, Zune, and Windows Phone do not support a mouse, so what happens when the code to enable the mouse runs on these platforms?

The LoadContent method. Time for action — creating the squareTexture. Tip Powers of two Very old graphics cards required that all texture images be sized to "powers of two" 2, 4, 8, 16, 32, 64, , , etc. The Update method. Tip Exiting a game under Windows The default Update code provides anyone with a gamepad a way to end the game, but what if you do not have a gamepad?

Time for action — coding Update for SquareChase. Next 0, this. Width - 25 , rand. GetState ; if mouse. Contains mouse. X, mouse. Max 0, timeRemaining - float gameTime. TotalSeconds ; this.



0コメント

  • 1000 / 1000