|
Post by Admin on Sept 26, 2016 22:24:55 GMT
draw.setscreen(1) draw.settitle('paint') draw.clear() draw.setlinestyle(1, 'butt')
colors = { draw.black, draw.red, draw.green, draw.blue, draw.cyan, draw.magenta, draw.orange, draw.purple, draw.brown, draw.gray, draw.lightgray }
points = {}
draw.touchbegan = function (touches) for i = 1, #touches do id = touches[i].id points[id] = { x=touches[i].x, y=touches[i].y } end end
draw.touchmoved = function (touches) for i = 1, #touches do id = touches[i].id draw.moveto(points[id].x, points[id].y) draw.lineto(touches[i].x, touches[i].y, colors[id]) points[id] = { x=touches[i].x, y=touches[i].y } end end
draw.touchended = function (touches) for i = 1, #touches do id = touches[i].id draw.moveto(points[id].x, points[id].y) draw.lineto(touches[i].x, touches[i].y, colors[id]) end end
while true do draw.doevents() draw.sleep(10) end
|
|
|
Post by leon26leon26 on Sept 27, 2016 4:43:16 GMT
Is it possible to assign a special id for apple pencil events? I don't have one, but It'd be pretty cool.
|
|
|
Post by warspyking on Sept 27, 2016 10:00:30 GMT
I'm gonna be honest, I reay hate this implementation. If I'm reading this right wouldn't it break old code,
A separate touch event should fire for each touch, rather than firing them all at once.
It at LEAST pass a vararg rather than array, so old code functions fine
|
|
|
Post by Admin on Sept 27, 2016 10:18:34 GMT
I'm gonna be honest, I reay hate this implementation. If I'm reading this right wouldn't it break old code, A separate touch event should fire for each touch, rather than firing them all at once. It at LEAST pass a vararg rather than array, so old code functions fine It is easy to update your old code just use touch[1] function touchBegan(touches) draw.moveto(touches[1].x, touches[1].y) end See Paint.lua example for instance...
|
|
|
Post by warspyking on Sept 27, 2016 10:38:53 GMT
Yes, updating your code is simple, but annoying. Especially when a simple change can keep old code intact.
I don't know about you, but going through 10,20, maybe 50 or more pieces of code to update them for this seems to be a lot of work expected on the user.
Why not just use a vararg?
|
|
|
Post by Admin on Sept 27, 2016 10:51:59 GMT
Yes, updating your code is simple, but annoying. Especially when a simple change can keep old code intact. I don't know about you, but going through 10,20, maybe 50 or more pieces of code to update them for this seems to be a lot of work expected on the user. Why not just use a vararg? It is more natural to loop over a table than vararg. It took me just few minutes to change examples on my laptop
|
|
|
Post by warspyking on Sept 27, 2016 12:34:25 GMT
Yes, updating your code is simple, but annoying. Especially when a simple change can keep old code intact. I don't know about you, but going through 10,20, maybe 50 or more pieces of code to update them for this seems to be a lot of work expected on the user. Why not just use a vararg? It is more natural to loop over a table than vararg. It took me just few minutes to change examples on my laptop It is only easy to convert a vararg into an array. I think it's worth it for keeping old scripts functioning.
|
|
|
Post by leon26leon26 on Sept 28, 2016 14:11:21 GMT
It is more natural to loop over a table than vararg. It took me just few minutes to change examples on my laptop It is only easy to convert a vararg into an array. I think it's worth it for keeping old scripts functioning. I'd say keep the original tracktouches functioning for touch 1, for backwards compatibility. Instead of putting just "deprecated" behind tracktouches in the reference, say it's deprecated but still works, but encourage the user to use the new functions.
|
|
|
Post by cosmicfloppydisk on Sept 29, 2016 22:25:35 GMT
Now the implementation does seem a but "off" I really appreciate it and love it so far, maybe a system more like corona sdk would've been nice, but that could just be me being ignorant cause I'm not use to a system like this.
Thank you Mr.developer ☺️
|
|
|
Post by warspyking on Sept 29, 2016 22:43:47 GMT
Now the implementation does seem a but "off" I really appreciate it and love it so far, maybe a system more like corona sdk would've been nice, but that could just be me being ignorant cause I'm not use to a system like this. Thank you Mr.developer ☺️ Yes! Of course it's still a wonderful update. I just don't how I feel about non backwards compatability.
|
|
|
Post by warspyking on Oct 21, 2016 2:15:28 GMT
Has this been documented under News and Announcements yet
|
|