Time for action – customizing the Initialize() method

  1. 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 ...

Get XNA 4.0 Game Development by Example Beginner's Guide 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.