Я пытаюсь установить положение мыши равным переменной «location», но я получаю сообщение об ошибке «Невозможно неявно преобразовать тип« void »в« Microsoft.Xna. Framework.Input.MouseState». Насколько я могу сказать, «местоположение» не пусто. Вот код, который немного суматохи из-за пытаемся сделать эту работу:Назначенная переменная Mouse.SetPosition() считается void
class Player
{
private Texture2D texture;
private static int textureSize = 20;
private static int screenWidth = Game1.Instance.GraphicsDevice.Viewport.Width;
private static int screenHeight = Game1.Instance.GraphicsDevice.Viewport.Height;
private static int halfTexture = (int)(textureSize * (screenHeight/(double)textureSize))/2;
private Vector2 location;
private Rectangle destination;
private float speed;
private MouseState mouse;
public Player(Texture2D texture)
{
this.texture = texture;
this.location = new Vector2(screenWidth/2 - halfTexture, screenHeight * 3/4 - halfTexture);
this.destination = new Rectangle((int)location.X, (int)location.Y, textureSize, textureSize);
this.mouse = Mouse.SetPosition((int)location.X, (int)location.Y); // the error is here
}
Так что здесь происходит и как это исправить?
Каковы значения 'location.x' и' location.y' в этом случае? –
X должно быть 390, а Y должно быть 440 – Firearrow5235