官术网_书友最值得收藏!

Time for action – customizing the Initialize() method

  1. Add the following before the call to MyBase.Initialize():
    Me.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 and Windows Phone do not have mice, so what happens when the code to enable the mouse runs on these platforms? Nothing! If a platform is not equipped to support a specific type of input, the request just returns the default values when no input is being received. 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.

主站蜘蛛池模板: 黑水县| 易门县| 永定县| 尖扎县| 得荣县| 通榆县| 白河县| 武汉市| 娱乐| 三江| 文昌市| 本溪市| 昌乐县| 壶关县| 社旗县| 襄汾县| 东莞市| 太原市| 通城县| 南溪县| 玉门市| 红桥区| 威海市| 深圳市| 中宁县| 土默特左旗| 罗田县| 鄂托克前旗| 武邑县| 阳城县| 明星| 和硕县| 正蓝旗| 泾源县| 洛浦县| 通道| 绵竹市| 田阳县| 南部县| 奉节县| 梁平县|