changed source project

This commit is contained in:
Robert Jelic
2022-05-27 20:30:00 +02:00
parent 6df029c0bc
commit 0348e9317d
32 changed files with 83 additions and 74 deletions

View File

@@ -1,67 +1,7 @@
local basaltFileName = "basalt.lua"
local absoluteFilePath = "source"
local absolutePath = "source"
local basalt = dofile(fs.combine(absolutePath, "packager.lua")) -- path to packager
local requiredFiles = {
"mainTop.lua",
"mainBottom.lua",
"Frame.lua",
"Object.lua",
"defaultTheme.lua",
"lib/drawHelper.lua",
"lib/eventSystem.lua",
"lib/process.lua",
"lib/utils.lua",
}
local basalt = ""
for k,v in pairs(requiredFiles)do
assert(fs.exists(fs.combine(absoluteFilePath, v)), "File "..v.." doesn't exists!")
end
local lib = fs.list(fs.combine(absoluteFilePath, "lib"))
local objects = fs.list(fs.combine(absoluteFilePath, "objects"))
local file = fs.open(fs.combine(absoluteFilePath, "mainTop.lua"), "r")
basalt = basalt..file.readAll().."\n"
file.close()
local file = fs.open(fs.combine(absoluteFilePath, "defaultTheme.lua"), "r")
basalt = basalt..file.readAll().."\n"
file.close()
for _,v in pairs(lib)do
local path = fs.combine(fs.combine(absoluteFilePath, "lib"), v)
if not(fs.isDir(path))then
local file = fs.open(path, "r")
basalt = basalt..file.readAll().."\n"
file.close()
end
end
local file = fs.open(fs.combine(absoluteFilePath, "Object.lua"), "r")
basalt = basalt..file.readAll().."\n"
file.close()
for _,v in pairs(objects)do
if(v~="example.lua")then
local path = fs.combine(fs.combine(absoluteFilePath, "objects"), v)
if not(fs.isDir(path))then
local file = fs.open(path, "r")
basalt = basalt..file.readAll().."\n"
file.close()
end
end
end
local file = fs.open(fs.combine(absoluteFilePath, "Frame.lua"), "r")
basalt = basalt..file.readAll().."\n"
file.close()
local file = fs.open(fs.combine(absoluteFilePath, "mainBottom.lua"), "r")
basalt = basalt..file.readAll().."\n"
file.close()
local b = fs.open(fs.combine(absoluteFilePath, "basalt.lua"), "w")
local b = fs.open(fs.combine(absolutePath, "basalt.lua"), "w")
b.write(basalt)
b.close()

4
source/loader.lua Normal file
View File

@@ -0,0 +1,4 @@
local absolutePath = "source"
local basalt = dofile(fs.combine(absolutePath, "packager.lua"))
return (load(basalt, "t")())

68
source/packager.lua Normal file
View File

@@ -0,0 +1,68 @@
local basaltFileName = "basalt.lua"
local absoluteFilePath = "source/project"
local requiredFiles = {
"mainTop.lua",
"mainBottom.lua",
"Frame.lua",
"Object.lua",
"defaultTheme.lua",
"lib/drawHelper.lua",
"lib/eventSystem.lua",
"lib/process.lua",
"lib/utils.lua",
}
local basalt = ""
for k,v in pairs(requiredFiles)do
assert(fs.exists(fs.combine(absoluteFilePath, v)), "File "..v.." doesn't exists!")
end
local lib = fs.list(fs.combine(absoluteFilePath, "lib"))
local objects = fs.list(fs.combine(absoluteFilePath, "objects"))
local file = fs.open(fs.combine(absoluteFilePath, "mainTop.lua"), "r")
basalt = basalt..file.readAll().."\n"
file.close()
local file = fs.open(fs.combine(absoluteFilePath, "defaultTheme.lua"), "r")
basalt = basalt..file.readAll().."\n"
file.close()
for _,v in pairs(lib)do
local path = fs.combine(fs.combine(absoluteFilePath, "lib"), v)
if not(fs.isDir(path))then
local file = fs.open(path, "r")
basalt = basalt..file.readAll().."\n"
file.close()
end
end
local file = fs.open(fs.combine(absoluteFilePath, "Object.lua"), "r")
basalt = basalt..file.readAll().."\n"
file.close()
for _,v in pairs(objects)do
if(v~="example.lua")then
local path = fs.combine(fs.combine(absoluteFilePath, "objects"), v)
if not(fs.isDir(path))then
local file = fs.open(path, "r")
basalt = basalt..file.readAll().."\n"
file.close()
end
end
end
local file = fs.open(fs.combine(absoluteFilePath, "Frame.lua"), "r")
basalt = basalt..file.readAll().."\n"
file.close()
local file = fs.open(fs.combine(absoluteFilePath, "mainBottom.lua"), "r")
basalt = basalt..file.readAll().."\n"
file.close()
--local b = fs.open(fs.combine(absoluteFilePath, "basalt.lua"), "w")
--b.write(basalt)
--b.close()
return basalt

View File

@@ -78,15 +78,12 @@ local function Frame(name, parent)
return false
end
---@class Frame
object = {
barActive = false,
barBackground = colors.gray,
barTextcolor = colors.black,
barText = "New Frame",
barTextAlign = "left",
isMovable = false,
---@deprecated deprecated in favor of Frame#isMovable
isMoveable = false,
getType = function(self)
@@ -152,19 +149,13 @@ local function Frame(name, parent)
return self
end;
setMovable = function(self, movable)
self.isMovable = movable or not self.isMovable
self:setVisualChanged()
return self;
end;
---@deprecated deprecated in favor of @see Frame#setMovable
setMoveable = function(self, moveable)
self.isMoveable = moveable or not self.isMoveable
self:setVisualChanged()
return self;
end;
showBar = function(self, showIt)
self.barActive = showIt or not self.barActive
self:setVisualChanged()

View File

@@ -170,6 +170,8 @@ local function basaltDrawHelper()
end
terminal.setCursorBlink(isBlinking)
terminal.setCursorPos(xC, yC)
terminal.setBackgroundColor(colors.black)
terminal.setTextColor(colors.red)
end;
setTerm = function(newTerm)

View File

@@ -32,7 +32,11 @@ function basalt.autoUpdate(isActive)
drawHelper.update()
while updaterActive do
local event, p1, p2, p3, p4 = os.pullEventRaw() -- change to raw later
basaltUpdateEvent(event, p1, p2, p3, p4)
local ok, err = pcall(basaltUpdateEvent(event, p1, p2, p3, p4))
if not(ok)then
parentTerminal.clear()
error(err)
end
end
end