refactor parallel code
This commit is contained in:
23
openos/apis/tty.lua
Normal file
23
openos/apis/tty.lua
Normal file
@@ -0,0 +1,23 @@
|
||||
local colors = _G.colors
|
||||
local term = _G.term
|
||||
|
||||
local w, h = term.getSize()
|
||||
|
||||
local cmap = {
|
||||
[ 0xCC2200 ] = colors.red,
|
||||
[ 0x44CC00 ] = colors.lime,
|
||||
[ 0xB0B00F ] = colors.yellow,
|
||||
[ 0xFFFFFF ] = colors.white,
|
||||
}
|
||||
|
||||
return {
|
||||
gpu = function()
|
||||
return {
|
||||
setForeground = function(c) term.setTextColor(cmap[c]) end,
|
||||
}
|
||||
end,
|
||||
getViewport = term.getSize,
|
||||
window = {
|
||||
width = w, height = h,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user