coffee wrote:check Ensayia's one here
Yes , this is the sample that I sad, thanks for the URL.
But I guess that's a bug in it, when I test modify it to rectangular button.
Code: Select all
if x > v.x - v.w/2 and x < v.x + v.w/2 and y > v.y - v.w/2 and y < v.y + v.h/2 then
I think it should be (the "w" --> "h")
Code: Select all
if x > v.x - v.w/2 and x < v.x + v.w/2 and y > v.y - v.h/2 and y < v.y + v.h/2 then
Cos it w=h, so when running it, can't feel different.
And the get-pixel-color algorithm is another topic, about a map button.
A map like USA, every state is a button, click on a state then do something(like weather info something)
and the get-pixel-color algorithm maybe useful in state shape buttons...
(If one color layer, each button's color must have a tiny diff, like button1.blue=201 ,button2.blue=202 ...)
maybe write a tool to do this :
step 1: In tool window , put the buttons in right place (whatever is shapes, images with alpha)
step 2: select background color, reverse , delete every button shape area's pixel-color
step 3: select one button area once, give it a id(button1,2,3...) , fill the area a unique color
step 4: save the color array as a table| image file something .(Include color--id relation table)
step 5: in LOVE , require a .lua with some function load ,in mousepressed(), search ( seek) in this color array , use color--id relation table to findout button's id ...
This color array is not button display layer ,I called it color layer.