forked from izaya/LuPPC
add basic support for real arrow key thingos
This commit is contained in:
parent
524411062e
commit
8260c8f59f
@ -97,10 +97,27 @@ local asciitr = {
|
|||||||
[127] = 8,
|
[127] = 8,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local escmap = {
|
||||||
|
A = 200, -- up
|
||||||
|
B = 208, -- down
|
||||||
|
C = 205, -- right
|
||||||
|
D = 203, -- left
|
||||||
|
}
|
||||||
|
|
||||||
|
local inesc = 0
|
||||||
function computer.signalTransformers.key_down(s, a, ascii, key, user)
|
function computer.signalTransformers.key_down(s, a, ascii, key, user)
|
||||||
if key ~= -1 then
|
if key ~= -1 then
|
||||||
return s, a, ascii, key, user
|
return s, a, ascii, key, user
|
||||||
end
|
end
|
||||||
|
if ascii == 27 then
|
||||||
|
inesc = true
|
||||||
|
elseif inesc then
|
||||||
|
if ascii < 48 and ascii > 57 and ascii ~= 59 then
|
||||||
|
inesc = false
|
||||||
|
key = escmap[ascii] or 0
|
||||||
|
ascii = 0
|
||||||
|
end
|
||||||
|
end
|
||||||
return s, a, math.floor(asciitr[ascii] or ascii), keymap[ascii] or key, user
|
return s, a, math.floor(asciitr[ascii] or ascii), keymap[ascii] or key, user
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user