Author Topic: reading multiple mice input revisited / external library question  (Read 1747 times)

0 Members and 1 Guest are viewing this topic.

Offline madscijr

  • Seasoned Forum Regular
  • Posts: 295
The original discussion was here
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:
  • Being a simple BASIC programmer and not too familiar with C (but willing to try), how would you use these from QB64, and is it possible?
  • What do you recommend using to compile a C program for use in QB64 on Windows (32 or 64 bit)?
  • In some of the examples they instantiate objects, so how could/would you use an object from QB64? Would you need to write some kind of pass through library that itself uses an object but presents a non-OOP interface for a non-OO language like QB64 to use it?

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/

github alastaira/MultiMouse
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

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

github nfirvine/pymanymouse - a python binding for icculus' C ManyMouse library
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

The original project pages for ManyMouse:
ManyMouse - June 26th, 2005: Initial source released to the world!
http://icculus.org/manymouse/
http://hg.icculus.org/icculus/manymouse/raw-file/tip/README.txt
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.

A C library and C# port for multi mice using RawInput:
http://jstookey.com/arcade/rawmouse/

Offline madscijr

  • Seasoned Forum Regular
  • Posts: 295
Re: reading multiple mice input revisited / external library question
« Reply #1 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
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
  • manymouse.c
  • manymouse.h
  • windows_wminput.c
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?

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
Re: reading multiple mice input revisited / external library question
« Reply #2 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
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

Programming isn't difficult, only it's  consuming time and coffee

Offline madscijr

  • Seasoned Forum Regular
  • Posts: 295
Re: reading multiple mice input revisited / external library question
« Reply #3 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

Thanks again. If and when I get this stuff working I'll share it on here...
« Last Edit: March 26, 2021, 02:27:26 pm by madscijr »

Offline madscijr

  • Seasoned Forum Regular
  • Posts: 295
Re: reading multiple mice input revisited / external library question
« Reply #4 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