Time for action – customizing the Initialize() method
Make the mouse pointer visible by adding the following before the call to
base.Initialize()
:this.IsMouseVisible = true;
What just happened?
By default, the mouse is not visible inside the XNA game window. Setting the IsMouseVisible
property of the running instance of the Game1 class enables the mouse cursor in Windows.
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? Nothing! It just gets ignored. It is also safe to ask other platforms about their non-existent keyboards and check the state of a gamepad on a Windows PC without one attached.
The LoadContent() method
Part of the responsibility of the base Initialize()
method is to call LoadContent()
when the normal initialization has completed. The method is used to read in any graphical and audio resources your game will need. The default LoadContent()
method is also where the spriteBatch
object gets initialized. You will use the spriteBatch
instance to draw objects to the screen during execution of the Draw()
method.