818 posts
Location
Wherever you want me to be
Posted 03 July 2015 - 12:52 PM
i want to make a function so i can add it into a program to make anything clickable, possibly using coroutines.
i tried coroutines one time, but i never got the hang of it. maybe someone who knows it can help?
so i would do something like
function clickable(text,funct)
--function
end
function funct1()
--random things here
end
function funct2()
--random things here
end
clickable("text1",funct1())
clickable("text2",funct2())
and that would do stuff .-.
2427 posts
Location
UK
Posted 03 July 2015 - 01:41 PM
look at someones buttion API and either uses their's or use it to teach you how to make your own
Lyqyds
touhpoint is a popular one.
Edited on 03 July 2015 - 11:42 AM
1847 posts
Location
/home/dannysmc95
Posted 03 July 2015 - 02:13 PM
135 posts
Posted 20 July 2015 - 07:01 PM
i like doing a button table system like so,
local buttons = {
{name="Button Name",w=<width>,h=<height>,click = function()
-- when button is clicked this code will run --
os.reboot()
end}
}
function update()
a = {os.pullEvent()}
if(a[1] == "mouse_click")then
for i = 1, #buttons do
-- insert updating code here --
end
end
end
function draw()
for i = 1, #buttons do
-- insert drawing code here --
end
end
function dabigloop()
draw()
while true do
update()
--]] dont put draw here because it will cause flickering instead handle screen refresh in the update method [[--
end
end
Edited on 20 July 2015 - 05:03 PM
1583 posts
Location
Germany
Posted 20 July 2015 - 11:28 PM
Nah don't use API's :P/> Make your own :P/> Check out my link to making touch screen buttons:
http://www.computerc...-on-a-terminal/
There is no need for making a "low level" (actually not that low level) API/script if others made it for you already. You don't have to reinvent the wheel.
1847 posts
Location
/home/dannysmc95
Posted 20 July 2015 - 11:45 PM
Nah don't use API's :P/> Make your own :P/> Check out my link to making touch screen buttons:
http://www.computerc...-on-a-terminal/
There is no need for making a "low level" (actually not that low level) API/script if others made it for you already. You don't have to reinvent the wheel.
No there may not, but I have never been keen on using others API's and you are best learning it from step 1, instead of using APIs, thus giving you a better understanding of what is going on. otherwise you may not know how it all works.