changed source project
This commit is contained in:
@@ -1,67 +1,7 @@
|
|||||||
local basaltFileName = "basalt.lua"
|
local basaltFileName = "basalt.lua"
|
||||||
local absoluteFilePath = "source"
|
local absolutePath = "source"
|
||||||
|
local basalt = dofile(fs.combine(absolutePath, "packager.lua")) -- path to packager
|
||||||
|
|
||||||
local requiredFiles = {
|
local b = fs.open(fs.combine(absolutePath, "basalt.lua"), "w")
|
||||||
"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.write(basalt)
|
||||||
b.close()
|
b.close()
|
||||||
4
source/loader.lua
Normal file
4
source/loader.lua
Normal 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
68
source/packager.lua
Normal 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
|
||||||
@@ -78,15 +78,12 @@ local function Frame(name, parent)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
---@class Frame
|
|
||||||
object = {
|
object = {
|
||||||
barActive = false,
|
barActive = false,
|
||||||
barBackground = colors.gray,
|
barBackground = colors.gray,
|
||||||
barTextcolor = colors.black,
|
barTextcolor = colors.black,
|
||||||
barText = "New Frame",
|
barText = "New Frame",
|
||||||
barTextAlign = "left",
|
barTextAlign = "left",
|
||||||
isMovable = false,
|
|
||||||
---@deprecated deprecated in favor of Frame#isMovable
|
|
||||||
isMoveable = false,
|
isMoveable = false,
|
||||||
|
|
||||||
getType = function(self)
|
getType = function(self)
|
||||||
@@ -152,19 +149,13 @@ local function Frame(name, parent)
|
|||||||
return self
|
return self
|
||||||
end;
|
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)
|
setMoveable = function(self, moveable)
|
||||||
self.isMoveable = moveable or not self.isMoveable
|
self.isMoveable = moveable or not self.isMoveable
|
||||||
self:setVisualChanged()
|
self:setVisualChanged()
|
||||||
return self;
|
return self;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
showBar = function(self, showIt)
|
showBar = function(self, showIt)
|
||||||
self.barActive = showIt or not self.barActive
|
self.barActive = showIt or not self.barActive
|
||||||
self:setVisualChanged()
|
self:setVisualChanged()
|
||||||
@@ -170,6 +170,8 @@ local function basaltDrawHelper()
|
|||||||
end
|
end
|
||||||
terminal.setCursorBlink(isBlinking)
|
terminal.setCursorBlink(isBlinking)
|
||||||
terminal.setCursorPos(xC, yC)
|
terminal.setCursorPos(xC, yC)
|
||||||
|
terminal.setBackgroundColor(colors.black)
|
||||||
|
terminal.setTextColor(colors.red)
|
||||||
end;
|
end;
|
||||||
|
|
||||||
setTerm = function(newTerm)
|
setTerm = function(newTerm)
|
||||||
@@ -32,7 +32,11 @@ function basalt.autoUpdate(isActive)
|
|||||||
drawHelper.update()
|
drawHelper.update()
|
||||||
while updaterActive do
|
while updaterActive do
|
||||||
local event, p1, p2, p3, p4 = os.pullEventRaw() -- change to raw later
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
Reference in New Issue
Block a user