1.7 stuff

The master branch was reverted to 1.7 because it was very unstable (bugs and stuff that wasn't mentioned on the documentation page yet) - features will come back with 2.0

- fixed debug window
- fixed flexbox not sending drag events to it's children

- small docs updates for 1.7
- removed the examples because the are outdated
This commit is contained in:
Robert Jelic
2024-03-13 09:57:07 +01:00
parent 33753f6d8f
commit 8168fa4465
75 changed files with 2839 additions and 2844 deletions

View File

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

View File

@@ -37,5 +37,4 @@
- [Timer](objects/Timer.md)
- Guides
- [Introduction to Basalt](guides/introduction.md)
- [Dynamic Values](guides/dynamicvalues.md)
- [XML](guides/xml.md)

View File

@@ -21,7 +21,7 @@ You are now able to access the following list of methods:
|[getVersion](objects/Basalt/getVersion.md)|Returns the Basalt version
|[isKeyDown](objects/Basalt/isKeyDown.md)|Returns if the key is held down
|[log](objects/Basalt/log.md)|Writes something into the log file
|[memory](objects/Basalt/log.md)|Returns the current memory usage of Basalt
|[memory](objects/Basalt/memory.md)|Returns the current memory usage of Basalt
|[onEvent](objects/Basalt/onEvent.md)|Event listener
|[removeFrame](objects/Basalt/removeFrame.md)|Removes a previously created base frame
|[schedule](objects/Basalt/schedule.md)|Schedules a new task
@@ -29,7 +29,7 @@ You are now able to access the following list of methods:
|[setTheme](objects/Basalt/setTheme.md)|Changes the base theme of basalt
|[setMouseDragThrottle](objects/Basalt/setMouseDragThrottle.md)|Changes the mouse drag throttle amount
|[setMouseMoveThrottle](objects/Basalt/setMouseMoveThrottle.md)|CraftOS-PC: Changes the mouse move throttle amount
|[setRenderingThrottle](objects/Basalt/setMouseMoveThrottle.md)|Sets the rendering throttle amount
|[setRenderingThrottle](objects/Basalt/setRenderingThrottle.md)|Sets the rendering throttle amount
|[setVariable](objects/Basalt/setVariable.md)|Sets a variable which you can access via XML
|[stopUpdate / stop](objects/Basalt/stopUpdate.md)|Stops the currently active event and draw listener
|[update](objects/Basalt/update.md)|Starts the event and draw listener once

View File

@@ -11,8 +11,7 @@ Sets the frame's offset, this offset is beeing used to move all children object'
### Returns
1. `number` x position
2. `number` y position
1. `object` The object in use
### Usage

View File

@@ -1,6 +1,6 @@
The Checkbox object is derived from the VisualObject class and allows users to set a boolean value to true or false by clicking on it. Checkboxes are commonly used in forms and settings to enable or disable specific options.
The Checkbox object is derived from the ChangeableObject class and allows users to set a boolean value to true or false by clicking on it. Checkboxes are commonly used in forms and settings to enable or disable specific options.
In addition to the Object and VisualObject methods, checkboxes also have the following method:
In addition to the Object, VisualObject and ChangeableObject methods, checkboxes also have the following method:
| | |
|---|---|

View File

@@ -6,7 +6,7 @@ Sets the specified object as "important" within the container. This means the ob
### Parameters
1. `string` The object to set as important
1. `string|object` The object ID or object to set as important
### Returns

View File

@@ -1,4 +1,4 @@
## setFocusedObject
## updateZIndex
### Description

View File

@@ -0,0 +1,27 @@
## blit
### Description
Sets or modifies text, foreground and background color.
### Parameters
1. `string` text - The text to be placed at the specified position
1. `string` foreground - A string representing the foreground color
1. `string` background - A string representing the background color
2. `number` x - The x-coordinate of the text position.
3. `number` y - The y-coordinate of the text position.
### Returns
1. `object` The object in use
### Usage
* Creates a new image object, adds a frame, and sets the text in the active frame.
```lua
local mainFrame = basalt.createFrame()
local aImage = mainFrame:addImage():addFrame():blit("Hello", "fffff", "00000", 1, 1)
```

View File

@@ -0,0 +1,9 @@
## getOffset
### Description
Returns the current offset
### Returns
1. `number` the offset

View File

@@ -0,0 +1,9 @@
## getTextOffset
### Description
Returns the current text offset
### Returns
1. `number` the text offset

View File

@@ -0,0 +1,22 @@
## setOffset
### Description
Sets the input offset
### Parameters
1. `number` offset - The offset you want it to be
### Returns
1. `object` The object in use
### Usage
* Creates a default input and changes the offset to 2
```lua
local mainFrame = basalt.createFrame()
local aInput = mainFrame:addInput():setOffset(2)
```

View File

@@ -0,0 +1,22 @@
## setTextOffset
### Description
Sets the input text offset
### Parameters
1. `number` text offset - The offset you want it to be
### Returns
1. `object` The object in use
### Usage
* Creates a default input and changes the text offset to 2
```lua
local mainFrame = basalt.createFrame()
local aInput = mainFrame:addInput():setTextOffset(2)
```

View File

@@ -2,7 +2,6 @@ A Label object is used to display simple text on the interface.
In addition to the Object and VisualObject methods, Label objects have the following methods:
[Object](objects/Object.md) methods also apply for labels.
| | |
|---|---|

View File

@@ -12,13 +12,13 @@ In addition to the Object and VisualObject methods, Textfield objects have the f
|[getTextCursor](objects/Textfield/getTextCursor.md)|Returns the current text cursor position
|[addKeywords](objects/Textfield/addKeywords.md)|Adds syntax highlighting keywords
|[addRule](objects/Textfield/addRule.md)|Adds a custom syntax highlighting rule
|[editRule](objects/Textfield/addRule.md)|Edits an existing syntax highlighting rule
|[removeRule](objects/Textfield/addRule.md)|Removes an existing syntax highlighting rule
|[getOffset](objects/Textfield/addRule.md)|Returns the current offset inside the Textfield
|[setOffset](objects/Textfield/addRule.md)|Changes the offset inside the Textfield
|[clear](objects/Textfield/addRule.md)|Clears the Textfield content
|[setSelection](objects/Textfield/addRule.md)|Sets the selection color (text color and background color)
|[getSelection](objects/Textfield/addRule.md)|Returns the current selection color
|[editRule](objects/Textfield/editRule.md)|Edits an existing syntax highlighting rule
|[removeRule](objects/Textfield/removeRule.md)|Removes an existing syntax highlighting rule
|[getOffset](objects/Textfield/getOffset.md)|Returns the current offset inside the Textfield
|[setOffset](objects/Textfield/setOffset.md)|Changes the offset inside the Textfield
|[clear](objects/Textfield/clear.md)|Clears the Textfield content
|[setSelection](objects/Textfield/setSelection.md)|Sets the selection color (text color and background color)
|[getSelection](objects/Textfield/getSelection.md)|Returns the current selection color
In version 1.7, Textfields now allow the user to select text with the mouse. The setSelection method is used to choose the text color and background color for selected text.

View File

@@ -0,0 +1,23 @@
## clear
### Description
Clears the entire content of a Textfield object, removing all text currently displayed within it.
### Returns
1. `object ` The object in use
### Usage
```lua
local basalt = require("basalt")
local mainFrame = basalt.createFrame()
local aTextfield = mainFrame:addTextfield()
-- Assume there is some content in the Textfield
aTextfield:clear() -- Clear the entire content
basalt.autoUpdate()
```

View File

@@ -0,0 +1,30 @@
## addRule
### Description
Edits an existing rule for special coloring in a Textfield object. This allows you to modify the color and/or background color applied to text matching a specific pattern.
### Parameteres
1. `string` pattern - The Lua pattern used to match the text you want to edit the coloring for.
2. `number|color` textColor - The new color you want to apply to the text matching the pattern.
3. `number|color` backgroundColor - (optional) The new background color you want to apply to the text matching the pattern.
### Returns
1. `object` The object in use
### Usage
* Modifies the color of all numbers in a Textfield object.
```lua
local basalt = require("basalt")
local mainFrame = basalt.createFrame()
local aTextfield = mainFrame:addTextfield()
aTextfield:editRule("%d", colors.red) -- Changes the color of numbers to red
basalt.autoUpdate()
```

View File

@@ -0,0 +1,26 @@
## getOffset
### Description
Retrieves the current offset within a Textfield object, providing information about the current viewable portion of the text.
### Returns
1. `number` The current horizontal offset within the Textfield.
2. `number` The current vertical offset within the Textfield.
### Usage
```lua
local basalt = require("basalt")
local mainFrame = basalt.createFrame()
local aTextfield = mainFrame:addTextfield()
-- Assume the Textfield has been scrolled previously
local xOffset, yOffset = aTextfield:getOffset()
basalt.debug("Horizontal Offset: "..xOffset)
basalt.debug("Vertical Offset: "..yOffset)
basalt.autoUpdate()
```

View File

@@ -0,0 +1,10 @@
## setSelection
### Description
Returns the colors when selecting a text.
### Returns
1. `number|color` foreground color - The text color.
2. `number|color` background color - ´The background color.

View File

@@ -0,0 +1,28 @@
## removeRule
### Description
Removes an existing rule for special coloring in a Textfield object. This allows you to remove the coloring applied to text matching a specific pattern.
### Parameteres
1. `string` pattern - The Lua pattern used to match the text for which the rule was applied.
### Returns
1. `object` The object in use
### Usage
* Removes the rule for coloring all numbers in a Textfield object
```lua
local basalt = require("basalt")
local mainFrame = basalt.createFrame()
local aTextfield = mainFrame:addTextfield()
aTextfield:removeRule("%d") -- Removes the rule for coloring numbers
basalt.autoUpdate()
```

View File

@@ -0,0 +1,28 @@
## setOffset
### Description
Sets the offset within a Textfield object, allowing you to adjust the viewable portion of the text.
### Parameteres
1. `number` xOffset - The horizontal offset to set within the Textfield
2. `number` yOffset - The vertical offset to set within the Textfield
### Returns
1. `object` The object in use
### Usage
```lua
local basalt = require("basalt")
local mainFrame = basalt.createFrame()
local aTextfield = mainFrame:addTextfield()
-- Scroll 10 units down vertically
aTextfield:setOffset(0, 10)
basalt.autoUpdate()
```

View File

@@ -0,0 +1,27 @@
## setSelection
### Description
Changes the color when selecting text.
### Parameteres
1. `number|color` foreground color - The text color.
2. `number|color` background color - ´The background color.
### Returns
1. `object` The object in use
### Usage
```lua
local basalt = require("basalt")
local mainFrame = basalt.createFrame()
local aTextfield = mainFrame:addTextfield()
aTextfield:setSelection(colors.white, colors.blue)
basalt.autoUpdate()
```