我在XNA中遇到了鼠标坐标的一些问题 - 0x0在屏幕的左上角任意靠近(但不在其中).
我现在正在以窗口模式运行游戏,但坐标基于屏幕,而不是游戏窗口(即使XNA文档告诉我它应该是另外的)
提前致谢!
这是代码:
namespace TheGame
{
class Mousey
{
static public Vector2 pos;
static private Texture2D tex;
static public MouseState mouseState;
static public MouseState previousState;
//static public Mousey()
//{
//}
static public void Update()
{
previousState = mouseState;
mouseState = Mouse.GetState(); //Needed to find the most current mouse states.
pos.X = mouseState.X; //Change x pos to mouseX
pos.Y = mouseState.Y; //Change y pos to mouseY
}
//Drawing function to be called in the main Draw function.
static …Run Code Online (Sandbox Code Playgroud)