Having a really weird issue, it seems that no matter what I do I cannot get the Mouse to lock to the center of the screen in MonoGame. I triple checked all the possible noob mistakes, and Mouse.SetPosition does get called. Weirder still, setting Game.IsMouseVisible to false does nothing as well.

        public override void Update(GameTime gt)
            _lastmousestate = _mousestate;
            _mousestate = Mouse.GetState();
            Point distance = new Point(_mousestate.X - _lastmousestate.X, _mousestate.Y - _lastmousestate.Y);
            MouseEntity.Position = new Point(MouseEntity.Position.X - distance.X, MouseEntity.Position.Y - distance.Y);

I'm using Linux Mint 64-bit with Cinnamon.

  • \$\begingroup\$ Then perhaps you should file a bug report. What exactly is the question? \$\endgroup\$
    – petervaz
    May 22, 2013 at 13:29
  • \$\begingroup\$ Before a bug report, maybe someone on Windows could verify that this code works correctly in Microsoft XNA? \$\endgroup\$
    – Katana314
    May 22, 2013 at 13:58
  • \$\begingroup\$ @Katana314 I'm on it. \$\endgroup\$
    – Grey
    May 22, 2013 at 14:13
  • \$\begingroup\$ It seems to work on Windows in my Linux Mono Game Project. It may be a bug. \$\endgroup\$
    – Grey
    May 22, 2013 at 14:17

1 Answer 1



In this thread the user is struggling with getting the mouse-position(Mouse.SetPosition) to work. Unfortunately it is a bug within MonoGame so it is going to have to take some internal editing. Please look at the code/instructions he has posted within the thread so you can solve your error. It seems like this error is Linux specific only.

I could not find anything on your IsMouseVisible = false not working. Perhaps if you make the following adjustments in the linked thread above, it might work.


The fixes are within two files: OpenTKGameWindow.cs and Mouse.cs

I would submit a bug report to OpenTK, however I am not sure if your bug report will be acknowledged. It's last release was on 2010-Oct-06. It seems like it is being neglected.

  • \$\begingroup\$ Sad to hear, looks like I'll be going back to XNA on Windows. Turns out there is also no SpriteFOnt support meaning I can't port any of my games. >___> \$\endgroup\$ May 22, 2013 at 15:18
  • \$\begingroup\$ @redcodefinal There actually is SpriteFont support. I have gotten it to work in my Linux MonoGame Project. Would you like me to link you to something that show you how to make it work? \$\endgroup\$
    – Grey
    May 22, 2013 at 15:54
  • \$\begingroup\$ You could finish your ports if you help fix the bugs in MonoGame. Why don't you grab a copy of the source code and see if you can figure it out that way? \$\endgroup\$ May 23, 2013 at 0:14
  • \$\begingroup\$ I didn't realise MonoGame was a living project, I'd love to submit bugs when I find them! Could you link me to the bug report site? \$\endgroup\$ May 24, 2013 at 2:54
  • \$\begingroup\$ monogame.net/issues \$\endgroup\$
    – Grey
    May 24, 2013 at 13:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .