Making the mouse pointer appear in XNA

All of the XNA examples I have seen don't show a mouse pointer when the mouse is being moved around. I realize that I could just have an image drawn at the mouse position every frame, but is there an easy option or some easy line of code that I could use to enable the default mouse pointer until I decide to make my own pointer image



Answer this question

Making the mouse pointer appear in XNA

  • sctwest

    If you are aiming for PC and XBox compatability, keep in mind that the Mouse is an unknown object on the XBox (You'll get an error during the build) so you might want to throw in some conditional compilation directives around anything dealing with the mouse if you want your project to work on both without alot of source editing.
  • anisk

    Thanks, I'm happy that there is such an easy solution. I'm not really concerned about the XBox, just trying to make a Windows game, but thanks for the warning.


  • pfontyn

    In your Game component:

    this.IsMouseVisible = true;

  • devexpert

    Here is a link to a beta 2 article I wrote that shows you how to make a custom mouse pointer, you might want to have a look at that.

    http://www.virtualrealm.com.au/blogs/mykre/archive/2006/12/04/Custom-Mouse-Pointer-in-XNA.aspx



  • Making the mouse pointer appear in XNA