c# - An object reference is required for the non-static field, method, or property 'Microsoft.Xna.Framework.Input.MouseState.X.get'? -
so, want draw texture in front of cursor. here's code:
private void drawcursor() { //draws cursor vector2 mouseplace = new vector2(mousestate.x, mousestate.y); spritebatch.draw(cursor, mouseplace, color.white ); }
and error:
error 1 object reference required non-static field, method, or property 'microsoft.xna.framework.input.mousestate.x.get' , this:
error 2 object reference required non-static field, method, or property 'microsoft.xna.framework.input.mousestate.y.get' how fix those?
(sorry if noob question)
mousestate
isn't static class.. you'll need this:
var mousestate = mouse.getstate(); vector2 mouseplace = new vector2(mousestate.x, mousestate.y);
etc. x , y public properties of mousestate
instance.
Comments
Post a Comment