【发布时间】:2010-06-27 23:50:57
【问题描述】:
我已经设法让光标在一个简单的 XNA“游戏”中更改为 IBeam,更新为:
protected override void Update(GameTime gameTime)
{
// Allows the game to exit
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
this.Exit();
// TODO: Add your update logic here
if (Keyboard.GetState().IsKeyDown(Keys.A))
{
System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Arrow;
}
if (Keyboard.GetState().IsKeyDown(Keys.I))
{
System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.IBeam;
}
base.Update(gameTime);
}
按下“I”时鼠标变为 IBeam 光标,但当您移动鼠标时立即变为箭头。有没有办法让它保持默认的 Windows IBeam,或者我需要创建和跟踪自定义光标?
[编辑] 我还应该指出,每帧设置光标会导致鼠标在移动时闪烁。似乎 XNA(或 Windows)在内部将光标重置为每帧的箭头?
【问题讨论】:
标签: c# xna mouse-cursor