debug: scan all peripherals to find GPU name
This commit is contained in:
@@ -20,7 +20,21 @@ local tris = {
|
|||||||
{ 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0 },
|
{ 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0 },
|
||||||
}
|
}
|
||||||
|
|
||||||
local gpu = peripheral.wrap("tm_gpu_0")
|
print("Scanning peripherals...")
|
||||||
|
for _, name in ipairs(peripheral.getNames()) do
|
||||||
|
print(name .. " = " .. peripheral.getType(name))
|
||||||
|
end
|
||||||
|
|
||||||
|
local gpu
|
||||||
|
for _, name in ipairs(peripheral.getNames()) do
|
||||||
|
local t = peripheral.getType(name)
|
||||||
|
if t and t:find("gpu") then
|
||||||
|
gpu = peripheral.wrap(name)
|
||||||
|
print("Found GPU: " .. name)
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if not gpu then error("No GPU peripheral found.") end
|
||||||
gpu.refreshSize()
|
gpu.refreshSize()
|
||||||
gpu.setSize(64)
|
gpu.setSize(64)
|
||||||
local pw, ph, bx, by, sb = gpu.getSize()
|
local pw, ph, bx, by, sb = gpu.getSize()
|
||||||
|
|||||||
Reference in New Issue
Block a user