Touch Buttons
#1
Posted 07 June 2013 - 11:19 PM
#2
Posted 08 June 2013 - 01:05 AM
while true do
repeat --This wait's for you to touch the screen.
event, x, y = os.pullEvent()
until event == 'touch_screen'
if x == 1 and y == 1 then --This is the actual button... the screen is like a graph, though 1,1 is the top left part of the screen and there is no negetives..
--Do stuff
end
end
#3
Posted 08 June 2013 - 05:03 AM
#4
Posted 08 June 2013 - 06:30 AM
while true do
local event, side, x, y = os.pullEvent("monitor_touch")
--Button handling
end
#5
Posted 08 June 2013 - 08:13 PM
Spongy141, on 08 June 2013 - 01:05 AM, said:
while true do repeat --This waits for you to touch the screen. event, x, y = os.pullEvent() until event == 'touch_screen' if x == 1 and y == 1 then --This is the actual button... the screen is like a graph, though 1,1 is the top left part of the screen and there is no negetives.. --Do stuff end end
Whoa ho ho... Calm down bud. If you're not willing to help him the correct way, don't post anything. Someone with valid help will come along eventually. I see too much of that in this forum and it's quite sad.
To the original poster: http://pastebin.com/7f8y6GCZ
Take a look at that, I explain pretty much everything with --comments
I suggest learning how to use functions (If you don't already know how) and then you can use edit that code to do what you want. Hope it helps some.
#6
Posted 08 June 2013 - 08:30 PM
Engineer, on 08 June 2013 - 06:30 AM, said:
while true do
local event, side, x, y = os.pullEvent("monitor_touch")
--Button handling
end
#7
Posted 08 June 2013 - 09:16 PM
Spongy141, on 08 June 2013 - 08:30 PM, said:
No, touch_screen doesnt exist. Get your facts right, because 'touch_screen' doesnt work..
#8
Posted 08 June 2013 - 09:30 PM
Spongy141, on 08 June 2013 - 08:30 PM, said:
#9
Posted 09 June 2013 - 12:04 AM
theoriginalbit, on 08 June 2013 - 09:30 PM, said:
Spongy141, on 08 June 2013 - 08:30 PM, said:
Engineer, on 08 June 2013 - 09:16 PM, said:
Spongy141, on 08 June 2013 - 08:30 PM, said:
No, touch_screen doesnt exist. Get your facts right, because 'touch_screen' doesnt work..
#10
Posted 09 June 2013 - 01:00 AM
Spongy141, on 09 June 2013 - 12:04 AM, said:
Spongy141, on 09 June 2013 - 12:04 AM, said:
I want to make this point: Test before you give an answer!
This might be considered rude, but I dont really care about that right now. Because testing should be the #1 thing to do on those forums (in my opinion), but I admit: I do not always test it if Im not certain. But that is not often..
Also, back on topic, if you want to catch both 'monitor_touch' and 'mouse_click',
You should use this:
while true do
local event = {os.pullEvent()} -- You could write out params, I dont do that
if event[1] == "mouse_click" then
-- stuff
elseif event[1] == "monitor_touch" then
-- stuff
end
end
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











