首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >XNA -“isMouseVisible”没有定义

XNA -“isMouseVisible”没有定义
EN

Stack Overflow用户
提问于 2012-07-18 15:46:47
回答 1查看 833关注 0票数 2

我正在尝试使用isMouseVisible使光标在XNA游戏中可见,但它不想工作。错误:

'StopWatch.Game1‘不包含'isMouseVisible’的定义,也找不到接受'StopWatch.Game1‘类型第一个参数的扩展方法'isMouseVisible’。

代码:

代码语言:javascript
复制
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);
        }
    }
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-07-18 15:52:38

使用IsMouseVisible = true

资本化I

记住,使用智能,只需输入开头就可以查看方法和变量。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11545253

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档