add basic support for real arrow key thingos

This commit is contained in:
ocawesome101 2021-06-04 16:25:09 -04:00
parent 524411062e
commit 8260c8f59f
1 changed files with 17 additions and 0 deletions

View File

@ -97,10 +97,27 @@ local asciitr = {
[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)
if key ~= -1 then
return s, a, ascii, key, user
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
end