Merge pull request #16 from Pyroxenium/docsify-feature

started docsify with custom theme
This commit is contained in:
Samuel Pizette
2022-05-30 02:24:11 -04:00
committed by GitHub
31 changed files with 1924 additions and 1665 deletions

View File

@@ -1,21 +1,27 @@
# Welcome to The Basalt Wiki! # Welcome to The Basalt Wiki!<br>
*Note: The Basalt Wiki is a work in progress, now also just migrated away from github wiki. Please treat Wiki errors the same as bugs and report them accordingly.*
_Note: The Basalt Wiki is a work in progress. Please treat Wiki errors the same as bugs and report them accordingly._
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. 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.
On the left side of this page you can find a Wiki Navigation, where you can find a more detailed list of Basalt's features On the right side of this page you can find a Wiki Navigation, where you can find a more detailed list of Basalt's features
<br><br>
## About Basalt ## About Basalt
Basalt is intended to be an easy-to-understand UI Framework designed for CC:Tweaked (AKA Computer Craft: Tweaked) - a popular minecraft mod. For more information about CC:Tweaked, checkout the project's <a href="https://tweaked.cc/">home page</a>. Basalt is intended to be an easy-to-understand UI Framework designed for CC:Tweaked (AKA Computer Craft: Tweaked) - a popular minecraft mod. For more information about CC:Tweaked, checkout the project's <a href="https://tweaked.cc/">home page</a>.
<br><br>
## Quick Demo ## Quick Demo
![Preview](https://media0.giphy.com/media/fvmNPshXKeU7FFA9iA/giphy.gif) ![Preview](https://media0.giphy.com/media/fvmNPshXKeU7FFA9iA/giphy.gif)
<br><br>
## Questions & Bugs ## Questions & Bugs
Obviously NyoriE has implemented some easter eggs, _some people_ call them "bugs". If you happen to discover one of these just make a new <a href="https://github.com/Pyroxenium/Basalt/issues">issue</a>. Obviously I've implemented some easter eggs, _some people_ call them "bugs". If you happen to discover one of these just make a new <a href="https://github.com/NoryiE/Basalt/issues">issue</a>.
Additionally, if you have questions about Basalt or how to make use of it, feel free to create a new discussion on <a href="https://github.com/Pyroxenium/Basalt/discussions">Basalt's Discussion Board</a>. Additionally, if you have questions about Basalt or how to make use of it, feel free to create a new discussion on <a href="https://github.com/NoryiE/Basalt/discussions">Basalt's Discussion Board</a>.
You may also join the Discord: https://discord.gg/yNNnmBVBpE You may also message me on Discord: NyoriE#8206
<br><br>

1
docs/_Footer.md Normal file
View File

@@ -0,0 +1 @@
Thanks for checking out our wiki, join our discord for more help: [discord.gg/yM7kndJdJJ](discord.gg/yM7kndJdJJ)

29
docs/_Sidebar.md Normal file
View File

@@ -0,0 +1,29 @@
- Getting Started
- [Home](Home.md)
- [Quick Start](Quick-Start.md)
- [Installer](Installer.md)
- Objects
- [Animation](Animation.md)
- [Basalt](Basalt.md)
- [Button](Button.md)
- [Checkbox](Checkbox.md)
- [Design](Design.md)
- [Dropdown](Dropdown.md)
- [Frame](Frame.md)
- [Input](Input.md)
- [Installer](Installer.md)
- [Label](Label.md)
- [List](List.md)
- [Menubar](Menubar.md)
- [Object](Object.md)
- [Pane](Pane.md)
- [Program](Program.md)
- [Radio](Radio.md)
- [Scrollbar](Scrollbar.md)
- [Slider](Slider.md)
- [Text Field](Textfield.md)
- [Thread](Thread.md)
- [Timer](Timer.md)
- Tips & Tricks
- [Component Logic](Executing-own-logic.md)
- [Changing Button Color](Change-colors-on-buttons-while-user-is-holding-it.md)

BIN
docs/_media/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 252 KiB

4
docs/_navbar.md Normal file
View File

@@ -0,0 +1,4 @@
- Getting Started
- [Home](Home.md)
- [Quick Start](docs/home/Quick-Start.md)
- [Installer](docs/objects/Installer.md)

View File

@@ -1,29 +1,29 @@
- Home - Home
- [Home](/) - [Home](Home.md)
- [Getting Started](/home/gettingStarted) - [Getting Started](home/gettingStarted)
- [Installer](/home/installer) - [Installer](home/installer)
- Objects - Objects
- [Animation](/objects/Animation) - [Animation](objects/Animation.md)
- [Basalt](/objects/Basalt) - [Basalt](objects/Basalt)
- [Button](/objects/Button) - [Button](objects/Button)
- [Checkbox](/objects/Checkbox) - [Checkbox](objects/Checkbox)
- [Dropdown](/objects/Dropdown) - [Dropdown](objects/Dropdown)
- [Frame](/objects/Frame) - [Frame](objects/Frame)
- [Image](/objects/Image) - [Image](objects/Image)
- [Input](/objects/Input) - [Input](objects/Input)
- [Label](/objects/Label) - [Label](objects/Label)
- [List](/objects/List) - [List](objects/List)
- [Menubar](/objects/Menubar) - [Menubar](objects/Menubar)
- [Object](/objects/Object) - [Object](objects/Object)
- [Pane](/objects/Pane) - [Pane](objects/Pane)
- [Program](/objects/Program) - [Program](objects/Program)
- [Radio](/objects/Radio) - [Radio](objects/Radio)
- [Scrollbar](/objects/Scrollbar) - [Scrollbar](objects/Scrollbar)
- [Silder](/obects/Slider) - [Slider](objects/Slider)
- [Textfield](/objects/Textfield) - [Text Field](objects/Textfield)
- [Thread](/objects/Thread) - [Thread](objects/Thread)
- [Timer](/objects/Timer) - [Timer](objects/Timer)
- Tips & tricks - Tips & Tricks
- [Executing own logic](/tips/logic) - [Executing own logic](tips/logic)
- [Changing button colors](/tips/buttons) - [Changing button colors](tips/buttons)

70
docs/home/Quick-Start.md Normal file
View File

@@ -0,0 +1,70 @@
Basalt aims to be a relatively small, easy to use framework.
Accordingly, we have provided an installation script.
Just use the following command in any CC:Tweaked shell:
`pastebin run ESs1mg7P`
This will download `basalt.lua` to your local directory
To load the framework, make use of the following snippet
````lua
--> For those who are unfamiliar with lua, dofile executes the code in the referenced file
local basalt = dofile("basalt.lua")
````
Here is a fully functioning example of Basalt code
````lua
local basalt = dofile("basalt.lua") --> Load the Basalt framework
--> Create the first frame. Please note that Basalt needs at least one active "non-parent" frame to properly supply events
--> When Basalt#createFrame makes use of unique identifiers (commonly referred to as UIDs), meaning that the supplied value must be UNIQUE
--> If the supplied UID is ambiguous, Basalt#createFrame returns a nil value
local mainFrame = basalt.createFrame("mainFrame")
--> Show the frame to the user
mainFrame:show()
local button = mainFrame:addButton("clickableButton") --> Add a button to the mainFrame (With a unique identifier)
--> Set the position of the button, Button#setPosition follows an x, y pattern.
--> The x value is how far right the object should be from its anchor (negative values from an anchor will travel left)
--> The y value is how far down the object should be from its anchor (negative values from an anchor will travel up)
button:setPosition(4, 4)
button:setText("Click me!") --> Set the text of our button
local function buttonClick() --> This function serves as our click logic
basalt.debug("I got clicked!")
end
--> Remember! You cannot supply buttonClick(), that will only supply the result of the function
--> Make sure the button knows which function to call when it's clicked
button:onClick(buttonClick)
button:show() --> Make the button visible, so the user can click it
basalt.autoUpdate() --> Basalt#autoUpdate starts the event listener to detect user input
````
If you're like us and strive for succinct and beautiful code, here is a cleaner implementation of the code above:
````lua
local basalt = dofile("basalt.lua")
local mainFrame = basalt.createFrame("mainFrame"):show()
local button = mainFrame --> Basalt returns an instance of the object on most methods, to make use of "call-chaining"
:addButton("clickableButton") --> This is an example of call chaining
:setPosition(4,4)
:setText("Click me!")
:onClick(
function()
basalt.debug("I got clicked!")
end)
:show()
basalt.autoUpdate()
````

View File

@@ -1,23 +1,48 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html lang="en">
<head> <head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>Document</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="description" content="Description">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
<!-- <link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@4/lib/themes/vue.css">-->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/docsify-themeable@0/dist/css/theme-simple-dark.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/docsify-themeable@0/dist/css/theme-simple-dark.css">
<title>Basalt Docs</title> <style>
:root {
/* secondary: */
--theme-color: #16CC27;
--mono-hue: 120;
--mono-saturation: 1%;
--mono-shade3 : hsl(var(--mono-hue), var(--mono-saturation), 5%); /* #333333 */
--mono-shade2 : hsl(var(--mono-hue), var(--mono-saturation), 6%); /* #4d4d4d */
--mono-shade1 : hsl(var(--mono-hue), var(--mono-saturation), 7%);
--mono-base : hsl(var(--mono-hue), var(--mono-saturation), 20%); /* #808080 */
--mono-tint1 : hsl(var(--mono-hue), var(--mono-saturation), 25%); /* #b3b3b3 */
--mono-tint2 : hsl(var(--mono-hue), var(--mono-saturation), 30%); /* #e3e3e3 */
--mono-tint3 : hsl(var(--mono-hue), var(--mono-saturation), 35%);
--base-background-color: hsl(var(--mono-hue), var(--mono-saturation), 10%);
--sidebar-nav-pagelink-background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='7' height='11.2' viewBox='0 0 7 11.2'%3E%3Cpath d='M1.5 1.5l4 4.1 -4 4.1' stroke-width='1.5' stroke='%23575d5e' fill='none' stroke-linecap='square' stroke-linejoin='miter' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");
--sidebar-nav-pagelink-background-image--active: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11.2' height='7' viewBox='0 0 11.2 7'%3E%3Cpath d='M1.5 1.5l4.1 4 4.1-4' stroke-width='1.5' stroke='%23575d5e' fill='none' stroke-linecap='square' stroke-linejoin='miter' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");
--sidebar-nav-pagelink-background-image--collapse: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='7' height='11.2' viewBox='0 0 7 11.2'%3E%3Cpath d='M1.5 1.5l4 4.1 -4 4.1' stroke-width='1.5' stroke='%23575d5e' fill='none' stroke-linecap='square' stroke-linejoin='miter' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");
--sidebar-nav-pagelink-background-image--loaded: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11.2' height='7' viewBox='0 0 11.2 7'%3E%3Cpath d='M1.5 1.5l4.1 4 4.1-4' stroke-width='1.5' stroke='%23575d5e' fill='none' stroke-linecap='square' stroke-linejoin='miter' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");
</style>
</head> </head>
<body> <body>
<div id="app"></div> <div id="app"></div>
<script> <script>
window.$docsify = { window.$docsify = {
name: 'Basalt Docs', logo: '/_media/logo.png',
repo: 'https://github.com/Pyroxenium/Basalt', loadNavbar: true,
loadSidebar: true, loadSidebar: true,
auto2top: true, subMaxLevel: 2,
// logo: 'path to logo' homepage: 'Home.md',
}; name: 'Basalt',
repo: 'https://github.com/Pyroxenium/Basalt',
auto2top: true
}
</script> </script>
<!-- Docsify v4 -->
<script src="//cdn.jsdelivr.net/npm/docsify@4"></script> <script src="//cdn.jsdelivr.net/npm/docsify@4"></script>
<script src="https://cdn.jsdelivr.net/npm/docsify-themeable@0/dist/js/docsify-themeable.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/docsify-themeable@0/dist/js/docsify-themeable.min.js"></script>
</body> </body>

View File

@@ -1,5 +1,3 @@
# Animation
With animations you can create a beautiful experience for users while interacting with objects.<br> With animations you can create a beautiful experience for users while interacting with objects.<br>
For now the animation class is very basic, i will expand it in the future, but i have to say already now you can do almost everything you can imagine! For now the animation class is very basic, i will expand it in the future, but i have to say already now you can do almost everything you can imagine!

View File

@@ -1,5 +1,3 @@
# Basalt
Basalt is managing all the things. Basalt is managing all the things.
To start using Basalt you have to do the following line of code: To start using Basalt you have to do the following line of code:

View File

@@ -1,9 +1,7 @@
# Button
Buttons are objects, which execute function by clicking on them Buttons are objects, which execute function by clicking on them
The following list is only available to buttons: <br> The following list is only available to buttons: <br>
Remember button also inherits from [object](/objects/Object): Remember button also inherits from [object](https://github.com/NoryiE/basalt/wiki/Object):
## setText ## setText
Sets the displayed button text Sets the displayed button text
@@ -14,7 +12,7 @@ local aButton = mainFrame:addButton("myFirstButton"):setText("Click"):show() --
**Arguments:** string text<br> **Arguments:** string text<br>
**returns:** self<br> **returns:** self<br>
## Examples # Examples
Add a onClick event: Add a onClick event:
````lua ````lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
@@ -23,3 +21,4 @@ if(event=="mouse_click")and(button==1)then
basalt.debug("Left mousebutton got clicked!") basalt.debug("Left mousebutton got clicked!")
end end
end):show() end):show()
````

View File

@@ -1,9 +1,7 @@
# Checkbox
With checkbox, the user can set a bool to true or false With checkbox, the user can set a bool to true or false
Here are all possible functions available for checkbox:<be> Here are all possible functions available for checkbox:<be>
Remember checkbox inherits from [object](/objects/Object): Remember checkbox inherits from [object](https://github.com/NoryiE/NyoUI/wiki/Object):
Create a onChange event: Create a onChange event:
@@ -12,3 +10,4 @@ local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aCheckbox = mainFrame:addCheckbox("myFirstCheckbox"):onChange(function(self) basalt.debug("The value got changed into "..self:getValue()) end):show() local aCheckbox = mainFrame:addCheckbox("myFirstCheckbox"):onChange(function(self) basalt.debug("The value got changed into "..self:getValue()) end):show()
```` ````

View File

@@ -1,5 +1,3 @@
# Dropdown
Dropdowns are objects where you can create endless entrys the user can click on a button and it opens a "list" where the user can choose a entry Dropdowns are objects where you can create endless entrys the user can click on a button and it opens a "list" where the user can choose a entry
Here is a example of how to create a standard dropdown: Here is a example of how to create a standard dropdown:
@@ -10,7 +8,7 @@ local aDropdown = mainFrame:addDropdown("myFirstDropdown"):show()
```` ````
Here are all possible functions available for dropdowns: <br> Here are all possible functions available for dropdowns: <br>
Remember dropdown inherits from [object](/objects/Object): Remember dropdown inherits from [object](https://github.com/NoryiE/basalt/wiki/Object):
## addItem ## addItem
Adds a item to the dropdown Adds a item to the dropdown

View File

@@ -1,5 +1,3 @@
# Frames
<a href="https://i.imgur.com/aikc0K1.png"><img src="https://i.imgur.com/aikc0K1.png" height="500" /></a> <a href="https://i.imgur.com/aikc0K1.png"><img src="https://i.imgur.com/aikc0K1.png" height="500" /></a>
Frames are like containers, but are also normal objects. Frames are like containers, but are also normal objects.
@@ -7,153 +5,223 @@ In other words, you can add other objects _(even frames)_ to a frame; if the fra
all sub-objects _(if they are set as visible)_ are also visible. A better description will follow. all sub-objects _(if they are set as visible)_ are also visible. A better description will follow.
## basalt.createFrame ## basalt.createFrame
Creates a new non-parent frame - in most cases it is the first thing you need. Creates a new non-parent frame - in most cases it is the first thing you'll need.
#### Parameters:
1. `string` name (should be unique)
#### Returns:
1. `frame | nil` The frame created by createFrame, or `nil` if there is already a frame with the given name.
#### Usage:
* Create a frame with an id "myFirstFrame", stored in a variable named frame
````lua ````lua
local myFirstFrame = basalt.createFrame("myFirstFrame") local myFrame = basalt.createFrame("myFirstFrame")
```` ````
**Parameters:** <br>
1. string name (should be unique)<br>
**returns:** new frame object<br>
## addFrame ## addFrame
The same as basalt.createFrame, but it will have a parent frame Creates a child frame on the frame, the same as [basalt.createFrame](https://github.com/Pyroxenium/Basalt/wiki/Frame#basaltcreateframe) except the frames are given a parent-child relationship automatically
````lua
frame:addFrame("myFirstFrame") #### Parameters:
```` 1. `string` name (should be unique)
**Parameters:** string name (should be unique)<br>
**returns:** new frame object<br> #### Returns:
Example: 1. `frame | nil` The frame created by addFrame, or `nil` if there is already a child frame with the given name.<br>
#### Usage:
* Create a frame with id "myFirstFrame" then create a child of that frame, named "myFirstSubFrame"
````lua ````lua
local mainFrame = basalt.createFrame("myFirstFrame") local mainFrame = basalt.createFrame("myFirstFrame")
local aFrame = mainFrame:addFrame("myFirstSubFrame") local myFrame = mainFrame:addFrame("myFirstSubFrame")
```` ````
## setBar ## setBar
Changes the frame bar Sets the text, background, and foreground of the upper bar of the frame, accordingly.
#### Parameters:
1. `string` The text to set the bar to
2. `number` The background color
2. `number` The foreground color
#### Returns:
1. `frame` The frame being used
#### Usage:
* Set the title to "My first frame!", with a background of gray and a foreground of light gray.
````lua ````lua
frame:setBar("My first Frame!", colors.gray, colors.lightGray) frame:setBar("My first Frame!", colors.gray, colors.lightGray)
```` ````
**Parameters:** string text, number bgcolor, number fgcolor<br> * Store the frame, use the named frame variable after assigning.
**returns:** self<br>
Example:
````lua ````lua
local mainFrame = basalt.createFrame("myFirstFrame") local mainFrame = basalt.createFrame("myFirstFrame")
local aFrame = MainFrame:addFrame("myFirstSubFrame") local myFrame = MainFrame:addFrame("myFirstSubFrame")
aFrame:setBar("My first Frame!") myFrame:setBar("My first Frame!")
```` ````
or: * This abuses the call-chaining that Basalt uses.
````lua ````lua
local mainFrame = basalt.createFrame("myFirstFrame") local mainFrame = basalt.createFrame("myFirstFrame")
local aFrame = mainFrame:addFrame("myFirstSubFrame"):setBar("My first Frame!") local myFrame = mainFrame:addFrame("myFirstSubFrame"):setBar("My first Frame!")
```` ````
## setBarTextAlign ## setBarTextAlign
Sets the bar text alignment Sets the frame's bar-text alignment
#### Parameters:
1. `string` Can be supplied with "left", "center", or "right"
#### Returns:
1. `frame` The frame being used
#### Usage:
* Set the title of myFrame to "My first frame!", and align it to the right.
````lua ````lua
local mainFrame = basalt.createFrame("myFirstFrame"):setBar("My first Frame!"):setBarTextAlign("right") local mainFrame = myFrame:setBar("My first Frame!"):setBarTextAlign("right")
```` ````
**Parameters:** string value - ("left", "center", "right"))<br>
**returns:** self<br>
## showBar ## showBar
shows/hides the bar on top where you will see the title if its active Toggles the frame's upper bar
#### Parameters:
1. `boolean | nil` Whether the frame's bar is visible or if supplied `nil`, is automatically visible
#### Returns:
1. `frame` The frame being used
#### Usage:
* Sets myFrame to have a bar titled "Hello World!" and subsequently displays it.
````lua ````lua
local mainFrame = basalt.createFrame("myFirstFrame"):setBar("Hello World!"):showBar() local mainFrame = myFrame:setBar("Hello World!"):showBar()
```` ````
**Parameters:** bool visible (no Parameters = true)<br>
**returns:** self<br>
## isModifierActive -- DISABLED this function will work very soon ## ~~isModifierActive~~
returns true if user is currently holding a key down ### _Disabled, this function is a WIP_
Returns true if the user is currently holding the respective key down
#### Parameters:
1. `number | string` - Any os.queueEvent("key") key, or you can use the following strings: "shift", "ctrl", "alt"
#### Returns:
1. `boolean` - Whether the user is holding the key down
#### Usage:
* Checks if the "shift" modifier is active on the myFrame frame
````lua ````lua
local mainFrame = basalt.createFrame("myFirstFrame"):isModifierActive("shift") local isActive = myFrame:isModifierActive("shift")
```` ````
**Parameters:** int or string - int can be any os.queueEvent("key") key, or instead of int you can use the following strings: "shift", "ctrl", "alt"<br> * Creates a label, changing the text to "Shift is inactive oh no :(" and "Shift is active yay!", accordingly.
**returns:** boolean - if the user is holding the key down<br>
**Example:**
````lua ````lua
local mainFrame = basalt.createFrame("myFirstFrame"):setSize(20,8):show() local aLabel = myFrame:addLabel("myFirstLabel"):setText("Shift is inactive oh no :(")
local aLabel = mainFrame:addLabel("myFirstLabel"):setText("shift inactive") myFrame:addButton("myFirstButton"):setText("Click"):onClick(
mainFrame:addButton("myFirstButton"):setText("Click"):onClick(function() function()
if(mainFrame:isModifierActive("shift")then if myFrame:isModifierActive("shift") then
aLabel:setText("shift is active yay") aLabel:setText("Shift is active yay!")
else else
aLabel:setText("shift is not active ohno") aLabel:setText("Shift is inactive oh no :(")
end) end
end
)
```` ````
## getObject ## getObject
returns a children object Returns a child object of the frame
#### Parameters:
1. `string` The name of the child object
#### Returns:
1. `object | nil` The object with the supplied name, or `nil` if there is no object present with the given name
#### Usage:
* Adds a button with id "myFirstButton", then retrieves it again through the frame object
````lua ````lua
local mainFrame = basalt.createFrame("myFirstFrame") myFrame:addButton("myFirstButton")
mainFrame:addButton("myFirstButton") local aButton = myFrame:getObject("myFirstButton")
local aButton = mainFrame:getObject("myFirstButton")
```` ````
**Parameters:** string name (has to be a children)<br>
**returns:** any object<br>
## removeObject ## removeObject
removes the object Removes a child object from the frame
#### Parameters:
1. `string` The name of the child object
#### Returns:
1. `boolean` Whether the object with the given name was properly removed
#### Usage:
* Adds a button with the id "myFirstButton", then removes it with the aforementioned id
````lua ````lua
local mainFrame = basalt.createFrame("myFirstFrame") myFrame:addButton("myFirstButton")
mainFrame:addButton("myFirstButton") myFrame:removeObject("myFirstButton")
mainFrame:removeObject("myFirstButton")
```` ````
**Parameters:** string name (has to be a children)<br>
**returns:** any object<br>
## setFocusedObject ## setFocusedObject
changes the currently focused object Sets the currently focused object
#### Parameters:
1. `object` The child object to focus on
#### Returns:
1. `frame` The frame being used
#### Usage:
* Creates button with id "myFirstButton", sets the focused object to the previously mentioned button
````lua ````lua
local mainFrame = basalt.createFrame("myFirstFrame") local aButton = myFrame:addButton("myFirstButton")
local aButton = mainFrame:addButton("myFirstButton") myFrame:setFocusedObject(aButton)
mainFrame:setFocusedObject(aButton)
```` ````
**Parameters:** any object (has to be a children)<br>
**returns:** self<br>
## removeFocusedObject ## removeFocusedObject
removes the focus of the currently focused object Removes the focus of the supplied object
#### Parameters:
1. `object` The child object to remove focus from
#### Returns:
1. `frame` The frame being used
#### Usage:
* Creates a button with id "myFirstButton", then removes the focus from that button
````lua ````lua
local mainFrame = basalt.createFrame("myFirstFrame") local aButton = myFrame:addButton("myFirstButton")
local aButton = mainFrame:addButton("myFirstButton") myFrame:removeFocusedObject(aButton)
mainFrame:removeFocusedObject(aButton)
```` ````
**Parameters:** any object (has to be a children)<br>
**returns:** self<br>
## getFocusedObject ## getFocusedObject
gets the currently focused object Gets the currently focused object
#### Parameters:
#### Returns:
1. `object` The currently focused object
#### Usage:
* Gets the currently focused object from the frame, storing it in a variable
````lua ````lua
local mainFrame = basalt.createFrame("myFirstFrame") local focusedObject = myFrame:getFocusedObject()
local aButton = mainFrame:addButton("myFirstButton")
local focusedObject = mainFrame:getFocusedObject()
```` ````
**Parameters:** -<br>
**returns:** object<br>
## setMovable ## setMovable
Sets whether the frame can be moved. _In order to move the frame click and drag the upper bar of the frame_
## setMoveable #### Parameters:
##### _Deprecated in favor of setMovable_ 1. `boolean` Whether the object is movable
#### Returns:
sets if the frame should be moveable or not (to move the frame you need to drag it on the top bar) 1. `frame` The frame being used
#### Usage:
* Creates a frame with id "myFirstFrame" and makes it movable
````lua ````lua
local mainFrame = basalt.createFrame("myFirstFrame"):setMoveable(true) local myFrame = basalt.createFrame("myFirstFrame"):setMovable(true)
````
## ~~setMoveable~~
### _Deprecated in favor of setMovable_
Sets whether the frame can be moved. _In order to move the frame use the upper bar of the frame_
#### Parameters:
1. `boolean` Whether the object is movable
#### Returns:
1. `frame` The frame being used
#### Usage:
* Creates a frame with id "myFirstFrame" and makes it movable
````lua
local myFrame = basalt.createFrame("myFirstFrame"):setMoveable(true)
```` ````
**Parameters:** bool moveable<br>
**returns:** self<br>
## setOffset ## setOffset
sets the frame's coordinate offset, they will get added to their children objects. For example, if you use the scrollbar and you use its value to add a offset to a frame, you will get a scrollable frame. Sets the frame's coordinate offset. The frame's child objects will receive the frame's coordinate offset. For example, when using the scrollbar, if you use its value to add an offset to a frame, you will get a scrollable frame.
objects are also able to ignore the offset by using :ignoreOffset() (maybe your scrollbar if its a children of the frame should ignore offset) Objects are also able to ignore the offset by using :ignoreOffset() (For example, you may want to ignore the offset on the scrollbar itself)
The function can be supplied negative offsets
#### Parameters:
1. `number` The x direction offset (+/-)
2. `number` The y direction offset (+/-)
#### Returns:
1. `frame` The frame being used
#### Usage:
* Creates "myFirstFrame" with an x offset of 5 and a y offset of 3
````lua ````lua
local mainFrame = basalt.createFrame("myFirstFrame"):setOffset(5, 3) local myFrame = basalt.createFrame("myFirstFrame"):setOffset(5, 3)
````
* Creates "myFirstFrame" with an x offset of 5 and a y offset of -5 (Meaning if you added a button with y position 5, it would be at y position 0)
````lua
local myFrame = basalt.createFrame("myFirstFrame"):setOffset(5, -5)
```` ````
**Parameters:** number x, number y (offset in x direction and offset in y direction, also doesn't matter if its a negative value or positive<br>
**returns:** self<br>

View File

@@ -1,10 +1,8 @@
# Image
The image object is for adding more advanced backgrounds. The image object is for adding more advanced backgrounds.
It also provides a :shrink() function, where you can shrink the images to smaller ones. This functionallity is fully provided by the blittle library created by Bomb Bloke. I did not ask for permission to add it into the framework. If the creator wants me to remove the blittle part, just text me on discord! It also provides a :shrink() function, where you can shrink the images to smaller ones. This functionallity is fully provided by the blittle library created by Bomb Bloke. I did not ask for permission to add it into the framework. If the creator wants me to remove the blittle part, just text me on discord!
Here are all possible functions available for image:<be> Here are all possible functions available for image:<be>
Remember image inherits from [object](/objects/Object): Remember image inherits from [object](https://github.com/NoryiE/NyoUI/wiki/Object):
## loadImage ## loadImage
@@ -35,3 +33,4 @@ local aImage = mainFrame:addImage("myFirstImage"):loadBlittleImage("randomImage.
```` ````
**Arguments:** -<br> **Arguments:** -<br>
**returns:** self<br> **returns:** self<br>

View File

@@ -1,9 +1,7 @@
# Input
With input's you are able to create a object where the user can type something in.<br> With input's you are able to create a object where the user can type something in.<br>
Here are all possible functions available for inputs:<br> Here are all possible functions available for inputs:<br>
Remember input inherits from [object](/objects/Object): Remember input inherits from [object](https://github.com/NoryiE/NyoUI/wiki/Object):
## setInputType ## setInputType
changes the input type changes the input type

73
docs/objects/Installer.md Normal file
View File

@@ -0,0 +1,73 @@
This is just a script which helps you to install basalt.lua, if it's not already on the computer. Means, you create your program (which requires basalt) and add this on the top of your program. Now, everytime you execute your program it checks if basalt.lua exists or not. If not, it will download it first and then continue to execute your program.
## Visual Installer
This is a visual version, it asks the user if he wants to install basalt.lua (if not found)<br>
![](https://i.imgur.com/b4Ys7FB.png)
````lua
--Basalt configurated installer
local filePath = "basalt.lua" --here you can change the file path default: basalt.lua
if not(fs.exists(filePath))then
local w,h = term.getSize()
term.clear()
local _installerWindow = window.create(term.current(),w/2-8,h/2-3,18,6)
_installerWindow.setBackgroundColor(colors.gray)
_installerWindow.setTextColor(colors.black)
_installerWindow.write(" Basalt Installer ")
_installerWindow.setBackgroundColor(colors.lightGray)
for line=2,6,1 do
_installerWindow.setCursorPos(1,line)
if(line==3)then
_installerWindow.write(" No Basalt found! ")
elseif(line==4)then
_installerWindow.write(" Install it? ")
elseif(line==6)then
_installerWindow.setTextColor(colors.black)
_installerWindow.setBackgroundColor(colors.gray)
_installerWindow.write("Install")
_installerWindow.setBackgroundColor(colors.lightGray)
_installerWindow.write(string.rep(" ",5))
_installerWindow.setBackgroundColor(colors.red)
_installerWindow.write("Cancel")
else
_installerWindow.write(string.rep(" ",18))
end
end
_installerWindow.setVisible(true)
_installerWindow.redraw()
while(not(fs.exists(filePath))) do
local event, p1,p2,p3,p4 = os.pullEvent()
if(event=="mouse_click")then
if(p3==math.floor(h/2+2))and(p2>=w/2-8)and(p2<=w/2-2)then
shell.run("pastebin run ESs1mg7P")
_installerWindow.setVisible(false)
term.clear()
break
end
if(p3==h/2+2)and(p2<=w/2+9)and(p2>=w/2+4)then
_installerWindow.clear()
_installerWindow.setVisible(false)
term.setCursorPos(1,1)
term.clear()
return
end
end
end
term.setCursorPos(1,1)
term.clear()
end
local basalt = dofile(filePath) -- here you can change the variablename in any variablename you want default: basalt
------------------------------
````
## Basic Installer
Here is a very basic one which just installs basalt.lua if don't exist:
````lua
--Basalt configurated installer
local filePath = "basalt.lua" --here you can change the file path default: basalt.lua
if not(fs.exists(filePath))then
shell.run("pastebin run ESs1mg7P")
end
local basalt = dofile(filePath) -- here you can change the variablename in any variablename you want default: basalt
````

View File

@@ -1,11 +1,9 @@
# Label
With the Label object you are able to add some text. With the Label object you are able to add some text.
By default label's width is auto sizing based on the length of the text. If you change the size with setSize it will automatically stop autosizing the width. By default label's width is auto sizing based on the length of the text. If you change the size with setSize it will automatically stop autosizing the width.
Here are all possible functions available for labels.<br> Here are all possible functions available for labels.<br>
Remember label inherits from [object](/objects/Object): Remember label inherits from [object](https://github.com/NoryiE/NyoUI/wiki/Object):
## setText ## setText
sets the text which gets displayed. sets the text which gets displayed.
@@ -15,3 +13,22 @@ local aInput = mainFrame:addLabel("myFirstLabel"):setText("Hello lovely basalt c
```` ````
**arguments:** string text<br> **arguments:** string text<br>
**returns:** self<br> **returns:** self<br>
## setFontSize
sets the font size of that text.
````lua
local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aInput = mainFrame:addLabel("myFirstLabel"):setText("Hello"):setFontSize(2):show()
````
**arguments:** number size (1 = default, 2 = big, 3 = bigger, 4 = huge)<br>
**returns:** self<br>
## getFontSize
returns the fontsize
````lua
local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aInput = mainFrame:addLabel("myFirstLabel"):setText("Hello"):setFontSize(2):show()
basalt.debug(aInput:getFontSize()) -- returns 2
````
**arguments:** <br>
**returns:** number<br>

View File

@@ -1,5 +1,3 @@
# List
Lists are objects where you can create endless entrys and the user can choose one of them Lists are objects where you can create endless entrys and the user can choose one of them
Here is a example of how to create a standard list: Here is a example of how to create a standard list:
@@ -11,10 +9,10 @@ local aList = mainFrame:addList("myFirstList"):show()
This will create a default list with the size 8 width and 5 height on position 1 1 (relative to its parent frame), the default background is colors.lightGray, the default text color is colors.black and the default zIndex is 5. The default horizontal text align is "center", default symbol is ">" This will create a default list with the size 8 width and 5 height on position 1 1 (relative to its parent frame), the default background is colors.lightGray, the default text color is colors.black and the default zIndex is 5. The default horizontal text align is "center", default symbol is ">"
Here are all possible functions available for lists. Remember list inherit from [object](/objects/Object): Here are all possible functions available for lists. Remember list inherit from [object](https://github.com/NoryiE/basalt/wiki/Object):
## addItem ## addItem
Adds a item to the list Adds a item into the list
````lua ````lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()

View File

@@ -1,3 +1 @@
# Menubar
WIP WIP

View File

@@ -1,5 +1,3 @@
# Objects
This is the base class of all visual objects. This means, if you create a button, label, frame or something else visual (no timers, threads or animations) the following list can be used: This is the base class of all visual objects. This means, if you create a button, label, frame or something else visual (no timers, threads or animations) the following list can be used:
## show ## show

View File

@@ -1,11 +1,9 @@
# Pane
Panes are very simple sizeable background objects. Panes are very simple sizeable background objects.
The following list is only available to panes: <br> The following list is only available to panes: <br>
Remember pane also inherits from [object](/objects/Object): Remember pane also inherits from [object](https://github.com/NoryiE/basalt/wiki/Object):
Pane doesn't have any custom functionallity. If you want to change the color/position or size, just check out the [object](/objects/Object) wikipage. Pane doesn't have any custom functionallity. If you want to change the color/position or size, just check out the [object](https://github.com/NoryiE/basalt/wiki/Object) wikipage.
## Example: ## Example:

View File

@@ -1,9 +1,7 @@
# Program
With a program object you are able to open programs like shell or worm or any custom program you've made. There is only 1 thing you have to remember: the program needs at least one os.sleep() or coroutine.yield() somewhere. With a program object you are able to open programs like shell or worm or any custom program you've made. There is only 1 thing you have to remember: the program needs at least one os.sleep() or coroutine.yield() somewhere.
<br> <br>
Here is a list of all available functions for programs: <br> Here is a list of all available functions for programs: <br>
Remember program inherits from [object](/objects/Object): Remember program inherits from [object](https://github.com/NoryiE/NyoUI/wiki/Object):
## getStatus ## getStatus
returns the current status returns the current status
@@ -102,3 +100,4 @@ local aProgram = mainFrame:addProgram("myFirstProgram"):execute("rom/programs/sh
```` ````
**parameters:** table queuedEvents<br> **parameters:** table queuedEvents<br>
**returns:** self<br> **returns:** self<br>

View File

@@ -1,5 +1,3 @@
# Radio
Radios are objects where you can create endless entrys the user can click on a button and it opens a "list" where the user can choose a entry Radios are objects where you can create endless entrys the user can click on a button and it opens a "list" where the user can choose a entry
Here is a example of how to create a standard radio: Here is a example of how to create a standard radio:
@@ -10,7 +8,7 @@ local aRadio = mainFrame:addRadio("myFirstRadio"):show()
```` ````
Here are all possible functions available for radios: <br> Here are all possible functions available for radios: <br>
Remember radio inherits from [object](/objects/Object): Remember radio inherits from [object](https://github.com/NoryiE/basalt/wiki/Object):
## addItem ## addItem
Adds a item to the radio Adds a item to the radio

View File

@@ -1,5 +1,3 @@
# Scrollbar
Scrollbars are objects, the user can scroll vertically or horizontally, this can change the value.<br> Scrollbars are objects, the user can scroll vertically or horizontally, this can change the value.<br>
Here is a example of how to create a standard scrollbar: Here is a example of how to create a standard scrollbar:
@@ -7,10 +5,7 @@ Here is a example of how to create a standard scrollbar:
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aScrollbar = mainFrame:addScrollbar("myFirstScrollbar"):show() local aScrollbar = mainFrame:addScrollbar("myFirstScrollbar"):show()
```` ````
Here are all possible functions available for scrollbars. Remember scrollbar inherit from [object](https://github.com/NoryiE/Basalt/wiki/Object):
This will create a default label with a size 5 width and 1 height on position 1 1 (relative to its parent frame), the default background is colors.gray, the default text color is colors.black. the default bar type is vertical, the default symbol is " " and the default symbol color is colors.lightGray. The default zIndex is 5.
Here are all possible functions available for scrollbars. Remember scrollbar inherit from [object](/objects/Object):
## setSymbol ## setSymbol
Changes the symbol Changes the symbol
@@ -43,7 +38,7 @@ local aScrollbar = mainFrame:addScrollbar("myFirstScrollbar"):setBarType("horizo
**returns:** self<br> **returns:** self<br>
## setMaxValue ## setMaxValue
the default max value is always the width (if vertical) or height (if horizontal), if you change the max value the bar will always calculate the value based on its width or height - example: you set the max value to 100, the height is 10 and it is a vertical bar, this means if the bar is on top, the value is 10, if the bar goes one below, it is 20 and so on. the default max value is always the width (if horizontal) or height (if vertical), if you change the max value the bar will always calculate the value based on its width or height - example: you set the max value to 100, the height is 10 and it is a vertical bar, this means if the bar is on top, the value is 10, if the bar goes one below, it is 20 and so on.
````lua ````lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()

View File

@@ -1,9 +1,7 @@
# Slider
With sliders you can add a object where the user can change a number value.<br><br> With sliders you can add a object where the user can change a number value.<br><br>
Here are all possible functions available for sliders: <br> Here are all possible functions available for sliders: <br>
Remember slider also inherits from [object](/objects/Object) Remember slider also inherits from [object](https://github.com/NoryiE/Basalt/wiki/Object)
## setSymbol ## setSymbol
this will change the foreground symbol this will change the foreground symbol
@@ -40,3 +38,5 @@ local aSlider = mainFrame:addSlider("myFirstSlider"):setBarType("vertical"):show
```` ````
**parameters:** string value ("vertical", "horizontal"<br> **parameters:** string value ("vertical", "horizontal"<br>
**returns:** self<br> **returns:** self<br>

View File

@@ -1,5 +1,3 @@
# Textfield
Textfields are objects, where the user can write something on multiple lines. it act's like the default edit script (without coloring)<br> Textfields are objects, where the user can write something on multiple lines. it act's like the default edit script (without coloring)<br>
Here is a example of how to create a default textfield: Here is a example of how to create a default textfield:
@@ -10,7 +8,7 @@ local aTextfield = mainFrame:addTextfield("myFirstTextfield"):show()
This will create a default textfield with the size 10 width and 4 height on position 1 1 (relative to its parent frame), the default background is colors.gray, the default text color is colors.black and the default zIndex is 5. This will create a default textfield with the size 10 width and 4 height on position 1 1 (relative to its parent frame), the default background is colors.gray, the default text color is colors.black and the default zIndex is 5.
A list of all possible functions available for textfields. Remember textfield inherits from [object](/objects/Object): A list of all possible functions available for textfields. Remember textfield inherits from [object](https://github.com/NoryiE/NyoUI/wiki/Object):
## getLines ## getLines

View File

@@ -1,5 +1,3 @@
# Thread
Threads are "functions" you can execute simultaneously. Ofc the reality is, i am just using coroutine for that. But it works pretty good AND is very easy to use. Threads are "functions" you can execute simultaneously. Ofc the reality is, i am just using coroutine for that. But it works pretty good AND is very easy to use.
<br> <br>
Here is a list of all available functions for threads: <br> Here is a list of all available functions for threads: <br>

View File

@@ -1,5 +1,3 @@
# Timer
With timers you can call delayed functions. With timers you can call delayed functions.
<br> <br>
Here is a list of all available functions for timers: <br> Here is a list of all available functions for timers: <br>

View File

@@ -1,6 +1,4 @@
# Changing button colors Here I want to explain to you how you would create a button with the default color gray, and as long as the user is clicking on the button it will change its color to black (the default frame-background is lightGray).
Here i want to explain to you how you would create a button with the default color gray, and as long as the user is clicking on the button it will change its color to black (the default frame-background is lightGray).
To make this possible the button needs 1 onClick event, 1 onClickUp event and 1 onLoseFocus event. To make this possible the button needs 1 onClick event, 1 onClickUp event and 1 onLoseFocus event.
@@ -39,3 +37,5 @@ setupButtonColoring(button2)
basalt.autoUpdate() basalt.autoUpdate()
```` ````
Now you've got a function which sets your buttons up.

View File

@@ -1,8 +1,6 @@
# Executing your own logic
You question yourself how you can execute your own logic while basalt is also active? There are multiple ways of doing that: You question yourself how you can execute your own logic while basalt is also active? There are multiple ways of doing that:
## Number 1: ## Method 1:
Using parallel.waitForAll Using parallel.waitForAll
````lua ````lua
@@ -22,7 +20,7 @@ parallel.waitForAll(basalt.autoUpdate, yourCustomHandler) -- here it will handle
```` ````
You can read [here](http://www.computercraft.info/wiki/Parallel_(API)) what exactly parallel.waitForAll() does You can read [here](http://www.computercraft.info/wiki/Parallel_(API)) what exactly parallel.waitForAll() does
## Number 2: ## Method 2:
Using threads Using threads
````lua ````lua
@@ -41,7 +39,7 @@ end
thread:start(yourCustomHandler) -- this will create a coroutine and starts the coroutine, os.sleep does the rest, so you just have to call start once. thread:start(yourCustomHandler) -- this will create a coroutine and starts the coroutine, os.sleep does the rest, so you just have to call start once.
```` ````
## Number 3: ## Method 3:
Using timers Using timers
````lua ````lua
@@ -55,3 +53,4 @@ local function yourCustomHandler()
-- add your logic here -- add your logic here
end end
timer:onCall(yourCustomHandler):setTime(1, -1):start() -- this will call your function every second until you :cancel() the timer timer:onCall(yourCustomHandler):setTime(1, -1):start() -- this will call your function every second until you :cancel() the timer
````