36 posts
Posted 24 August 2015 - 03:59 PM
I was just wondering if it would be possible to use Lyqyds touchpoint API for buttons in computer itself?
If not:
What exactly do I need for buttons in the Computer itself? means as startup. I click on the pc and controll it with clicking where I want?
Is it just adding buttons and Event: mouse_click?
thanks for your help :)/>
3057 posts
Location
United States of America
Posted 24 August 2015 - 04:26 PM
As stated in the
touchpoint thread,
--# create a new instance of buttons on the top monitor (assumes API loaded as "touchpoint").
--# you can also not specify a side, and the touchpoint instance will use the current terminal and watch for mouse_click events (ComputerCraft 1.6+ only).
t = touchpoint.new("top")
36 posts
Posted 24 August 2015 - 11:01 PM
As stated in the
touchpoint thread,
--# create a new instance of buttons on the top monitor (assumes API loaded as "touchpoint").
--# you can also not specify a side, and the touchpoint instance will use the current terminal and watch for mouse_click events (ComputerCraft 1.6+ only).
t = touchpoint.new("top")
So what should the code look like?
like this?
os.loadAPI("touchpoint")
local t = touchpoint.new() --- like this?
t:add("Button1", nil, 2, 2, 15, 4, colors.red, colors.lime)
t:draw()
while true do
local event, button = t:handleEvents(os.pullEvent())
if event == "mouse_click" then
if button == "Buttton1" the
rs.setOutput("right", true")
end
end
end
because.. like this it draws the button on the computerscreen but it doens exactly nothing if I click on it
3057 posts
Location
United States of America
Posted 24 August 2015 - 11:04 PM
No, because the event is still "button_click". The API will internally wait for mouse_click events, instead of monitor_touch events on the specified monitor (because there isn't one).
Other than that minor detail, it should work perfectly.
Spoiler
os.loadAPI("touchpoint")
local t = touchpoint.new() --- like this?
t:add("Button1", nil, 2, 2, 15, 4, colors.red, colors.lime)
t:draw()
while true do
local event, button = t:handleEvents(os.pullEvent())
if event == "button_click" then
if button == "Buttton1" the
rs.setOutput("right", true")
end
end
end
36 posts
Posted 24 August 2015 - 11:16 PM
No, because the event is still "button_click". The API will internally wait for mouse_click events, instead of monitor_touch events on the specified monitor (because there isn't one).
Other than that minor detail, it should work perfectly.
Spoiler
os.loadAPI("touchpoint")
local t = touchpoint.new() --- like this?
t:add("Button1", nil, 2, 2, 15, 4, colors.red, colors.lime)
t:draw()
while true do
local event, button = t:handleEvents(os.pullEvent())
if event == "button_click" then
if button == "Buttton1" the
rs.setOutput("right", true")
end
end
end
ah! works perfectly now! :)/> thanks mate! :)/>