Connect two mouses

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
reno57
Prole
Posts: 17
Joined: Thu Apr 14, 2016 9:46 pm

Connect two mouses

Post by reno57 »

Hello,

Do you think there is way to manage two mouses with love2D (each player has one mouse to play with) ?
User avatar
zorg
Party member
Posts: 3465
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Connect two mouses

Post by zorg »

Yes. According to the SDL wiki, mouse event enums contain the mouse device ID, only löve doesn't utilize it, so one could write their own wrapper functions that handled these via FFI, instead of the ones löve uses in love.mouse.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
slime
Solid Snayke
Posts: 3160
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Connect two mouses

Post by slime »

SDL doesn't support unique events for multiple mice in any of its backends, despite its external API being capable of outputting the information.
User avatar
zorg
Party member
Posts: 3465
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Connect two mouses

Post by zorg »

Well then, after being trolled by the SDL wiki, there's still a way, at least for windows;
WinAPI does support functions that do identify which mouse device sent any movement/button state change information (i used these previously when i was coding in delphi 6) so technically, on windows, one could still use those functions.

Downside is, you'd have to sidestep SDL's mouse event handling completely, and it won't be crossplatform. (unless, you know, all other OSes would have similar faculties you could use, and code those into your game as well)

In short, it's problematic to do.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
reno57
Prole
Posts: 17
Joined: Thu Apr 14, 2016 9:46 pm

Re: Connect two mouses

Post by reno57 »

Thanks guys, for these info. You confirm my analysis that there is no easy way to manage two mouses.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 2 guests