Page 1 of 1
paddy - touchscreen controls
Posted: Sat Sep 02, 2017 11:03 pm
by unixfreak
A small library i created recently to test some basic games on android devices
I will be adding more features to this in the future, but thought this could help someone as it is:
https://github.com/Jigoku/paddy
Basically, it draws a dpad to the screen which you can use to process input on a touchscreen.
At the moment it is just a dpad (it currently lacks a,b,x,y like most standard gamepads have).
Basically you use
paddy.dpad.isDown("left") instead of
love.keyboard.isDown("left") in your
love.update() function.
There's an example file here (dpad only works on touch enabled device).
Re: paddy - touchscreen controls
Posted: Tue Sep 05, 2017 12:33 pm
by BörnedByLOVE
Just put your example file on my mobile, and it looks and feels great!
Also like the keyboard analogy in the paddy.dpad.isDown-stuff.
All in one very readable and not too complex lua file. (I'm just starting with LÖVE.) Nice!
Looking forward to your next steps with paddy.
Re: paddy - touchscreen controls
Posted: Sun Sep 24, 2017 10:09 am
by Darlex
Amazing! Feels great, Works great and Looks great. Thanks to help me to my game developing!
Re: paddy - touchscreen controls
Posted: Thu Sep 28, 2017 3:29 pm
by D0NM
For those who want to add missing A and B keys,
just alter 1 line of code:
Code: Select all
paddy.dpad.canvas = love.graphics.newCanvas(paddy.dpad.w + 400 ,paddy.dpad.h)
It makes the d-pad canvas wider. You need it to see your new A&B buttons.
And add 2 items into paddy.dpad.buttons table:
Code: Select all
{ name="a", x=paddy.buttonw*3, y=paddy.buttonh },
{ name="b", x=paddy.buttonw*4, y=paddy.buttonh },
If you want to see the buttons aliases on the screen, then add this line
Code: Select all
love.graphics.print(button.name, button.x+paddy.dpad.padding, button.y+paddy.dpad.padding )
before END of the 1st for loop.
-----
This is a nice and tidy lib. But there is another approach - to add touch controls to a popular input lib
as tactile.lua or so on/
Re: paddy - touchscreen controls
Posted: Wed Oct 18, 2017 6:58 am
by unixfreak
Hey, thanks for suggesting that D0NM. I recently changed things a bit, not the best code. But it now supports two kinds of "widgets". One for the dpad, and one for a playstation/snes style button pad.
I also decided to change the paddy.dpad.isDown("left") to simply paddy.isDown("left"), so that this is shared for all buttons, eg;
paddy.isDown("a"). I might change it back yet when i can rewrite some parts of it.