Skip to content

Commit cfdca63

Browse files
committed
Docs update
some docs update for the new installer
1 parent b34cdd8 commit cfdca63

File tree

8 files changed

+139
-223
lines changed

8 files changed

+139
-223
lines changed

docs/Home.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# Welcome to The Basalt Wiki!
1+
# Welcome to The Basalt Wiki
22

33
*Note: The Basalt Wiki is a work in progress. Please treat wiki errors the same as bugs and report them accordingly.*
44

55
Here you can find information about how to use Basalt as well as examples of functional Basalt code. The aim of Basalt is to improve user interaction through visual display.
66

77
## About Basalt
88

9-
Basalt is intended to be an easy-to-understand UI Framework designed for CC:Tweaked (Also know as "ComputerCraft: Tweaked") - a popular minecraft mod. For more information about CC:Tweaked, checkout the project's [wiki](https://tweaked.cc/) or [download](https://modrinth.com/mod/cc-tweaked).
9+
Basalt is intended to be an easy-to-understand UI Framework designed for CC:Tweaked (Also known as "ComputerCraft: Tweaked") - a popular minecraft mod. For more information about CC:Tweaked, checkout the project's [wiki](https://tweaked.cc/) or [download](https://modrinth.com/mod/cc-tweaked).
1010

1111
## Quick Demo
1212

docs/_navbar.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
- Getting Started
22
- [Home](Home)
3-
- [Quick Start](home/Quick-Start)
4-
- [Installer](home/installer)
3+
- [How To](home/How-To)
4+
- [Download](home/download)

docs/_sidebar.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
- About
2-
- [Home](Home.md)
3-
- [Quick Start](home/Quick-Start.md)
4-
- [Installer](home/installer)
2+
- [Home](home)
3+
- [How To](home/How-To)
4+
- [Download](home/download)
55
- Objects
66
- [Basalt](objects/Basalt.md)
77
- [Object](objects/Object.md)

docs/home/How-To.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
After downloading the project you can finally start creating your own program and use basalt. The first thing you want to use in your program is always:
2+
3+
```lua
4+
local basalt = require("basalt")
5+
```
6+
7+
It doesn't matter if you're using the source folder or the minified/packed version of basalt. Both can be found by using require("basalt") without .lua.
8+
9+
Also to really run basalt you should use
10+
11+
```lua
12+
basalt.autoUpdate()
13+
```
14+
15+
somewhere on the bottom of your program. basalt.autoUpdate() starts the event listener and the draw handler.
16+
17+
## Example
18+
19+
Here is a fully working example of how a program could look like:
20+
21+
```lua
22+
local basalt = require("basalt") --> Load the basalt framework into the variable called "basalt"
23+
24+
--> Now we want to create a base frame, we call the variable "main" - by default everything you create is visible. (you don't need to use :show())
25+
local main = basalt.createFrame()
26+
27+
local button = mainFrame:addButton() --> Here we add our first button
28+
button:setPosition(4, 4) -- of course we want to change the default position of our button
29+
button:setSize(16, 3) -- and the default size.
30+
button:setText("Click me!") --> This method displays what the text of our button should look like
31+
32+
local function buttonClick() --> Let us create a function we want to call when the button gets clicked
33+
basalt.debug("I got clicked!")
34+
end
35+
36+
-- Now we just need to register the function to the buttons onClick event handlers, this is how we can achieve that:
37+
button:onClick(buttonClick)
38+
39+
40+
basalt.autoUpdate() -- As soon as we call basalt.autoUpdate, the event and draw handlers will listen to any incomming events (and draw if necessary)
41+
```
42+
43+
If you're like us and strive for succinct and beautiful code, here is a cleaner implementation of the code above:
44+
45+
```lua
46+
local basalt = require("basalt")
47+
48+
local main = basalt.createFrame()
49+
local button = main --> Basalt returns an instance of the object on most methods, to make use of "call-chaining"
50+
:addButton() --> This is an example of call chaining
51+
:setPosition(4,4)
52+
:setText("Click me!")
53+
:onClick(
54+
function()
55+
basalt.debug("I got clicked!")
56+
end)
57+
58+
basalt.autoUpdate()
59+
```

docs/home/Quick-Start.md

Lines changed: 0 additions & 95 deletions
This file was deleted.

docs/home/download.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
Basalt provides multiple unique versions. A source version, a minified version and a web version.
2+
3+
## Source
4+
5+
This version is, like the name already says, the source code of basalt. If you want to dig into the code, add additional content or just prefer to use the source, then you should aim for the source-version.
6+
7+
The following command allows you to download the source-version on your computer:
8+
9+
`wget run https://basalt.madefor.cc/install.lua source [foldername] [branch]`
10+
11+
The first optional argument is the folder name you wish that basalt should be installed into, by default the folder is called basalt.
12+
The second optional argument is the branch you want to use. If you don't know what this means please ignore it (the 2 options are master and dev)
13+
14+
## Minified / Packed
15+
16+
This version is the minified version, i also call it the packed version. There are 2 changes, the first one is that the code will be shown minified which makes the size much smaller, the second change is that you will recieve a file instead of a folder.
17+
18+
The following command allows you to download the packed-version on your computer:
19+
20+
`wget run https://basalt.madefor.cc/install.lua packed [filename] [branch]`
21+
22+
The first optional argument is the file name you wish that the installer should use, by default the file is called basalt.lua.
23+
The second optional argument is the branch you want to use. If you don't know what this means please ignore it (the 2 options are master and dev)
24+
25+
## Web
26+
27+
The web version is a special version, used if your goal is to keep your project's size as small as possible. I suggest you to use the web version only if you don't restart your program over and over again. For example if you designed your program to reboot after the user made a bad choice (leads into a error or something like that) it is better to use the minified/source version.
28+
29+
The following command allows you to download the web-version on your computer:
30+
31+
`wget run https://basalt.madefor.cc/install.lua web [version] [filename]`
32+
33+
By default the first argument is the latest version of basalt's releases. [Here](https://github.com/Pyroxenium/Basalt/tree/master/docs/versions) you can see which versions are available to use.
34+
For example: wget run https://basalt.madefor.cc/install.lua web basalt-1.6.3.lua - the second argument is just the file name, default is basaltWeb.lua.
35+
36+
Remember to rename `local basalt = require("basalt")` into `local basalt = require("basaltWeb")` if you want to use the web-version

docs/home/installer.md

Lines changed: 0 additions & 71 deletions
This file was deleted.

0 commit comments

Comments
 (0)