Compare commits
32 Commits
v1.6.5
...
feature-co
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0e63ef628d | ||
|
|
1f08cf7552 | ||
|
|
a92e99f3cc | ||
|
|
d7aa9c3d3a | ||
|
|
779da6c992 | ||
|
|
406bc4c314 | ||
|
|
3a36636767 | ||
|
|
7b4bb478fe | ||
|
|
27be79d322 | ||
|
|
f2763ae5e7 | ||
|
|
2753885db0 | ||
|
|
e1008442bd | ||
|
|
d821409093 | ||
|
|
618d622fb2 | ||
|
|
eb1d793ab1 | ||
|
|
52597d66a3 | ||
|
|
45d9f80374 | ||
|
|
06afa1a26d | ||
|
|
d3bb1ac4ef | ||
|
|
d4e3b67b79 | ||
|
|
a8e40c8fcc | ||
|
|
7056abbba5 | ||
|
|
724eedf7e9 | ||
|
|
b8a4d7829d | ||
|
|
20eca6ae5c | ||
|
|
5af4eae8df | ||
|
|
c0f9a172d8 | ||
|
|
0d8654cdb3 | ||
|
|
94a25207a7 | ||
|
|
9303397680 | ||
|
|
17c7aedff3 | ||
|
|
5e3bc7b556 |
55
.github/workflows/ci.yml
vendored
Normal file
55
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
# This is a basic workflow to help you get started with Actions
|
||||||
|
|
||||||
|
name: CI
|
||||||
|
|
||||||
|
# Controls when the workflow will run
|
||||||
|
on:
|
||||||
|
# Triggers the workflow on push or pull request events but only for the master branch
|
||||||
|
push:
|
||||||
|
branches: [ master, feature-compile-ci ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ master, feature-compile-ci ]
|
||||||
|
|
||||||
|
# Allows you to run this workflow manually from the Actions tab
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
||||||
|
jobs:
|
||||||
|
# This workflow contains a single job called "build"
|
||||||
|
build:
|
||||||
|
# The type of runner that the job will run on
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
# Steps represent a sequence of tasks that will be executed as part of the job
|
||||||
|
steps:
|
||||||
|
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: start-message
|
||||||
|
run: echo Starting compilation
|
||||||
|
|
||||||
|
# Runs a set of commands using the runners shell
|
||||||
|
- name: setup-lua
|
||||||
|
uses: leafo/gh-actions-lua@v9
|
||||||
|
with:
|
||||||
|
luaVersion: "5.1"
|
||||||
|
|
||||||
|
- name: setup-luarocks
|
||||||
|
uses: leafo/gh-actions-luarocks@v4
|
||||||
|
with:
|
||||||
|
luarocksVersion: "3.9.0"
|
||||||
|
|
||||||
|
- name: install-lfs
|
||||||
|
run: luarocks install luafilesystem
|
||||||
|
|
||||||
|
- name: compile-basalt
|
||||||
|
run: lua scripts/compiler.lua
|
||||||
|
|
||||||
|
- name: dir-check
|
||||||
|
run: "pwd && ls -la && find -L . basalt.lua | grep basalt.lua"
|
||||||
|
|
||||||
|
- name: Upload artifact
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: Basalt-Artifact
|
||||||
|
path: ${{ github.workspace }}/build/basalt.lua
|
||||||
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/build/
|
||||||
File diff suppressed because one or more lines are too long
@@ -7,8 +7,8 @@ local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
|||||||
local button = mainFrame:addButton("myFirstButton")
|
local button = mainFrame:addButton("myFirstButton")
|
||||||
button:show()
|
button:show()
|
||||||
````
|
````
|
||||||
**parameters:** -<br>
|
#### Parameters: -<br>
|
||||||
**returns:** self<br>
|
#### Returns: self<br>
|
||||||
|
|
||||||
## hide
|
## hide
|
||||||
hides the object
|
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)
|
local button = mainFrame:addButton("myFirstButton"):setText("Close"):onClick(function() mainFrame:hide() end)
|
||||||
button:show()
|
button:show()
|
||||||
````
|
````
|
||||||
**parameters:** -<br>
|
#### Parameters: -<br>
|
||||||
**returns:** self<br>
|
#### Returns: self<br>
|
||||||
|
|
||||||
## setPosition
|
## setPosition
|
||||||
Changes the position relative to its parent frame
|
Changes the position relative to its parent frame
|
||||||
````lua
|
````lua
|
||||||
local mainFrame = basalt.createFrame("myFirstFrame"):setPosition(2,3)
|
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<br>
|
#### Parameters: number x, number y[, boolean relative], if relative is set to true it will add/remove instead of set x, y<br>
|
||||||
**returns:** self<br>
|
#### Returns: self<br>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -35,24 +35,24 @@ Changes the object background color
|
|||||||
````lua
|
````lua
|
||||||
local mainFrame = basalt.createFrame("myFirstFrame"):setBackground(colors.lightGray)
|
local mainFrame = basalt.createFrame("myFirstFrame"):setBackground(colors.lightGray)
|
||||||
````
|
````
|
||||||
**parameters:** number color<br>
|
#### Parameters: number color<br>
|
||||||
**returns:** self<br>
|
#### Returns: self<br>
|
||||||
|
|
||||||
## setForeground
|
## setForeground
|
||||||
Changes the object text color
|
Changes the object text color
|
||||||
````lua
|
````lua
|
||||||
local mainFrame = basalt.createFrame("myFirstFrame"):setForeground(colors.black)
|
local mainFrame = basalt.createFrame("myFirstFrame"):setForeground(colors.black)
|
||||||
````
|
````
|
||||||
**parameters:** number color<br>
|
#### Parameters: number color<br>
|
||||||
**returns:** self<br>
|
#### Returns: self<br>
|
||||||
|
|
||||||
## setSize
|
## setSize
|
||||||
Changes the object size
|
Changes the object size
|
||||||
````lua
|
````lua
|
||||||
local mainFrame = basalt.createFrame("myFirstFrame"):setSize(15,5)
|
local mainFrame = basalt.createFrame("myFirstFrame"):setSize(15,5)
|
||||||
````
|
````
|
||||||
**parameters:** number width, number length<br>
|
#### Parameters: number width, number length<br>
|
||||||
**returns:** self<br>
|
#### Returns: self<br>
|
||||||
|
|
||||||
## setFocus
|
## setFocus
|
||||||
sets the object to be the focused object.
|
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 mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||||
local aButton = mainFrame:addButton("myFirstButton"):setFocus():show()
|
local aButton = mainFrame:addButton("myFirstButton"):setFocus():show()
|
||||||
````
|
````
|
||||||
**parameters:** -<br>
|
#### Parameters: -<br>
|
||||||
**returns:** self<br>
|
#### Returns: self<br>
|
||||||
|
|
||||||
## setZIndex
|
## 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.
|
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 mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||||
local aButton = mainFrame:addButton("myFirstButton"):setZIndex(1):show()
|
local aButton = mainFrame:addButton("myFirstButton"):setZIndex(1):show()
|
||||||
````
|
````
|
||||||
**parameters:** number index<br>
|
#### Parameters: number index<br>
|
||||||
**returns:** self<br>
|
#### Returns: self<br>
|
||||||
|
|
||||||
## setParent
|
## setParent
|
||||||
changes the frame parent of that object
|
changes the frame parent of that object
|
||||||
@@ -81,8 +81,8 @@ local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
|||||||
local aRandomFrame = basalt.createFrame("aRandomFrame"):show()
|
local aRandomFrame = basalt.createFrame("aRandomFrame"):show()
|
||||||
local aButton = mainFrame:addButton("myFirstButton"):onClick(function() aRandomFrame:setParent(mainFrame) end):show()
|
local aButton = mainFrame:addButton("myFirstButton"):onClick(function() aRandomFrame:setParent(mainFrame) end):show()
|
||||||
````
|
````
|
||||||
**parameters:** frame object<br>
|
#### Parameters: frame object<br>
|
||||||
**returns:** self<br>
|
#### Returns: self<br>
|
||||||
|
|
||||||
## isFocused
|
## isFocused
|
||||||
returns if the object is currently the focused object of the parent frame
|
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()
|
local aButton = mainFrame:addButton("myFirstButton"):show()
|
||||||
basalt.debug(aButton:isFocused()) -- shows true or false as a debug message
|
basalt.debug(aButton:isFocused()) -- shows true or false as a debug message
|
||||||
````
|
````
|
||||||
**parameters:** -<br>
|
#### Parameters: -<br>
|
||||||
**returns:** boolean<br>
|
#### Returns: boolean<br>
|
||||||
|
|
||||||
## getAnchorPosition
|
## getAnchorPosition
|
||||||
converts the x,y coordinates into the anchor coordinates of that object
|
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()
|
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
|
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)<br>
|
#### Parameters: number x, number y - or nothing (if nothing it uses the object's x, y)<br>
|
||||||
**returns:** number x, number y (converted)<br>
|
#### Returns: number x, number y (converted)<br>
|
||||||
|
|
||||||
## setAnchor
|
## setAnchor
|
||||||
sets the anchor of that object
|
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 mainFrame = basalt.createFrame("myFirstFrame"):setAnchor("right"):show()
|
||||||
local aButton = mainFrame:addButton("myFirstButton"):setAnchor("bottom","right"):setSize(8,1):setPosition(1,1):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")<br>
|
#### Parameters: string sides - ("left", "right", "top", "bottom") you can stack positions like so ..:setAnchor("right", "bottom")<br>
|
||||||
**returns:** self<br>
|
#### Returns: self<br>
|
||||||
|
|
||||||
## getAbsolutePosition
|
## getAbsolutePosition
|
||||||
converts the relative coordinates into absolute coordinates
|
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()
|
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
|
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)<br>
|
#### Parameters: number x, number y - or nothing (if nothing it uses the object's x, y)<br>
|
||||||
**returns:** self<br>
|
#### Returns: self<br>
|
||||||
|
|
||||||
## setTextAlign
|
## setTextAlign
|
||||||
sets the text align of the object (for example buttons)
|
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 mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||||
local aButton = mainFrame:addButton("myFirstButton"):setSize(12,3):setTextAlign("right", "center"):setText("Dont't..."):show()
|
local aButton = mainFrame:addButton("myFirstButton"):setSize(12,3):setTextAlign("right", "center"):setText("Dont't..."):show()
|
||||||
````
|
````
|
||||||
**parameters:** string horizontal, string vertical - ("left", "center", "right")<br>
|
#### Parameters: string horizontal, string vertical - ("left", "center", "right")<br>
|
||||||
**returns:** self<br>
|
#### Returns: self<br>
|
||||||
|
|
||||||
## setValue
|
## setValue
|
||||||
sets the value of that object (input, label, checkbox, textfield, scrollbar,...)
|
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 mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||||
local aCheckbox = mainFrame:addCheckbox("myFirstCheckbox"):setValue(true):show()
|
local aCheckbox = mainFrame:addCheckbox("myFirstCheckbox"):setValue(true):show()
|
||||||
````
|
````
|
||||||
**parameters:** any value<br>
|
#### Parameters: any value<br>
|
||||||
**returns:** self<br>
|
#### Returns: self<br>
|
||||||
|
|
||||||
## getValue
|
## getValue
|
||||||
returns the currently saved value
|
returns the currently saved value
|
||||||
@@ -151,8 +151,8 @@ local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
|||||||
local aCheckbox = mainFrame:addCheckbox("myFirstCheckbox"):setValue(true):show()
|
local aCheckbox = mainFrame:addCheckbox("myFirstCheckbox"):setValue(true):show()
|
||||||
basalt.debug(aCheckbox:getValue()) -- returns true
|
basalt.debug(aCheckbox:getValue()) -- returns true
|
||||||
````
|
````
|
||||||
**parameters:**-<br>
|
#### Parameters:-<br>
|
||||||
**returns:** any value<br>
|
#### Returns: any value<br>
|
||||||
|
|
||||||
## getHeight/getWidth
|
## getHeight/getWidth
|
||||||
returns the height or width
|
returns the height or width
|
||||||
@@ -161,8 +161,8 @@ local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
|||||||
local aButton = mainFrame:addButton("myFirstButton"):setSize(5,8):show()
|
local aButton = mainFrame:addButton("myFirstButton"):setSize(5,8):show()
|
||||||
basalt.debug(aButton:getHeight()) -- returns 8
|
basalt.debug(aButton:getHeight()) -- returns 8
|
||||||
````
|
````
|
||||||
**parameters:**-<br>
|
#### Parameters:-<br>
|
||||||
**returns:** number height/width<br>
|
#### Returns: number height/width<br>
|
||||||
|
|
||||||
## isVisible
|
## isVisible
|
||||||
returns if the object is currently visible
|
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()
|
local aButton = mainFrame:addButton("myFirstButton"):setSize(5,8):show()
|
||||||
basalt.debug(aButton:isVisible()) -- returns true
|
basalt.debug(aButton:isVisible()) -- returns true
|
||||||
````
|
````
|
||||||
**parameters:**-<br>
|
#### Parameters:-<br>
|
||||||
**returns:** boolean<br>
|
#### Returns: boolean<br>
|
||||||
|
|
||||||
## getName
|
## getName
|
||||||
returns the given name of that object
|
returns the given name of that object
|
||||||
@@ -180,8 +180,8 @@ returns the given name of that object
|
|||||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||||
basalt.debug(mainFrame:getName()) -- returns myFirstFrame
|
basalt.debug(mainFrame:getName()) -- returns myFirstFrame
|
||||||
````
|
````
|
||||||
**parameters:**-<br>
|
#### Parameters:-<br>
|
||||||
**returns:** string name<br>
|
#### Returns: string name<br>
|
||||||
|
|
||||||
# Object Events
|
# 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
|
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 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()
|
local aButton = mainFrame:addButton("myFirstButton"):setSize(10,3):onClick(function(self,event,button,x,y) basalt.debug("Hellooww UwU") end):show()
|
||||||
````
|
````
|
||||||
**parameters:** function func<br>
|
#### Parameters: function func<br>
|
||||||
**returns:** self<br>
|
#### Returns: self<br>
|
||||||
|
|
||||||
## onClickUp
|
## onClickUp
|
||||||
creates a click_up event
|
creates a click_up event
|
||||||
@@ -201,8 +201,8 @@ creates a click_up event
|
|||||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
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()
|
local aButton = mainFrame:addButton("myFirstButton"):setSize(10,3):onClickUp(function(self,event,button,x,y) basalt.debug("Byeeeee UwU") end):show()
|
||||||
````
|
````
|
||||||
**parameters:** function func<br>
|
#### Parameters: function func<br>
|
||||||
**returns:** self<br>
|
#### Returns: self<br>
|
||||||
|
|
||||||
## onMouseDrag
|
## onMouseDrag
|
||||||
creates a mouse_drag event
|
creates a mouse_drag event
|
||||||
@@ -210,8 +210,8 @@ creates a mouse_drag event
|
|||||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
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()
|
local aButton = mainFrame:addButton("myFirstButton"):setSize(10,3):onClickUp(function(self,event,button,x,y) basalt.debug("Byeeeee UwU") end):show()
|
||||||
````
|
````
|
||||||
**parameters:** function func<br>
|
#### Parameters: function func<br>
|
||||||
**returns:** self<br>
|
#### Returns: self<br>
|
||||||
|
|
||||||
## onChange
|
## onChange
|
||||||
creates a change event (fires as soon as the value gets changed)
|
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 mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||||
local aCheckbox = mainFrame:addCheckbox("myFirstCheckbox"):onChange(function(self) basalt.debug("i got changed into "..self:getValue()) end):show()
|
local aCheckbox = mainFrame:addCheckbox("myFirstCheckbox"):onChange(function(self) basalt.debug("i got changed into "..self:getValue()) end):show()
|
||||||
````
|
````
|
||||||
**parameters:** function func<br>
|
#### Parameters: function func<br>
|
||||||
**returns:** self<br>
|
#### Returns: self<br>
|
||||||
|
|
||||||
## onKey
|
## onKey
|
||||||
creates a key(board) - event can be key or char
|
creates a key(board) - event can be key or char
|
||||||
````lua
|
````lua
|
||||||
local mainFrame = basalt.createFrame("myFirstFrame"):onKey(function(self,event,key) basalt.debug("you clicked "..key) end):show()
|
local mainFrame = basalt.createFrame("myFirstFrame"):onKey(function(self,event,key) basalt.debug("you clicked "..key) end):show()
|
||||||
````
|
````
|
||||||
**parameters:** function func<br>
|
#### Parameters: function func<br>
|
||||||
**returns:** self<br>
|
#### Returns: self<br>
|
||||||
|
|
||||||
## onLoseFocus
|
## onLoseFocus
|
||||||
creates a lose focus event
|
creates a lose focus event
|
||||||
````lua
|
````lua
|
||||||
local mainFrame = basalt.createFrame("myFirstFrame"):onLoseFocus(function(self) basalt.debug("please come back..") end):show()
|
local mainFrame = basalt.createFrame("myFirstFrame"):onLoseFocus(function(self) basalt.debug("please come back..") end):show()
|
||||||
````
|
````
|
||||||
**parameters:** function func<br>
|
#### Parameters: function func<br>
|
||||||
**returns:** self<br>
|
#### Returns: self<br>
|
||||||
|
|
||||||
## onGetFocus
|
## onGetFocus
|
||||||
creates a get focus event
|
creates a get focus event
|
||||||
````lua
|
````lua
|
||||||
local mainFrame = basalt.createFrame("myFirstFrame"):onGetFocus(function(self) basalt.debug("thanks!") end):show()
|
local mainFrame = basalt.createFrame("myFirstFrame"):onGetFocus(function(self) basalt.debug("thanks!") end):show()
|
||||||
````
|
````
|
||||||
**parameters:** function func<br>
|
#### Parameters: function func<br>
|
||||||
**returns:** self<br>
|
#### Returns: self<br>
|
||||||
44
scripts/compiler.lua
Normal file
44
scripts/compiler.lua
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
lfs = require "lfs"
|
||||||
|
sourcesPath = "source/"
|
||||||
|
scriptsPath = "scripts/"
|
||||||
|
buildPath = "build/"
|
||||||
|
sourceFileName = "basalt.lua"
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
dirExists = function(path)
|
||||||
|
local _, endIndex = string.find(path, "/")
|
||||||
|
if(endIndex == #path) then
|
||||||
|
path = string.sub(path, 1, #path - 1)
|
||||||
|
end
|
||||||
|
if(lfs.attributes(path, "mode") == "directory") then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
local compiledSource = dofile(scriptsPath .. "packager.lua") -- path to packager
|
||||||
|
|
||||||
|
if not dirExists(buildPath) then
|
||||||
|
lfs.mkdir(buildPath)
|
||||||
|
assert(dirExists(buildPath), "Failed to make build directory, exiting...")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
print(string.format("Writing to %s/%s%s", lfs.currentdir(), buildPath, sourceFileName))
|
||||||
|
os.execute("echo ".. string.format("Writing to %s/%s%s", lfs.currentdir(), buildPath, sourceFileName))
|
||||||
|
local sourceFile = io.open(buildPath .. sourceFileName, "w")
|
||||||
|
|
||||||
|
sourceFile:write(compiledSource)
|
||||||
|
sourceFile:close()
|
||||||
3
scripts/loader.lua
Normal file
3
scripts/loader.lua
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
local basalt = dofile(scriptsPath .. "packager.lua")
|
||||||
|
|
||||||
|
return (load(basalt, "t")())
|
||||||
47
scripts/packager.lua
Normal file
47
scripts/packager.lua
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
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 .. sourceFileName, "w")
|
||||||
|
local compiledSource = ""
|
||||||
|
|
||||||
|
for _, file in ipairs(filesOrdered) do
|
||||||
|
local currentSource = io.open(sourcesPath .. file, "r")
|
||||||
|
compiledSource = compiledSource .. currentSource:read("*a") .. "\n"
|
||||||
|
end
|
||||||
|
|
||||||
|
--basalt:write(compiledSource)
|
||||||
|
--basalt:close()
|
||||||
|
return compiledSource
|
||||||
19
scripts/test.lua
Normal file
19
scripts/test.lua
Normal file
@@ -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
|
||||||
@@ -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()
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
local absolutePath = "source"
|
|
||||||
local basalt = dofile(fs.combine(absolutePath, "packager.lua"))
|
|
||||||
|
|
||||||
return (load(basalt, "t")())
|
|
||||||
@@ -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
|
|
||||||
Reference in New Issue
Block a user