我正在尝试使用isMouseVisible使光标在XNA游戏中可见,但它不想工作。错误:
'StopWatch.Game1‘不包含'isMouseVisible’的定义,也找不到接受'StopWatch.Game1‘类型第一个参数的扩展方法'isMouseVisible’。
代码:
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
namespace StopWatch
{
public class Game1 : Microsoft.Xna.Framework.Game
{
GraphicsDeviceManager graphics;
public SpriteBatch spriteBatch;
public static Game1 Instance;
StopWatch stopWatch;
public Game1()
{
this.isMouseVisible = true;
graphics = new GraphicsDeviceManager(this);
Instance = this;
Content.RootDirectory = "Content";
graphics.PreferredBackBufferWidth = 512;
graphics.PreferredBackBufferHeight = 512;
}
protected override void Initialize()
{
stopWatch = new StopWatch();
base.Initialize();
}
protected override void LoadContent()
{
spriteBatch = new SpriteBatch(GraphicsDevice);
stopWatch.LoadContent();
}
protected override void UnloadContent()
{
stopWatch.UnloadContent();
}
protected override void Update(GameTime gameTime)
{
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
this.Exit();
stopWatch.Update(gameTime);
base.Update(gameTime);
}
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
spriteBatch.Begin();
stopWatch.Draw(gameTime);
spriteBatch.End();
base.Draw(gameTime);
}
}
}发布于 2012-07-18 15:52:38
使用IsMouseVisible = true
资本化I
记住,使用智能,只需输入开头就可以查看方法和变量。
https://stackoverflow.com/questions/11545253
复制相似问题