Taken from input.lua
Code: Select all
-- Coded by romero126
GlassEyeInput = {
["KeyList"] = { }
}
table.insert(GlassEyeInput["KeyList"], {Controls.selectMask, "Select", nil})
table.insert(GlassEyeInput["KeyList"], {Controls.startMask, "Start", nil})
table.insert(GlassEyeInput["KeyList"], {Controls.upMask, "Up", nil})
table.insert(GlassEyeInput["KeyList"], {Controls.rightMask, "Right", nil})
table.insert(GlassEyeInput["KeyList"], {Controls.downMask, "Down", nil})
table.insert(GlassEyeInput["KeyList"], {Controls.leftMask, "Left", nil})
table.insert(GlassEyeInput["KeyList"], {Controls.ltriggerMask, "LTrigger", nil})
table.insert(GlassEyeInput["KeyList"], {Controls.rtriggerMask, "RTrigger", nil})
table.insert(GlassEyeInput["KeyList"], {Controls.triangleMask, "Triangle", nil})
table.insert(GlassEyeInput["KeyList"], {Controls.circleMask, "Circle", nil})
table.insert(GlassEyeInput["KeyList"], {Controls.crossMask, "Cross", nil})
table.insert(GlassEyeInput["KeyList"], {Controls.squareMask, "Square", nil})
table.insert(GlassEyeInput["KeyList"], {Controls.homeMask, "Home", nil})
table.insert(GlassEyeInput["KeyList"], {Controls.holdMask, "Hold", nil})
table.insert(GlassEyeInput["KeyList"], {Controls.noteMask, "Note", nil})
function GlassEyeInput:CheckInput(key)
result = nil
for k, v in GlassEyeInput["KeyList"] do
if (key:buttons() & v[1] > 0) then
if (not v[3]) then
v[3] = 1
if (not result) then result = { } end
result[v[2]] = 1
end
else
if (v[3]) then
if (not result) then result = { } end
result[v[2]] = 0
v[3] = nil
end
end
end
return result
end
See:
Code: Select all
-- Coded by romero126
if (GlassEyeInput) then
local check = GlassEyeInput:CheckInput(key)
if (check) then
for k,v in check do
if (k == "Start") and (v == 0) then
print("You lifted your finger on the start key")
end
if (k == "Start") and (v == 1) then
print("You pressed your finger on the start key")
end
end
end
end
Please give props to the rightfull owner in your code.
Comments, questions Concerns? Let me know!