2

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);
        }
    }
}

1 Answer 1

2

Use IsMouseVisible = true

Capitalize the I

Remember, Using intelisence you can view methods and variables just by typing the beginning.

2
  • Thats why I use an RSS Feed :P
    – Cyral
    Jul 18, 2012 at 15:55
  • I know what you mean, I hate when I spend Half and hour trying to do something, take a break... come back and be like "Oh duh.."
    – Cyral
    Jul 18, 2012 at 16:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.