C
C#5mo ago
mynarco

Raw mouse input from a win32 hwnd.

Hello, i am writing a game with raylib, but the mouse input is inconsistant and pretty terrible so i wanted to know of any ways(im fine with any deps) to get raw mouse input. all i really need to recieve is the mouse coordinates. It needs to be precise and fast
16 Replies
Omnissiah
Omnissiah5mo ago
how does this work, are you using a winform? if so you would have an event loop and you can set an eventhandler for mousemove but if you say "hwnd" i assume you don't have that
mynarco
mynarcoOP5mo ago
ah no i am using raylib just a bare dotnet project i need someting identitcal to GLFW's raw mouse motion https://www.glfw.org/docs/3.3/input_guide.html#:~:text=Raw%20mouse%20motion%20is%20closer,for%20example%20a%203D%20camera.
Omnissiah
Omnissiah5mo ago
ok but will you have a surface to render on, even if a windows api registered form? also if you are that raw then why go c#
mynarco
mynarcoOP5mo ago
because c# is very modular and easy to distribute and im most proficient in it YES i am using RAYLIB TO RENDER all i need is MOUSE INPUT
Omnissiah
Omnissiah5mo ago
raylib is not a windows class, tho you have to know which windows object you have under the hood to get coordinates in your context or you get global mouse position, but it will require to run as admin, probably, and you still have to scale for resolution
mynarco
mynarcoOP5mo ago
raylib uses glfw to handle windowing, i cant get a glfw handle from raylib but i can get a win32 window handle i want to use that window handle to get mouse input
Omnissiah
Omnissiah5mo ago
are you really sure this is an easier problem to solve than try getting better mouse movement from raylib itself? i would search if raylib lets the dev in the event loop to catch wm mouse move events if that's a no then you kinda need to do the more harsh way
mynarco
mynarcoOP5mo ago
it doesnt, i have tried everything with raylib i need to do the harsh way i just am not sure HOW
Omnissiah
Omnissiah5mo ago
you can search for api SetWindowsHookEx, could be one way i believe you can try with GetRawInputData api series, but i never used that there are other ways too, with windows api iirc you could add another method for processing messages and catch mouse events there but since it's all apis you need to interop outside of c#
sibber
sibber5mo ago
theres the RawInput api and theres the new GameInput api that ive never used
mynarco
mynarcoOP5mo ago
are there any c# examples of the rawinput api?
sibber
sibber5mo ago
not really, youd have to pinvoke or find a lib ig
mynarco
mynarcoOP5mo ago
alreight ill try that out
sibber
sibber5mo ago
but how come raylibs input system isnt good its a pretty popular library so thats a bit surprising
mynarco
mynarcoOP5mo ago
this is from someone that is very very familiar with raylib
No description
sibber
sibber5mo ago
try putting it in raw mode tracking via window messages isnt going to be reliable yeab
Want results from more Discord servers?
Add your server