I’m trying to get my cursor visible in an XNA game using isMouseVisible, but it doesn’t want to work. The error:
‘StopWatch.Game1’ does not contain a definition for ‘isMouseVisible’ and no extension method ‘isMouseVisible’ accepting a first argument of type ‘StopWatch.Game1’ could be found
Code:
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);
}
}
}
Use
IsMouseVisible = trueCapitalize the I
Remember, Using intelisence you can view methods and variables just by typing the beginning.