QB64.org Forum

Active Forums => QB64 Discussion => Topic started by: madscijr on February 24, 2021, 12:41:01 pm

Title: reading multiple mice input revisited / external library question
Post by: madscijr on February 24, 2021, 12:41:01 pm
The original discussion was here
https://www.qb64.org/forum/index.php?topic=3348.msg127110#msg127110 (https://www.qb64.org/forum/index.php?topic=3348.msg127110#msg127110)

After doing some more research, I came upon a couple libraries (DLLs, C#, C code) that puport to let you read separate input from multiple mice plugged into the PC.
Some of them even claim to be cross-platform. Links below.

Some questions I have:

Any thoughts or advice appreciated...



This guy made a .NET library for his Unity games. It seems to be a general purpose library so you don't have to be in Unity to use it:

Multiple Mice Input in Unity, Posted on August 4, 2015 by alastaira
https://alastaira.wordpress.com/2015/08/04/multiple-mice-input-in-unity/ (https://alastaira.wordpress.com/2015/08/04/multiple-mice-input-in-unity/)

github alastaira/MultiMouse
https://github.com/alastaira/MultiMouse/tree/master/RawInputSharp (https://github.com/alastaira/MultiMouse/tree/master/RawInputSharp)



A project called ManyMouse that is written in C, that several people seem to have forked and are using in their projects (including Python):

github NoobsArePeople2/manymouse
https://github.com/NoobsArePeople2/manymouse (https://github.com/NoobsArePeople2/manymouse)

github EdgarReynaldo/ManyMouse - Multi Mouse support on Windows
https://github.com/EdgarReynaldo/ManyMouse (https://github.com/EdgarReynaldo/ManyMouse)

github nfirvine/pymanymouse - a python binding for icculus' C ManyMouse library
https://github.com/nfirvine/pymanymouse (https://github.com/nfirvine/pymanymouse)

mickeyvanolst/manyMouse-combined-input: Calculates the orientation and corrected movement of two mouse inputs.
https://github.com/mickeyvanolst/manyMouse-combined-input (https://github.com/mickeyvanolst/manyMouse-combined-input)

The original project pages for ManyMouse:
ManyMouse - June 26th, 2005: Initial source released to the world!
http://icculus.org/manymouse/ (http://icculus.org/manymouse/)
http://hg.icculus.org/icculus/manymouse/raw-file/tip/README.txt (http://hg.icculus.org/icculus/manymouse/raw-file/tip/README.txt)
http://hg.icculus.org/icculus/manymouse/ (http://hg.icculus.org/icculus/manymouse/)



A couple others:

A C library to handle multiple keyboards:
http://www.codeproject.com/Articles/17123/Using-Raw-Input-from-C-to-handle-multiple-keyboard – which handles multiple keyboards. (http://www.codeproject.com/Articles/17123/Using-Raw-Input-from-C-to-handle-multiple-keyboard – which handles multiple keyboards.)

A C library and C# port for multi mice using RawInput:
http://jstookey.com/arcade/rawmouse/ (http://jstookey.com/arcade/rawmouse/)
Title: Re: reading multiple mice input revisited / external library question
Post by: madscijr on March 02, 2021, 05:09:49 pm
Well, I tried creating a DLL project with Visual Studio 2019 Community edition,
using the manymouse Windows code at
https://github.com/NoobsArePeople2/manymouse (https://github.com/NoobsArePeople2/manymouse)
but I can't get it to work.
I did some C at school many moons ago, and even then I was never any good at it.
The files that seem to apply are
and there is "Makefile" which I have no idea what to do with.
Visual Studio 2019 doesn't let you make C projects, just C++, so I tried that and renamed the files with a ".c" extension, but got a million errors.
I also tried using the ".cpp" extension, and got a bunch of different errors.
If anyone has any experience with this stuff, I would appreciate any help getting it working.
Also, assuming this gets made into a DLL, how do you call a DLL from QB64?
Or is a DLL the wrong way to go about it?
Title: Re: reading multiple mice input revisited / external library question
Post by: TempodiBasic on March 02, 2021, 08:25:08 pm
Hi Madscijr
I have thought that you have got the point .

So there is a bad C/C++ between your project and the work done from other programmers that have reached your goal.

I can suggest you, after looking into this file https://github.com/NoobsArePeople2/manymouse/blob/master/windows_wminput.c (https://github.com/NoobsArePeople2/manymouse/blob/master/windows_wminput.c)
that  it is plenty of API calls.... so you can hope in the partecipation of SpriggySprings for get the point and bypass the DLL in C for calling API of windows10, I think it is better to call directly from QB64 the API of windows10.

Good Luck and Good Coding

Title: Re: reading multiple mice input revisited / external library question
Post by: madscijr on March 26, 2021, 01:57:39 pm
it is plenty of API calls.... so you can hope in the partecipation of SpriggySprings for get the point and bypass the DLL in C for calling API of windows10, I think it is better to call directly from QB64 the API of windows10.

Thank you for your reply.

It would make sense to make API calls directly from QB64.

I will google how to do that, but if anyone can supply examples or a link to any, that would be helpful.

Never mind, I think I found an example here:
https://www.qb64.org/forum/index.php?topic=1422.msg106165#msg106165 (https://www.qb64.org/forum/index.php?topic=1422.msg106165#msg106165)

Thanks again. If and when I get this stuff working I'll share it on here...
Title: Re: reading multiple mice input revisited / external library question
Post by: madscijr on March 30, 2021, 12:31:14 pm
Update: I had some followup questions about doing events and malloc in QB64, see here:
https://www.qb64.org/forum/index.php?topic=3766.0 (https://www.qb64.org/forum/index.php?topic=3766.0)