how to use touchpad as mouse?

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
randy0428
Citizen
Posts: 51
Joined: Sun Jul 31, 2016 10:19 am

how to use touchpad as mouse?

Post 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.
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: how to use touchpad as mouse?

Post 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.
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
randy0428
Citizen
Posts: 51
Joined: Sun Jul 31, 2016 10:19 am

Re: how to use touchpad as mouse?

Post 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
randy0428
Citizen
Posts: 51
Joined: Sun Jul 31, 2016 10:19 am

Re: how to use touchpad as mouse?

Post 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.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: how to use touchpad as mouse?

Post 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.
randy0428
Citizen
Posts: 51
Joined: Sun Jul 31, 2016 10:19 am

Re: how to use touchpad as mouse?

Post 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.
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: how to use touchpad as mouse?

Post by Nixola »

Could you upload a .love file then?
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
randy0428
Citizen
Posts: 51
Joined: Sun Jul 31, 2016 10:19 am

Re: how to use touchpad as mouse?

Post 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.
User avatar
Sulunia
Party member
Posts: 203
Joined: Tue Mar 22, 2016 1:10 pm
Location: SRS, Brazil

Re: how to use touchpad as mouse?

Post by Sulunia »

Don't worry! I think all of us did at some point go through such frustrating situations :D
Don't check my github! It contains thousands of lines of spaghetti code in many different languages cool software! :neko:
https://github.com/Sulunia
User avatar
Jasoco
Inner party member
Posts: 3727
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: how to use touchpad as mouse?

Post 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.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 10 guests