v0.10.0 - Added text editor (which took me way too long) and too many other tweaks to name.
This commit is contained in:
+28
-1
@@ -2,6 +2,9 @@ _G.evmgr = {}
|
||||
_G.evmgr.eventQueue = {}
|
||||
local maxEventQueueLength = 10 -- increase if events start getting dropped
|
||||
|
||||
keyboard.ctrlDown = false
|
||||
keyboard.altDown = false
|
||||
|
||||
--local ocelot = component.proxy(component.list("ocelot")())
|
||||
|
||||
while true do
|
||||
@@ -11,6 +14,30 @@ while true do
|
||||
if args and args[1] then
|
||||
--ocelot.log("Sending signal "..args..","..computer.uptime())
|
||||
table.insert(evmgr.eventQueue, args)
|
||||
if keyboard then
|
||||
if args[1] == "key_down" then
|
||||
local keycode = args[4]
|
||||
local key = keyboard.keys[keycode]
|
||||
if key == "lcontrol" then
|
||||
keyboard.ctrlDown = true
|
||||
elseif key == "lmenu" then
|
||||
keyboard.altDown = true
|
||||
elseif key == "c" and keyboard.ctrlDown and keyboard.altDown then
|
||||
if print then
|
||||
print("\n\27[91mCoroutine "..tostring(#cormgr.corList).." killed.")
|
||||
end
|
||||
cormgr.corList[#cormgr.corList] = nil
|
||||
end
|
||||
elseif args[1] == "key_up" then
|
||||
local keycode = args[4]
|
||||
local key = keyboard.keys[keycode]
|
||||
if key == "lcontrol" then
|
||||
keyboard.ctrlDown = false
|
||||
elseif key == "lmenu" then
|
||||
keyboard.altDown = false
|
||||
end
|
||||
end
|
||||
end
|
||||
while #evmgr.eventQueue > maxEventQueueLength do
|
||||
--ocelot.log("Queue length breach, removing first signal")
|
||||
table.remove(evmgr.eventQueue, 1)
|
||||
@@ -19,4 +46,4 @@ while true do
|
||||
until not args or not args[1]
|
||||
--ocelot.log("done")
|
||||
coroutine.yield()
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user