Some questions about Mouse Input / Raw Input

Hey, I’m a newbie to MonoGame (and C# really) and am coming from a background of mostly C/C++. Really liking the framework so far, but I have some questions relating to mouse input:

  • I noticed the only way to get any sort of mouse movement data is via a MouseState.Position, is it resolution dependent?
  • I read an old issue on github that said that mouse acceleration is applied by default with no way to turn it off. Now, the issue is closed and was 6+ years old, but I’m still left unsure if this is still the case or not.

I’m excited to see what kind of stuff I can make with MonoGame and C#, and thanks in advance for all replies!

Hi @GoldenThumbs Welcome to the Community!

Take a look here:

Which can be found here:
https://docs.monogame.net/articles/samples.html

Regarding the question, not sure…

Happy Coding!

1 Like

The only data we have about the mouse location is the Position property. It is resolution dependent. As far as I’m aware there is no way to disable acceleration if it is enabled.

Good luck with MonoGame!

1 Like

Well that sucks. I’m sure there are external libs I can use that would help with that. (or I could make a feature request on Github and see if that comes to fruition)
Not a big enough deal to stop me from using MonoGame further, but it still stings.

Anyone got recommendations on external packages/libs for such things?

Is there any specific reason to change it? as altering the mouse behaviour of a user could be detrimental to their use case scenario, I am referring to disabled users here.

You could specify to the user they may get a better experience without it enabled, but you should code based on standard inputs or simulate the preferred experience within your game.

First person games (especially shooters) don’t do too great with mouse acceleration, and the limited precision of window coords isn’t optimal for them either. I don’t think either are deal breakers for me (though mouse acceleration may be for some people who play the game) but I’d like the ability to toggle at least the mouse acceleration.
Still, probably not a good idea to be messing around with that kind of low-level stuff as a newbie.

1 Like

Did some searching, [Well, looked at the mouse options in CS:Source] what you are looking for is Raw Input:

https://csharp.hotexamples.com/examples/-/RawInput/-/php-rawinput-class-examples.html

[Original source link for the image below]
https://steamuserimages-a.akamaihd.net/ugc/276221870383310141/6E3B5D03440E8331209752EB6B9E5C3D8BEFEA22/

Might not be what you are looking for, but perhaps a useful search term now?

EDIT

I added Raw Input to your topic title.

I already know that lol.

It hasn’t been particularly helpful. All results are either either “Use this lib” or the lib the recommend, which is fairly low level and not something I feel like messing with. If it’s something I have to do to get this kind of feature then I’ll suck it up and learn it, but I’d rather not. Hope that doesn’t sound too rude or lazy, but the saying is “Work smart, not hard” :stuck_out_tongue:

Not sure this applies in this scenario :laughing:

Neither are unreferenced responses :wink:

Not sure I’ve heard that term before, could you explain it?

Highlight the piece of text you are referring to and click the Quote mark button…

Oh, literally quote it. Sorry lol

Edit: Is it better now?

Prepare to dig deeper lol, Welcome to the world of Programming.

Not what I was saying lol

Still not sure what this is referring to…

Long story short, programming is a problem-solving skill, if you are unprepared to use what you must work with, I highly doubt this is the field of interest for you.

I am referring to the use this lib, use that lib, I get annoyed at it too but c’est la vie. but I didn’t link to a lib :stuck_out_tongue: so, I was confused…

You need to do some hunting with XNA, MonoGame, Raw Mouse Input, and dig around… sometimes the answer you are looking for is not as obvious as it may seem, such as #4 in the link above.

In this scenario, Mouse Accelleration is not the thing you want to focus on, but utilising the Raw Input, which is why I said, you shouldn’t be playing with those features.

If you feel worried about using some piece of code, make sure you read the forum rules https://community.monogame.net/guidelines and then share the code you would like some help with, and be sure to state your full intention for the expectation you have, as it was not initially clear why you were looking to do what you were asking for initially.

Code On!

The term I was talking about was:

… and I just realized what you meant with this:

feel like an idiot lol.
Anyway, fully aware programming is a problem-solving skill, was just hoping someone could point me in a good direction to problem-solve. My intention with this thread was to see if raw input was already exposed in MonoGame (since every thread I had looked at was years old!) and I don’t need to mess around with external dependencies. Totally fine with doing so, as I am familiar with C/C++ so that’s pretty much the standard for me, but I’d like to avoid it if I can. Since it seems I can’t, OFF TO NUGET I GO!
At least there’s a built-in and standardized package manager with C#, I really appreciate that kind of stuff. Shouldn’t be nearly as much of a pain here as it would be with C/C++.

Edit: Also forgot to apologize for everything becoming so convoluted. Not feeling too great today, not sure why.

1 Like

Welcome to the boat :pirate_flag: lol

I at first thought I would find something funny for this… but then I found this…:

[Link to the image below source https://hcti.io/v1/image/5d313fd2-6b75-41aa-b4be-6a2952d3cdcb]


There was an entire thing about it as recent as last year… lol

There we go, a good meme for it…

Hopefully, someone jumps at the Raw Input title and can help if they know a better method that works for MonoGame, I too would be interested to see an implementation…

EDIT

Know the feeling, my house tried killing me last week.

1 Like

Sounds like an interesting story lol.
BTW, should I put in a feature request on MonoGame’s github issues?

1 Like

Try posting in the 3.8 thread first, but if you feel like self-harming, hop onto the Discord chat server where all the uber-cool users are, there is a link on the home page somewhere…

Usually making a feature request, is best when you have a solution tested and ready to implement, at least that’s how I see it.

In case it is not known, for the benefit of by-passers, MonoGame is a volunteer project, it is not like some other highly funded engine projects.

I am waiting to develop my first release game to make a sizeable donation when it is feasible for me. got to beat that $10,000 donation

1 Like

Hey, @GoldenThumbs,

Here’s how you can implement Raw mouse input into Mouse/MouseState,

It works only on the Desktop/DirectX platform.

2 Likes

Thanks for this! I’ve been looking for external libraries to handle it but I guess it would make more sense to make use of a custom MonoGame fork. I would prefer things to be crossplatform but I’ll take what I can!

Saw that you tried to merge this a few years ago. Why’d it never get merged?