Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added term windows and multiscreen support to keyboard lib #1539

Merged
merged 1 commit into from Dec 24, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 10 additions & 7 deletions src/main/resources/assets/opencomputers/loot/OpenOS/bin/dmesg.lua
@@ -1,13 +1,16 @@
local event = require "event"
local component = require "component"
local term = require "term"
local keyboard = require "keyboard"

local args = {...}

local interactive = io.output() == io.stdout
local function gpu()
return select(2, term.getGPU())
end
local color, isPal, evt
if interactive then
color, isPal = component.gpu.getForeground()
color, isPal = gpu().getForeground()
end
io.write("Press 'Ctrl-C' to exit\n")
pcall(function()
Expand All @@ -17,13 +20,13 @@ pcall(function()
else
evt = table.pack(event.pull())
end
if interactive then component.gpu.setForeground(0xCC2200) end
if interactive then gpu().setForeground(0xCC2200) end
io.write("[" .. os.date("%T") .. "] ")
if interactive then component.gpu.setForeground(0x44CC00) end
if interactive then gpu().setForeground(0x44CC00) end
io.write(tostring(evt[1]) .. string.rep(" ", math.max(10 - #tostring(evt[1]), 0) + 1))
if interactive then component.gpu.setForeground(0xB0B00F) end
if interactive then gpu().setForeground(0xB0B00F) end
io.write(tostring(evt[2]) .. string.rep(" ", 37 - #tostring(evt[2])))
if interactive then component.gpu.setForeground(0xFFFFFF) end
if interactive then gpu().setForeground(0xFFFFFF) end
if evt.n > 2 then
for i = 3, evt.n do
io.write(" " .. tostring(evt[i]))
Expand All @@ -34,6 +37,6 @@ pcall(function()
until evt[1] == "interrupted"
end)
if interactive then
component.gpu.setForeground(color, isPal)
gpu().setForeground(color, isPal)
end