ManyMouse

Previous topic - Next topic

MrTAToad

ManyMouse is a system for allowing more than one mouse attached to a computer to be read.  Each mouse (movement or button press/release) generates an event, which is then read.

At the moment its Windows only, but once I've worked out how to get the Linux and Mac make file to generate a .so file, they can be used too.

As the C source doesn't like being compiled directly, I had to create a DLL - as MSVCR90 is included, this may cause problems for XP users - and thus I may be changing the DLL to use an earlier Visual Studio compiler.

The test code is :

Code (glbasic) Select

DEBUG "ManyMouse_Init : "+MMouse_Init()+"\n"
DEBUG "ManyMouse_DeviceName : "+MMouse_DeviceName$(0)+"\n"
DEBUG "ManyMouse_DeviceName : "+MMouse_DeviceName$(1)+"\n"

SETSCREEN 640,480,0

LOCAL result% = 0 // Result of polling - > 0 if something happened
LOCAL mType% = 0 // Type of polling
LOCAL device% = 0 // Device number
LOCAL item% = 0 // Which item on device
LOCAL minVal% = 0
LOCAL maxVal% = 0 // Not really used
LOCAL value% = 0 // Value of item on device

WHILE TRUE
result%=MMouse_PollEvent(mType%,device%,item%,value%,minVal%,maxVal%)
PRINT "Poll result : "+result%,0,0
PRINT "Device      : "+device%,0,10
PRINT "Item        : "+item%,0,20
PRINT "Value       : "+value%,0,30

SHOWSCREEN
WEND
END


ManyMouse interface code :

Code (glbasic) Select
// --------------------------------- //
// Project: ManyMouse
// Start: Tuesday, December 30, 2008
// IDE Version: 6.111


FUNCTION _foo:
ENDFUNCTION

INLINE
}

typedef enum
{
    MANYMOUSE_EVENT_ABSMOTION = 0,
    MANYMOUSE_EVENT_RELMOTION,
    MANYMOUSE_EVENT_BUTTON,
    MANYMOUSE_EVENT_SCROLL,
    MANYMOUSE_EVENT_DISCONNECT,
    MANYMOUSE_EVENT_MAX
} ManyMouseEventType;

typedef struct
{
    ManyMouseEventType type;
    unsigned int device;
    unsigned int item;
    int value;
    int minval;
    int maxval;
} ManyMouseEvent;

#ifdef WIN32
DECLARE_C(ManyMouse_Init,"ManyMouse.dll",(void),int);
DECLARE_C(ManyMouse_Quit,"ManyMouse.dll",(void),void);
DECLARE_C(ManyMouse_DeviceName,"ManyMouse.dll",(unsigned int),char *);
DECLARE_C(ManyMouse_PollEvent,"ManyMouse.dll",(ManyMouseEvent *event),int);
#endif

namespace __GLBASIC__ {
ENDINLINE

FUNCTION MMouse_Init%:
INLINE
return ManyMouse_Init();
ENDINLINE
ENDFUNCTION

FUNCTION MMouse_Quit:
INLINE
ManyMouse_Quit();
ENDINLINE
ENDFUNCTION

FUNCTION MMouse_DeviceName$:index%
INLINE
return ManyMouse_DeviceName(index);
ENDINLINE
ENDFUNCTION

FUNCTION MMouse_PollEvent%:BYREF mType%,BYREF device%,BYREF item%,BYREF value%,BYREF minVal%,BYREF maxVal%
INLINE
ManyMouseEvent event;
int result;

result=ManyMouse_PollEvent(&event);
mType=(int) event.type;
device=event.device;
item=event.item;
value=event.value;
minVal=event.minval;
maxVal=event.maxval;

return result;
ENDINLINE
ENDFUNCTION


And the needed  Win32 DLL is availiable at :

www.nicholaskingsley.co.uk/linked/ManyMouse.dll

Kitty Hello

excellent! I wanted to do that for the iPhone support, too. But it seems we won't get the compilers running :(

Schranz0r

thats f**king awesome!
Nice work MrTAToad!
I <3 DGArray's :D

PC:
AMD Ryzen 7 3800X 16@4.5GHz, 16GB Corsair Vengeance LPX DDR4-3200 RAM, ASUS Dual GeForce RTX™ 3060 OC Edition 12GB GDDR6, Windows 11 Pro 64Bit, MSi Tomahawk B350 Mainboard

MrTAToad

Mac Universal is being a pain - whilst the dylib appears to be being compiled for Universal, the PPC compiler part isn't liking it for some reason.

Which means it either Universal or the SDK library I'm compiling against is too new (10.4u)

The Windows version does need to be compiled against an older set of MS stuff - that will have to be done later on...

QuoteBut it seems we won't get the compilers running
Thats a shame!

MrTAToad

Was anyone able to compile a compatible Intel + PowerPC dylib ?

jaywat

Apologies for the necroposting!

This looks like exactly what I need in order to test some multitouch routines during dev on Windows. Unfortunately the link to 'manymouse.dll' is dead, and I couldn't find it on MrTAToad's site miscthings.co.uk.

Assuming this would still work for the current version of GLBasic, is it possible to get my hands on the DLL? pretty please?

WPShadow

I cannot download it too...  :'(
AMD X2 4600, 2 GB Ram, ATI X1950 XTX, XP PRO SP2: GLB Premium 10.beta_dingsi, <(´.´<) Kirby Dance (>`.`)>
http://lostrevenant.blogspot.com
alea iacta est

MrTAToad

#7
Just found the DLL!

[attachment deleted by admin]