mirror of
https://github.com/IgorTimofeev/MineOS.git
synced 2026-03-26 17:52:47 +01:00
aefaf
This commit is contained in:
@@ -14,24 +14,24 @@ local window = {}
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
local function loadModule(moduleID)
|
||||
if fs.exists(window.modules[moduleID].path) then
|
||||
local success, reason = dofile(window.modules[moduleID].path)
|
||||
if success then
|
||||
window.modules[moduleID].module = success
|
||||
window.modules[moduleID].module.execute(window)
|
||||
else
|
||||
error("Error due module execution: " .. reason)
|
||||
end
|
||||
else
|
||||
error("Mudule file \"" .. window.modules[moduleID].path "\" doesn't exists")
|
||||
end
|
||||
end
|
||||
|
||||
local function createWindow()
|
||||
window = windows.empty("auto", "auto", math.floor(buffer.screen.width * 0.8), math.floor(buffer.screen.height * 0.7), 78, 24)
|
||||
window:addPanel(1, 1, window.width, window.height, 0xEEEEEE).disabled = true
|
||||
window.tabBar = window:addTabBar(1, 1, window.width, 3, 1, 0xDDDDDD, 0x262626, 0xCCCCCC, 0x262626, "Интерпретатор Lua", "События", "Память", "Диски", "BIOS")
|
||||
|
||||
window.resourcesPath = MineOSCore.getCurrentApplicationResourcesDirectory()
|
||||
window.modules = {}
|
||||
local moduleNames = {}
|
||||
for file in fs.list(window.resourcesPath .. "Modules/") do
|
||||
local module, reason = dofile(window.resourcesPath .. "Modules/" .. file)
|
||||
if module then
|
||||
table.insert(window.modules, module)
|
||||
table.insert(moduleNames, module.name)
|
||||
else
|
||||
error("Error due module execution: " .. reason)
|
||||
end
|
||||
end
|
||||
|
||||
window.tabBar = window:addTabBar(1, 1, window.width, 3, 1, 0xDDDDDD, 0x262626, 0xCCCCCC, 0x262626, table.unpack(moduleNames))
|
||||
window.tabBar.onTabSwitched = function(object, eventData)
|
||||
|
||||
end
|
||||
@@ -39,20 +39,13 @@ local function createWindow()
|
||||
window:close()
|
||||
end
|
||||
window.drawingArea = window:addContainer(1, 4, window.width, window.height - 3, 0xEEEEEE)
|
||||
|
||||
window.resourcesPath = MineOSCore.getCurrentApplicationResourcesDirectory()
|
||||
window.modules = {}
|
||||
for file in fs.list(window.resourcesPath .. "Modules/") do
|
||||
table.insert(window.modules, {
|
||||
path = window.resourcesPath .. "Modules/" .. file
|
||||
})
|
||||
end
|
||||
|
||||
window.modules[1].execute(window)
|
||||
end
|
||||
|
||||
-----------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
createWindow()
|
||||
loadModule(1)
|
||||
window.drawShadow = true
|
||||
window:draw()
|
||||
buffer.draw()
|
||||
|
||||
Reference in New Issue
Block a user