diff --git a/docs/objects/Object.md b/docs/objects/Object.md
index 2c1ea71..907343d 100644
--- a/docs/objects/Object.md
+++ b/docs/objects/Object.md
@@ -7,8 +7,8 @@ local mainFrame = basalt.createFrame("myFirstFrame"):show()
local button = mainFrame:addButton("myFirstButton")
button:show()
````
-**parameters:** -
-**returns:** self
+#### Parameters: -
+#### Returns: self
## hide
hides the object
@@ -17,16 +17,16 @@ local mainFrame = basalt.createFrame("myFirstFrame"):show()
local button = mainFrame:addButton("myFirstButton"):setText("Close"):onClick(function() mainFrame:hide() end)
button:show()
````
-**parameters:** -
-**returns:** self
+#### Parameters: -
+#### Returns: self
## setPosition
Changes the position relative to its parent frame
````lua
local mainFrame = basalt.createFrame("myFirstFrame"):setPosition(2,3)
````
-**parameters:** number x, number y[, boolean relative], if relative is set to true it will add/remove instead of set x, y
-**returns:** self
+#### Parameters: number x, number y[, boolean relative], if relative is set to true it will add/remove instead of set x, y
+#### Returns: self
@@ -35,24 +35,24 @@ Changes the object background color
````lua
local mainFrame = basalt.createFrame("myFirstFrame"):setBackground(colors.lightGray)
````
-**parameters:** number color
-**returns:** self
+#### Parameters: number color
+#### Returns: self
## setForeground
Changes the object text color
````lua
local mainFrame = basalt.createFrame("myFirstFrame"):setForeground(colors.black)
````
-**parameters:** number color
-**returns:** self
+#### Parameters: number color
+#### Returns: self
## setSize
Changes the object size
````lua
local mainFrame = basalt.createFrame("myFirstFrame"):setSize(15,5)
````
-**parameters:** number width, number length
-**returns:** self
+#### Parameters: number width, number length
+#### Returns: self
## setFocus
sets the object to be the focused object.
@@ -62,8 +62,8 @@ the foreground, you have to use :setFocus()
local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aButton = mainFrame:addButton("myFirstButton"):setFocus():show()
````
-**parameters:** -
-**returns:** self
+#### Parameters: -
+#### Returns: self
## setZIndex
changes the z index (higher z index do have higher draw/event priority) 10 is more important than 5 or 1. You are also able to add multiple objects to the same z index, which means if you create a couple of buttons, you set their z index to 10, everything below 10 is less important, everything above 10 is more important. On the same z index: the last object which gets created is the most important one.
@@ -71,8 +71,8 @@ changes the z index (higher z index do have higher draw/event priority) 10 is mo
local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aButton = mainFrame:addButton("myFirstButton"):setZIndex(1):show()
````
-**parameters:** number index
-**returns:** self
+#### Parameters: number index
+#### Returns: self
## setParent
changes the frame parent of that object
@@ -81,8 +81,8 @@ local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aRandomFrame = basalt.createFrame("aRandomFrame"):show()
local aButton = mainFrame:addButton("myFirstButton"):onClick(function() aRandomFrame:setParent(mainFrame) end):show()
````
-**parameters:** frame object
-**returns:** self
+#### Parameters: frame object
+#### Returns: self
## isFocused
returns if the object is currently the focused object of the parent frame
@@ -92,8 +92,8 @@ local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aButton = mainFrame:addButton("myFirstButton"):show()
basalt.debug(aButton:isFocused()) -- shows true or false as a debug message
````
-**parameters:** -
-**returns:** boolean
+#### Parameters: -
+#### Returns: boolean
## getAnchorPosition
converts the x,y coordinates into the anchor coordinates of that object
@@ -103,8 +103,8 @@ local mainFrame = basalt.createFrame("myFirstFrame"):setSize(15,15):show()
local aButton = mainFrame:addButton("myFirstButton"):setAnchor("right","bottom"):setSize(8,1):setPosition(1,1):show()
basalt.debug(aButton:getAnchorPosition()) -- returns 7,14 (framesize - own size) instead of 1,1
````
-**parameters:** number x, number y - or nothing (if nothing it uses the object's x, y)
-**returns:** number x, number y (converted)
+#### Parameters: number x, number y - or nothing (if nothing it uses the object's x, y)
+#### Returns: number x, number y (converted)
## setAnchor
sets the anchor of that object
@@ -113,8 +113,8 @@ sets the anchor of that object
local mainFrame = basalt.createFrame("myFirstFrame"):setAnchor("right"):show()
local aButton = mainFrame:addButton("myFirstButton"):setAnchor("bottom","right"):setSize(8,1):setPosition(1,1):show()
````
-**parameters:** string sides - ("left", "right", "top", "bottom") you can stack positions like so ..:setAnchor("right", "bottom")
-**returns:** self
+#### Parameters: string sides - ("left", "right", "top", "bottom") you can stack positions like so ..:setAnchor("right", "bottom")
+#### Returns: self
## getAbsolutePosition
converts the relative coordinates into absolute coordinates
@@ -123,8 +123,8 @@ local mainFrame = basalt.createFrame("myFirstFrame"):setPosition(3,3):show()
local aButton = mainFrame:addButton("myFirstButton"):setSize(8,1):setPosition(4,2):show()
basalt.debug(aButton:getAbsolutePosition()) -- returns 7,5 (frame coords + own coords) instead of 4,2
````
-**parameters:** number x, number y - or nothing (if nothing it uses the object's x, y)
-**returns:** self
+#### Parameters: number x, number y - or nothing (if nothing it uses the object's x, y)
+#### Returns: self
## setTextAlign
sets the text align of the object (for example buttons)
@@ -132,8 +132,8 @@ sets the text align of the object (for example buttons)
local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aButton = mainFrame:addButton("myFirstButton"):setSize(12,3):setTextAlign("right", "center"):setText("Dont't..."):show()
````
-**parameters:** string horizontal, string vertical - ("left", "center", "right")
-**returns:** self
+#### Parameters: string horizontal, string vertical - ("left", "center", "right")
+#### Returns: self
## setValue
sets the value of that object (input, label, checkbox, textfield, scrollbar,...)
@@ -141,8 +141,8 @@ sets the value of that object (input, label, checkbox, textfield, scrollbar,...)
local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aCheckbox = mainFrame:addCheckbox("myFirstCheckbox"):setValue(true):show()
````
-**parameters:** any value
-**returns:** self
+#### Parameters: any value
+#### Returns: self
## getValue
returns the currently saved value
@@ -151,8 +151,8 @@ local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aCheckbox = mainFrame:addCheckbox("myFirstCheckbox"):setValue(true):show()
basalt.debug(aCheckbox:getValue()) -- returns true
````
-**parameters:**-
-**returns:** any value
+#### Parameters:-
+#### Returns: any value
## getHeight/getWidth
returns the height or width
@@ -161,8 +161,8 @@ local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aButton = mainFrame:addButton("myFirstButton"):setSize(5,8):show()
basalt.debug(aButton:getHeight()) -- returns 8
````
-**parameters:**-
-**returns:** number height/width
+#### Parameters:-
+#### Returns: number height/width
## isVisible
returns if the object is currently visible
@@ -171,8 +171,8 @@ local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aButton = mainFrame:addButton("myFirstButton"):setSize(5,8):show()
basalt.debug(aButton:isVisible()) -- returns true
````
-**parameters:**-
-**returns:** boolean
+#### Parameters:-
+#### Returns: boolean
## getName
returns the given name of that object
@@ -180,8 +180,8 @@ returns the given name of that object
local mainFrame = basalt.createFrame("myFirstFrame"):show()
basalt.debug(mainFrame:getName()) -- returns myFirstFrame
````
-**parameters:**-
-**returns:** string name
+#### Parameters:-
+#### Returns: string name
# Object Events
These object events are available for all objects, if a object got some unique events, you can see them in their own category
@@ -192,8 +192,8 @@ creates a mouse_click event
local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aButton = mainFrame:addButton("myFirstButton"):setSize(10,3):onClick(function(self,event,button,x,y) basalt.debug("Hellooww UwU") end):show()
````
-**parameters:** function func
-**returns:** self
+#### Parameters: function func
+#### Returns: self
## onClickUp
creates a click_up event
@@ -201,8 +201,8 @@ creates a click_up event
local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aButton = mainFrame:addButton("myFirstButton"):setSize(10,3):onClickUp(function(self,event,button,x,y) basalt.debug("Byeeeee UwU") end):show()
````
-**parameters:** function func
-**returns:** self
+#### Parameters: function func
+#### Returns: self
## onMouseDrag
creates a mouse_drag event
@@ -210,8 +210,8 @@ creates a mouse_drag event
local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aButton = mainFrame:addButton("myFirstButton"):setSize(10,3):onClickUp(function(self,event,button,x,y) basalt.debug("Byeeeee UwU") end):show()
````
-**parameters:** function func
-**returns:** self
+#### Parameters: function func
+#### Returns: self
## onChange
creates a change event (fires as soon as the value gets changed)
@@ -219,29 +219,29 @@ creates a change event (fires as soon as the value gets changed)
local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aCheckbox = mainFrame:addCheckbox("myFirstCheckbox"):onChange(function(self) basalt.debug("i got changed into "..self:getValue()) end):show()
````
-**parameters:** function func
-**returns:** self
+#### Parameters: function func
+#### Returns: self
## onKey
creates a key(board) - event can be key or char
````lua
local mainFrame = basalt.createFrame("myFirstFrame"):onKey(function(self,event,key) basalt.debug("you clicked "..key) end):show()
````
-**parameters:** function func
-**returns:** self
+#### Parameters: function func
+#### Returns: self
## onLoseFocus
creates a lose focus event
````lua
local mainFrame = basalt.createFrame("myFirstFrame"):onLoseFocus(function(self) basalt.debug("please come back..") end):show()
````
-**parameters:** function func
-**returns:** self
+#### Parameters: function func
+#### Returns: self
## onGetFocus
creates a get focus event
````lua
local mainFrame = basalt.createFrame("myFirstFrame"):onGetFocus(function(self) basalt.debug("thanks!") end):show()
````
-**parameters:** function func
-**returns:** self
\ No newline at end of file
+#### Parameters: function func
+#### Returns: self
\ No newline at end of file
diff --git a/scripts/compiler.lua b/scripts/compiler.lua
new file mode 100644
index 0000000..b2ac1f8
--- /dev/null
+++ b/scripts/compiler.lua
@@ -0,0 +1,19 @@
+lfs = require "lfs"
+sourcesPath = "source/"
+scriptsPath = "scripts/"
+
+fetchFiles = function(...)
+ local tbl = {}
+ for _, directory in pairs{...} do
+ for file in lfs.dir(directory) do
+ if file ~= "." and file ~= ".." then
+ table.insert(tbl, file)
+ end
+ end
+ end
+
+ return tbl
+end
+
+
+local compiledSource = dofile(scriptsPath .. "packager.lua") -- path to packager
\ No newline at end of file
diff --git a/scripts/loader.lua b/scripts/loader.lua
new file mode 100644
index 0000000..0660082
--- /dev/null
+++ b/scripts/loader.lua
@@ -0,0 +1,3 @@
+local basalt = dofile(scriptsPath .. "packager.lua")
+
+return (load(basalt, "t")())
\ No newline at end of file
diff --git a/scripts/packager.lua b/scripts/packager.lua
new file mode 100644
index 0000000..decb017
--- /dev/null
+++ b/scripts/packager.lua
@@ -0,0 +1,50 @@
+local basaltFileName = "basalt.lua"
+
+local requiredFiles = {
+ "mainTop.lua",
+ "mainBottom.lua",
+ "Frame.lua",
+ "Object.lua",
+ "defaultTheme.lua",
+ "lib/drawHelper.lua",
+ "lib/eventSystem.lua",
+ "lib/process.lua",
+ "lib/utils.lua",
+}
+for _, value in pairs(requiredFiles)do
+ assert(io.open(sourcesPath .. value), "File ".. value .." not found!")
+end
+
+local lib = fetchFiles(sourcesPath .. "lib")
+local objects = fetchFiles(sourcesPath .. "objects")
+
+local filesOrdered = {}
+
+table.insert(filesOrdered, "mainTop.lua")
+table.insert(filesOrdered, "defaultTheme.lua")
+
+for _, libFile in pairs(lib) do
+ table.insert(filesOrdered, "lib/" .. libFile)
+end
+
+table.insert(filesOrdered, "Object.lua")
+
+for _, objectFile in pairs(objects) do
+ table.insert(filesOrdered, "objects/" .. objectFile)
+end
+
+table.insert(filesOrdered, "Frame.lua")
+table.insert(filesOrdered, "mainBottom.lua")
+
+local basalt = io.open(sourcesPath .. basaltFileName, "w")
+local compiledSource = ""
+
+for _, file in ipairs(filesOrdered) do
+ print("Loading file ".. file)
+ local currentSource = io.open(sourcesPath .. file, "r")
+ compiledSource = compiledSource .. currentSource:read("*a") .. "\n"
+end
+
+basalt:write(compiledSource)
+basalt:close()
+return compiledSource
\ No newline at end of file
diff --git a/scripts/test.lua b/scripts/test.lua
new file mode 100644
index 0000000..5804553
--- /dev/null
+++ b/scripts/test.lua
@@ -0,0 +1,19 @@
+lfs = require "lfs"
+sourcesPath = "source/"
+
+fetchFiles = function(...)
+ local tbl = {}
+ for _, directory in pairs{...} do
+ for file in lfs.dir(directory) do
+ if file ~= "." and file ~= ".." then
+ table.insert(tbl, file)
+ end
+ end
+ end
+
+ return tbl
+end
+
+for _, file in pairs(fetchFiles(sourcesPath, sourcesPath .. "lib", sourcesPath .. "objects")) do
+ print(file)
+end
\ No newline at end of file
diff --git a/source/project/Frame.lua b/source/Frame.lua
similarity index 100%
rename from source/project/Frame.lua
rename to source/Frame.lua
diff --git a/source/project/Object.lua b/source/Object.lua
similarity index 100%
rename from source/project/Object.lua
rename to source/Object.lua
diff --git a/source/compiler.lua b/source/compiler.lua
deleted file mode 100644
index 383ca6b..0000000
--- a/source/compiler.lua
+++ /dev/null
@@ -1,7 +0,0 @@
-local basaltFileName = "basalt-source.lua"
-local absolutePath = "source"
-local basalt = dofile(fs.combine(absolutePath, "packager.lua")) -- path to packager
-
-local b = fs.open(fs.combine(absolutePath, basaltFileName), "w")
-b.write(basalt)
-b.close()
\ No newline at end of file
diff --git a/source/project/defaultTheme.lua b/source/defaultTheme.lua
similarity index 100%
rename from source/project/defaultTheme.lua
rename to source/defaultTheme.lua
diff --git a/source/project/lib/bigfont.lua b/source/lib/bigfont.lua
similarity index 100%
rename from source/project/lib/bigfont.lua
rename to source/lib/bigfont.lua
diff --git a/source/project/lib/drawHelper.lua b/source/lib/drawHelper.lua
similarity index 100%
rename from source/project/lib/drawHelper.lua
rename to source/lib/drawHelper.lua
diff --git a/source/project/lib/eventSystem.lua b/source/lib/eventSystem.lua
similarity index 100%
rename from source/project/lib/eventSystem.lua
rename to source/lib/eventSystem.lua
diff --git a/source/project/lib/process.lua b/source/lib/process.lua
similarity index 100%
rename from source/project/lib/process.lua
rename to source/lib/process.lua
diff --git a/source/project/lib/utils.lua b/source/lib/utils.lua
similarity index 100%
rename from source/project/lib/utils.lua
rename to source/lib/utils.lua
diff --git a/source/loader.lua b/source/loader.lua
deleted file mode 100644
index 8036ccb..0000000
--- a/source/loader.lua
+++ /dev/null
@@ -1,4 +0,0 @@
-local absolutePath = "source"
-local basalt = dofile(fs.combine(absolutePath, "packager.lua"))
-
-return (load(basalt, "t")())
\ No newline at end of file
diff --git a/source/project/mainBottom.lua b/source/mainBottom.lua
similarity index 100%
rename from source/project/mainBottom.lua
rename to source/mainBottom.lua
diff --git a/source/project/mainTop.lua b/source/mainTop.lua
similarity index 100%
rename from source/project/mainTop.lua
rename to source/mainTop.lua
diff --git a/source/project/objects/Animation.lua b/source/objects/Animation.lua
similarity index 100%
rename from source/project/objects/Animation.lua
rename to source/objects/Animation.lua
diff --git a/source/project/objects/Button.lua b/source/objects/Button.lua
similarity index 100%
rename from source/project/objects/Button.lua
rename to source/objects/Button.lua
diff --git a/source/project/objects/Checkbox.lua b/source/objects/Checkbox.lua
similarity index 100%
rename from source/project/objects/Checkbox.lua
rename to source/objects/Checkbox.lua
diff --git a/source/project/objects/Dropdown.lua b/source/objects/Dropdown.lua
similarity index 100%
rename from source/project/objects/Dropdown.lua
rename to source/objects/Dropdown.lua
diff --git a/source/project/objects/Image.lua b/source/objects/Image.lua
similarity index 100%
rename from source/project/objects/Image.lua
rename to source/objects/Image.lua
diff --git a/source/project/objects/Input.lua b/source/objects/Input.lua
similarity index 100%
rename from source/project/objects/Input.lua
rename to source/objects/Input.lua
diff --git a/source/project/objects/Label.lua b/source/objects/Label.lua
similarity index 100%
rename from source/project/objects/Label.lua
rename to source/objects/Label.lua
diff --git a/source/project/objects/List.lua b/source/objects/List.lua
similarity index 100%
rename from source/project/objects/List.lua
rename to source/objects/List.lua
diff --git a/source/project/objects/Menubar.lua b/source/objects/Menubar.lua
similarity index 100%
rename from source/project/objects/Menubar.lua
rename to source/objects/Menubar.lua
diff --git a/source/project/objects/Pane.lua b/source/objects/Pane.lua
similarity index 100%
rename from source/project/objects/Pane.lua
rename to source/objects/Pane.lua
diff --git a/source/project/objects/Program.lua b/source/objects/Program.lua
similarity index 100%
rename from source/project/objects/Program.lua
rename to source/objects/Program.lua
diff --git a/source/project/objects/Progressbar.lua b/source/objects/Progressbar.lua
similarity index 100%
rename from source/project/objects/Progressbar.lua
rename to source/objects/Progressbar.lua
diff --git a/source/project/objects/Radio.lua b/source/objects/Radio.lua
similarity index 100%
rename from source/project/objects/Radio.lua
rename to source/objects/Radio.lua
diff --git a/source/project/objects/Scrollbar.lua b/source/objects/Scrollbar.lua
similarity index 100%
rename from source/project/objects/Scrollbar.lua
rename to source/objects/Scrollbar.lua
diff --git a/source/project/objects/Slider.lua b/source/objects/Slider.lua
similarity index 100%
rename from source/project/objects/Slider.lua
rename to source/objects/Slider.lua
diff --git a/source/project/objects/Switch.lua b/source/objects/Switch.lua
similarity index 100%
rename from source/project/objects/Switch.lua
rename to source/objects/Switch.lua
diff --git a/source/project/objects/Textfield.lua b/source/objects/Textfield.lua
similarity index 100%
rename from source/project/objects/Textfield.lua
rename to source/objects/Textfield.lua
diff --git a/source/project/objects/Thread.lua b/source/objects/Thread.lua
similarity index 100%
rename from source/project/objects/Thread.lua
rename to source/objects/Thread.lua
diff --git a/source/project/objects/Timer.lua b/source/objects/Timer.lua
similarity index 100%
rename from source/project/objects/Timer.lua
rename to source/objects/Timer.lua
diff --git a/source/project/objects/example.lua b/source/objects/example.lua
similarity index 100%
rename from source/project/objects/example.lua
rename to source/objects/example.lua
diff --git a/source/packager.lua b/source/packager.lua
deleted file mode 100644
index 0be5f59..0000000
--- a/source/packager.lua
+++ /dev/null
@@ -1,68 +0,0 @@
-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
\ No newline at end of file