Time for action – creating the UIWidget class
In order to build a base class for all of the game controls, perform the following steps:
1. Download the
7089_07_GRAPHICSPACK.ZIP
file from the book's companion website and extract its contents to a temporary folder.2. Select the two
.png
files (button_50px.png
andExplosion.png
) from the graphics package and copy them to the Windows clipboard.3. In Visual Studio, right-click on the Textures folder in the TankBattlesContent (Content) project and select Paste to add the textures to your game.
4. Back in the temporary folder, select the
Sphere.x
file and the Sphere folder and copy them to the Windows clipboard.5. Paste these items into the Models folder in Solution Explorer.
6. Right-click on the Sphere folder under Models in Solution Explorer and select Exclude from Project.
7. Add a new class file called
UIWidget.cs
to theTankBattlesGame
project.8. Add the following
using
declarations at the beginning of theUIWidget.cs
file:using Microsoft.Xna...