v1.10.0 - Improved the component library to add things like component.gpu.
This commit is contained in:
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
local agcfg = {
|
local agcfg = {
|
||||||
["halyde"] = {
|
["halyde"] = {
|
||||||
["maindir"] = "",
|
["maindir"] = "",
|
||||||
["version"] = "1.9.0",
|
["version"] = "1.10.0",
|
||||||
["description"] = "A universal, customizable and feature-packed operating system for OpenComputers.",
|
["description"] = "A universal, customizable and feature-packed operating system for OpenComputers.",
|
||||||
["directories"] = {
|
["directories"] = {
|
||||||
"halyde/apps",
|
"halyde/apps",
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Ahalyde/core/
|
|||||||
Ahalyde/config/generate/
|
Ahalyde/config/generate/
|
||||||
Ahalyde/apps/helpdb/
|
Ahalyde/apps/helpdb/
|
||||||
Ahalyde/apps/
|
Ahalyde/apps/
|
||||||
V1.9.0
|
V1.10.0
|
||||||
Ainit.lua
|
Ainit.lua
|
||||||
Ahalyde/apps/helpdb/cat.txt
|
Ahalyde/apps/helpdb/cat.txt
|
||||||
Ahalyde/apps/helpdb/cd.txt
|
Ahalyde/apps/helpdb/cd.txt
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ if not component.list("internet")() then
|
|||||||
print("\27[91mThis program requires an internet card to run.")
|
print("\27[91mThis program requires an internet card to run.")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local internet = component.proxy(component.list("internet")())
|
local internet = component.internet
|
||||||
local source
|
local source
|
||||||
if table.find(packages, "-s") then
|
if table.find(packages, "-s") then
|
||||||
source = table.remove(packages, table.find(packages, "-s") + 1)
|
source = table.remove(packages, table.find(packages, "-s") + 1)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ local file = ...
|
|||||||
local fs = import("filesystem")
|
local fs = import("filesystem")
|
||||||
local event = import("event")
|
local event = import("event")
|
||||||
local component = import("component")
|
local component = import("component")
|
||||||
local gpu = component.proxy(component.list("gpu")())
|
local gpu = component.gpu
|
||||||
local width, height = gpu.getResolution()
|
local width, height = gpu.getResolution()
|
||||||
local scrollPosX, scrollPosY = 1, 1
|
local scrollPosX, scrollPosY = 1, 1
|
||||||
local cursorPosX, cursorPosY = 1, 1
|
local cursorPosX, cursorPosY = 1, 1
|
||||||
|
|||||||
+33
-32
@@ -1,7 +1,7 @@
|
|||||||
local loadfile = ...
|
local loadfile = ...
|
||||||
local filesystem = loadfile("/halyde/lib/filesystem.lua")(loadfile)
|
local filesystem = loadfile("/halyde/lib/filesystem.lua")(loadfile)
|
||||||
|
|
||||||
_G._OSVERSION = "Halyde 1.9.0"
|
_G._OSVERSION = "Halyde 1.10.0"
|
||||||
_G._OSLOGO = ""
|
_G._OSLOGO = ""
|
||||||
local handle, tmpdata = filesystem.open("/halyde/config/oslogo.ans", "r"), nil
|
local handle, tmpdata = filesystem.open("/halyde/config/oslogo.ans", "r"), nil
|
||||||
repeat
|
repeat
|
||||||
@@ -9,37 +9,6 @@ repeat
|
|||||||
_OSLOGO = _OSLOGO .. (tmpdata or "")
|
_OSLOGO = _OSLOGO .. (tmpdata or "")
|
||||||
until not tmpdata
|
until not tmpdata
|
||||||
|
|
||||||
local gpu = component.proxy(component.list("gpu")())
|
|
||||||
local screenAddress = component.list("screen")()
|
|
||||||
--local screen = component.proxy(screenAddress)
|
|
||||||
|
|
||||||
gpu.bind(screenAddress)
|
|
||||||
--local maxWidth, maxHeight = gpu.maxResolution()
|
|
||||||
--local aspectX, aspectY = screen.getAspectRatio()
|
|
||||||
--local screenRatio = aspectX * 2 / aspectY
|
|
||||||
|
|
||||||
-- Calculate potential dimensions
|
|
||||||
--local widthLimited = math.floor(maxHeight * screenRatio)
|
|
||||||
--local heightLimited = math.floor(maxWidth / screenRatio)
|
|
||||||
|
|
||||||
--local targetWidth, targetHeight
|
|
||||||
|
|
||||||
--if widthLimited <= maxWidth then
|
|
||||||
-- height is the limiting factor
|
|
||||||
-- targetWidth = widthLimited
|
|
||||||
-- targetHeight = maxHeight
|
|
||||||
--else
|
|
||||||
-- width is the limiting factor
|
|
||||||
-- targetWidth = maxWidth
|
|
||||||
-- targetHeight = heightLimited
|
|
||||||
--end
|
|
||||||
|
|
||||||
--targetWidth = math.min(targetWidth, maxWidth)
|
|
||||||
--targetHeight = math.min(targetHeight, maxHeight)
|
|
||||||
|
|
||||||
--gpu.setResolution(targetWidth, targetHeight)
|
|
||||||
gpu.setResolution(gpu.maxResolution())
|
|
||||||
|
|
||||||
_G.package = {["preloaded"] = {}}
|
_G.package = {["preloaded"] = {}}
|
||||||
|
|
||||||
loadfile("/halyde/core/datatools.lua")()
|
loadfile("/halyde/core/datatools.lua")()
|
||||||
@@ -81,6 +50,38 @@ end
|
|||||||
preload("component")
|
preload("component")
|
||||||
preload("computer")
|
preload("computer")
|
||||||
|
|
||||||
|
local component = import("component")
|
||||||
|
local gpu = component.gpu
|
||||||
|
local screenAddress = component.list("screen")()
|
||||||
|
--local screen = component.screen
|
||||||
|
|
||||||
|
gpu.bind(screenAddress)
|
||||||
|
--local maxWidth, maxHeight = gpu.maxResolution()
|
||||||
|
--local aspectX, aspectY = screen.getAspectRatio()
|
||||||
|
--local screenRatio = aspectX * 2 / aspectY
|
||||||
|
|
||||||
|
-- Calculate potential dimensions
|
||||||
|
--local widthLimited = math.floor(maxHeight * screenRatio)
|
||||||
|
--local heightLimited = math.floor(maxWidth / screenRatio)
|
||||||
|
|
||||||
|
--local targetWidth, targetHeight
|
||||||
|
|
||||||
|
--if widthLimited <= maxWidth then
|
||||||
|
-- height is the limiting factor
|
||||||
|
-- targetWidth = widthLimited
|
||||||
|
-- targetHeight = maxHeight
|
||||||
|
--else
|
||||||
|
-- width is the limiting factor
|
||||||
|
-- targetWidth = maxWidth
|
||||||
|
-- targetHeight = heightLimited
|
||||||
|
--end
|
||||||
|
|
||||||
|
--targetWidth = math.min(targetWidth, maxWidth)
|
||||||
|
--targetHeight = math.min(targetHeight, maxHeight)
|
||||||
|
|
||||||
|
--gpu.setResolution(targetWidth, targetHeight)
|
||||||
|
gpu.setResolution(gpu.maxResolution())
|
||||||
|
|
||||||
--local handle = assert(filesystem.open("/bazinga.txt", "w"))
|
--local handle = assert(filesystem.open("/bazinga.txt", "w"))
|
||||||
--assert(handle:write("Bazinga!"))
|
--assert(handle:write("Bazinga!"))
|
||||||
--handle:close()
|
--handle:close()
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ _G.cormgr.labelList = {}
|
|||||||
local component = import("component")
|
local component = import("component")
|
||||||
local filesystem = import("filesystem")
|
local filesystem = import("filesystem")
|
||||||
local json = import("json")
|
local json = import("json")
|
||||||
local gpu = component.proxy(component.list("gpu")())
|
local gpu = component.gpu
|
||||||
|
|
||||||
function _G.cormgr.loadCoroutine(path,...)
|
function _G.cormgr.loadCoroutine(path,...)
|
||||||
local args = {...}
|
local args = {...}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ local shellcfg = json.decode(data)
|
|||||||
import("/halyde/core/termlib.lua")
|
import("/halyde/core/termlib.lua")
|
||||||
local event = import("event")
|
local event = import("event")
|
||||||
local component = import("component")
|
local component = import("component")
|
||||||
local gpu = component.proxy(component.list("gpu")())
|
local gpu = component.gpu
|
||||||
|
|
||||||
_G.shell = {}
|
_G.shell = {}
|
||||||
_G.shell.workingDirectory = shellcfg["defaultWorkingDirectory"]
|
_G.shell.workingDirectory = shellcfg["defaultWorkingDirectory"]
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ local event = import("event")
|
|||||||
--local ocelot = component.proxy(component.list("ocelot")())
|
--local ocelot = component.proxy(component.list("ocelot")())
|
||||||
local component = import("component")
|
local component = import("component")
|
||||||
local computer = import("computer")
|
local computer = import("computer")
|
||||||
local gpu = component.proxy(component.list("gpu")()) -- replace with component.gpu once implemented
|
local gpu = component.gpu
|
||||||
_G.termlib = {}
|
_G.termlib = {}
|
||||||
termlib.cursorPosX = 1
|
termlib.cursorPosX = 1
|
||||||
termlib.cursorPosY = 1
|
termlib.cursorPosY = 1
|
||||||
|
|||||||
@@ -84,4 +84,13 @@ function compLib.get(address)
|
|||||||
return nil, "full address not found"
|
return nil, "full address not found"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Add main component proxies to the library
|
||||||
|
setmetatable(compLib, {["__index"] = function(_, item)
|
||||||
|
if compLib.list(item)() then
|
||||||
|
return compLib.proxy(compLib.list(item)())
|
||||||
|
else
|
||||||
|
return compLib[item]
|
||||||
|
end
|
||||||
|
end})
|
||||||
|
|
||||||
return compLib
|
return compLib
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ local raster = {
|
|||||||
|
|
||||||
local component = import("component")
|
local component = import("component")
|
||||||
-- local ocelot = component.proxy(component.list("ocelot")())
|
-- local ocelot = component.proxy(component.list("ocelot")())
|
||||||
local gpu = component.proxy(component.list("gpu")())
|
local gpu = component.gpu
|
||||||
|
|
||||||
local display = {}
|
local display = {}
|
||||||
local chunksAffected = {}
|
local chunksAffected = {}
|
||||||
|
|||||||
Reference in New Issue
Block a user