v1.10.0 - Improved the component library to add things like component.gpu.

This commit is contained in:
TheWahlolly
2025-06-15 18:30:48 +03:00
parent e4cf929fce
commit 9b4c76b71d
10 changed files with 50 additions and 40 deletions
+33 -32
View File
@@ -1,7 +1,7 @@
local loadfile = ...
local filesystem = loadfile("/halyde/lib/filesystem.lua")(loadfile)
_G._OSVERSION = "Halyde 1.9.0"
_G._OSVERSION = "Halyde 1.10.0"
_G._OSLOGO = ""
local handle, tmpdata = filesystem.open("/halyde/config/oslogo.ans", "r"), nil
repeat
@@ -9,37 +9,6 @@ repeat
_OSLOGO = _OSLOGO .. (tmpdata or "")
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"] = {}}
loadfile("/halyde/core/datatools.lua")()
@@ -81,6 +50,38 @@ end
preload("component")
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"))
--assert(handle:write("Bazinga!"))
--handle:close()