Page 1 of 1

how to use touchpad as mouse?

Posted: Sun Jul 31, 2016 10:40 am
by randy0428
I am pretty new to Löve. I use a couple of different laptops and I DON’T connect a mouse. I exclusively use the touchpad. Do I need to do something special when programming so that the program recognizes the touchpad as the “mouse”?

I’ve copied and run the code from https://gist.github.com/BlackBulletIV/1196228. This code is basically a tutorial on how to drag using a mouse. When I run it, as expected it creates a window with a 100x100 white box in it. The white box is supposed to be draggable, but nothing happens when I try to drag it.

The code seems to be correct, so I suspect the problem is related to my not using a real mouse, but I don’t know. What should I do?

Thanks in advance.

Re: how to use touchpad as mouse?

Posted: Sun Jul 31, 2016 10:44 am
by Nixola
That code is out of date. The buttons are numeric constants now, not strings; instead of "l" (letter in a string) you'll have to use 1 (number) in mousepressed, mousereleased and lm.isDown.

Re: how to use touchpad as mouse?

Posted: Sun Jul 31, 2016 12:31 pm
by randy0428
Thanks.

I changed the "l" to a "1" in the mousepressed and mousereleased lines but I didn't see lm.isDown anywhere. I still get the same result when I run it. The window opens with the box in it but I can't drag the box.

I use ZeroBrane Studio to do the programming and when I run it I get an error message in the bottom panel of ZeroBrane:
connect(2) call to /dev/shm/jack-1000/default/jack_0 failed (err=No such file or directory)
attempt to connect to server failed

Re: how to use touchpad as mouse?

Posted: Sun Jul 31, 2016 12:50 pm
by randy0428
I usually use Linux. I just tried this same program in Windows with the same result except I didn't get the error message.

Re: how to use touchpad as mouse?

Posted: Sun Jul 31, 2016 1:16 pm
by bartbes
randy0428 wrote: I changed the "l" to a "1" in the mousepressed and mousereleased lines
You need to change it to a 1, not in quotes.
randy0428 wrote: connect(2) call to /dev/shm/jack-1000/default/jack_0 failed (err=No such file or directory)
attempt to connect to server failed
That will happen if you have the JACK client libraries installed, you are not running JACK and OpenAL Soft is configured to check for JACK before PulseAudio/ALSA/whatever you're using (which is the default setting). But it's perfectly harmless.

And please don't double-post, just edit your previous post instead.

Re: how to use touchpad as mouse?

Posted: Sun Jul 31, 2016 4:38 pm
by randy0428
The number 1 is not in quotes. It still doesn't drag.

I'll avoid the double posting in the future. I didn't think I could edit the posts. Now I know.

Re: how to use touchpad as mouse?

Posted: Sun Jul 31, 2016 4:59 pm
by Nixola
Could you upload a .love file then?

Re: how to use touchpad as mouse?

Posted: Sun Jul 31, 2016 7:41 pm
by randy0428
I feel like a complete idiot. You told me that there were no quotation marks around the 1 for the mouse button. When I changed the l to 1, I just changed that without thinking that the l is a string and needs to be enclosed in quotes. I didn't think to remove the quotes, so they were still there. I've now corrected that and I can drag the box.

I apologize for wasting your time by not checking this sooner.

Thanks for your help.

Re: how to use touchpad as mouse?

Posted: Mon Aug 01, 2016 4:43 pm
by Sulunia
Don't worry! I think all of us did at some point go through such frustrating situations :D

Re: how to use touchpad as mouse?

Posted: Mon Aug 01, 2016 6:00 pm
by Jasoco
To be fair, Löve has changed this a few times. It used to be "l" and "r". And the wheel up and down used to be part of the mouse pressed and released callbacks.