deploy: cf49f69612
This commit is contained in:
@@ -19,7 +19,7 @@ The base class for all UI elements in Basalt
|
|||||||
|[BaseElement:destroy](#BaseElement:destroy)|-|
|
|[BaseElement:destroy](#BaseElement:destroy)|-|
|
||||||
|[BaseElement:dispatchEvent](#BaseElement:dispatchEvent)|boolean?|
|
|[BaseElement:dispatchEvent](#BaseElement:dispatchEvent)|boolean?|
|
||||||
|[BaseElement:fireEvent](#BaseElement:fireEvent)|table|
|
|[BaseElement:fireEvent](#BaseElement:fireEvent)|table|
|
||||||
|[BaseElement:getBaseFrame](#BaseElement:getBaseFrame)|-|
|
|[BaseElement:getBaseFrame](#BaseElement:getBaseFrame)|table|
|
||||||
|[BaseElement:handleEvent](#BaseElement:handleEvent)|boolean?|
|
|[BaseElement:handleEvent](#BaseElement:handleEvent)|boolean?|
|
||||||
|[BaseElement:init](#BaseElement:init)|table|
|
|[BaseElement:init](#BaseElement:init)|table|
|
||||||
|[BaseElement:isType](#BaseElement:isType)|boolean|
|
|[BaseElement:isType](#BaseElement:isType)|boolean|
|
||||||
@@ -56,6 +56,12 @@ local element = BaseElement.new("myId", basalt)
|
|||||||
```
|
```
|
||||||
|
|
||||||
## BaseElement:destroy()
|
## BaseElement:destroy()
|
||||||
|
Destroys the element and cleans up all references
|
||||||
|
|
||||||
|
### Usage
|
||||||
|
```lua
|
||||||
|
element:destroy()
|
||||||
|
```
|
||||||
|
|
||||||
## BaseElement:dispatchEvent(event)
|
## BaseElement:dispatchEvent(event)
|
||||||
Handles all events
|
Handles all events
|
||||||
@@ -83,6 +89,10 @@ element:fireEvent("mouse_click", 1, 2)
|
|||||||
```
|
```
|
||||||
|
|
||||||
## BaseElement:getBaseFrame()
|
## BaseElement:getBaseFrame()
|
||||||
|
Returns the base frame of the element
|
||||||
|
|
||||||
|
### Returns
|
||||||
|
* `table` `BaseFrame` The base frame of the element
|
||||||
|
|
||||||
## BaseElement:handleEvent(event)
|
## BaseElement:handleEvent(event)
|
||||||
The default event handler for all events
|
The default event handler for all events
|
||||||
@@ -129,7 +139,7 @@ element:listenEvent("mouse_click", true)
|
|||||||
```
|
```
|
||||||
|
|
||||||
## BaseElement:postInit()
|
## BaseElement:postInit()
|
||||||
Post initialization hook
|
Post initialization
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
* `table` `self` The BaseElement instance
|
* `table` `self` The BaseElement instance
|
||||||
|
|||||||
@@ -6,6 +6,11 @@
|
|||||||
|---|---|---|---|
|
|---|---|---|---|
|
||||||
|text|string|Button|Button text
|
|text|string|Button|Button text
|
||||||
|
|
||||||
|
## Events
|
||||||
|
|
||||||
|
|Event|Parameters|Description|
|
||||||
|
|---|---|---|
|
||||||
|
|
||||||
## Functions
|
## Functions
|
||||||
|
|
||||||
|Method|Returns|Description|
|
|Method|Returns|Description|
|
||||||
@@ -14,7 +19,6 @@
|
|||||||
|[Button:init](#Button:init)|-|
|
|[Button:init](#Button:init)|-|
|
||||||
|[Button:render](#Button:render)|-|
|
|[Button:render](#Button:render)|-|
|
||||||
|
|
||||||
@event mouse_click The event that is triggered when the button is clicked
|
|
||||||
## Button.new()
|
## Button.new()
|
||||||
Creates a new Button instance
|
Creates a new Button instance
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
|[Container:blit](#Container:blit)|Container|
|
|[Container:blit](#Container:blit)|Container|
|
||||||
|[Container:char](#Container:char)|boolean|
|
|[Container:char](#Container:char)|boolean|
|
||||||
|[Container:clear](#Container:clear)|Container|
|
|[Container:clear](#Container:clear)|Container|
|
||||||
|
|[Container:destroy](#Container:destroy)|-|
|
||||||
|[Container:getChild](#Container:getChild)|Container?|
|
|[Container:getChild](#Container:getChild)|Container?|
|
||||||
|[Container:handleEvent](#Container:handleEvent)|boolean|
|
|[Container:handleEvent](#Container:handleEvent)|boolean|
|
||||||
|[Container:init](#Container:init)|-|
|
|[Container:init](#Container:init)|-|
|
||||||
@@ -84,6 +85,8 @@ Clears the container
|
|||||||
### Returns
|
### Returns
|
||||||
* `Container` `self` The container instance
|
* `Container` `self` The container instance
|
||||||
|
|
||||||
|
## Container:destroy()
|
||||||
|
|
||||||
## Container:getChild(path)
|
## Container:getChild(path)
|
||||||
Removes a child from the container
|
Removes a child from the container
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
@alias color number
|
|
||||||
# VisualElement : BaseElement
|
# VisualElement : BaseElement
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
@@ -17,6 +16,28 @@
|
|||||||
|focused|boolean|false|whether the element is focused
|
|focused|boolean|false|whether the element is focused
|
||||||
|visible|boolean|true|whether the element is visible
|
|visible|boolean|true|whether the element is visible
|
||||||
|
|
||||||
|
## Combined Properties
|
||||||
|
|
||||||
|
|Name|Properties|Description|
|
||||||
|
|---|---|---|
|
||||||
|
|position|{x|y}|Position of the element
|
||||||
|
|size|{width|height}|Size of the element
|
||||||
|
|color|{foreground|background}|Color of the element
|
||||||
|
|
||||||
|
## Events
|
||||||
|
|
||||||
|
|Event|Parameters|Description|
|
||||||
|
|---|---|---|
|
||||||
|
|onMouseClick|`button number, x number, y number`|Fired when the element is clicked|
|
||||||
|
|onMouseUp|`button number, x number, y number`|Fired when the mouse is released|
|
||||||
|
|onMouseRelease|`button number, x number, y number`|Fired when the mouse is released|
|
||||||
|
|onMouseDrag|`button number, x number, y number`|Fired when the mouse is dragged|
|
||||||
|
|onFocus|`-`|Fired when the element is focused|
|
||||||
|
|onBlur|`-`|Fired when the element is blurred|
|
||||||
|
|onKey|`key number, code number, isRepeat boolean`|Fired when a key is pressed|
|
||||||
|
|onKeyUp|`key number, code number`|Fired when a key is released|
|
||||||
|
|onChar|`char string`|Fired when a key is pressed|
|
||||||
|
|
||||||
## Functions
|
## Functions
|
||||||
|
|
||||||
|Method|Returns|Description|
|
|Method|Returns|Description|
|
||||||
@@ -32,15 +53,11 @@
|
|||||||
|[VisualElement:mouse_click](#VisualElement:mouse_click)|boolean|
|
|[VisualElement:mouse_click](#VisualElement:mouse_click)|boolean|
|
||||||
|[VisualElement:mouse_release](#VisualElement:mouse_release)|boolean|
|
|[VisualElement:mouse_release](#VisualElement:mouse_release)|boolean|
|
||||||
|[VisualElement:mouse_up](#VisualElement:mouse_up)|boolean|
|
|[VisualElement:mouse_up](#VisualElement:mouse_up)|boolean|
|
||||||
|[VisualElement:multiBlit](#VisualElement:multiBlit)|-|
|
|
||||||
|[VisualElement:render](#VisualElement:render)|-|
|
|[VisualElement:render](#VisualElement:render)|-|
|
||||||
|[VisualElement:setCursor](#VisualElement:setCursor)|-|
|
|[VisualElement:setCursor](#VisualElement:setCursor)|-|
|
||||||
|[VisualElement:textBg](#VisualElement:textBg)|-|
|
|[VisualElement:textBg](#VisualElement:textBg)|-|
|
||||||
|[VisualElement:textFg](#VisualElement:textFg)|-|
|
|[VisualElement:textFg](#VisualElement:textFg)|-|
|
||||||
|
|
||||||
@combinedProperty position x y
|
|
||||||
@combinedProperty size width height
|
|
||||||
@combinedProperty color foreground background
|
|
||||||
## VisualElement.new(props, basalt)
|
## VisualElement.new(props, basalt)
|
||||||
Creates a new VisualElement instance
|
Creates a new VisualElement instance
|
||||||
|
|
||||||
@@ -135,26 +152,9 @@ Handles a mouse up event
|
|||||||
### Returns
|
### Returns
|
||||||
* `boolean` `release` Whether the element was released on the element
|
* `boolean` `release` Whether the element was released on the element
|
||||||
|
|
||||||
## VisualElement:multiBlit(x, y, width, height, text, fg, bg)
|
|
||||||
Draws a text character/fg/bg at the specified position with a certain size, used in the rendering system
|
|
||||||
|
|
||||||
### Parameters
|
|
||||||
* `x` `number` The x position to draw
|
|
||||||
* `y` `number` The y position to draw
|
|
||||||
* `width` `number` The width of the element
|
|
||||||
* `height` `number` The height of the element
|
|
||||||
* `text` `string` The text char to draw
|
|
||||||
* `fg` `color` The foreground color
|
|
||||||
* `bg` `color` The background color
|
|
||||||
|
|
||||||
## VisualElement:render()
|
## VisualElement:render()
|
||||||
Renders the element
|
Renders the element
|
||||||
|
|
||||||
### Usage
|
|
||||||
```lua
|
|
||||||
element:render()
|
|
||||||
```
|
|
||||||
|
|
||||||
## VisualElement:setCursor(x, y, blink)
|
## VisualElement:setCursor(x, y, blink)
|
||||||
Sets the cursor position
|
Sets the cursor position
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,31 @@
|
|||||||
Log levels
|
# Log
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
|Field|Type|Description|
|
||||||
|
|---|---|---|
|
||||||
|
|
||||||
|
## Functions
|
||||||
|
|
||||||
|
|Method|Returns|Description|
|
||||||
|
|---|---|---|
|
||||||
|
|[Log.error](#Log.error)|-|
|
||||||
|
|[Log.setEnabled](#Log.setEnabled)|-|
|
||||||
|
|[Log.setLogToFile](#Log.setLogToFile)|-|
|
||||||
|
|
||||||
## Log.error()
|
## Log.error()
|
||||||
|
Sends a debug message to the logger.
|
||||||
|
@vararg string The message to log
|
||||||
|
Sends an info message to the logger.
|
||||||
|
@vararg string The message to log
|
||||||
|
Sends a warning message to the logger.
|
||||||
|
@vararg string The message to log
|
||||||
|
Sends an error message to the logger.
|
||||||
|
@vararg string The message to log
|
||||||
|
|
||||||
## Log.setEnabled()
|
## Log.setEnabled()
|
||||||
|
sets if the logger should log
|
||||||
|
|
||||||
## Log.setLogToFile()
|
## Log.setLogToFile()
|
||||||
|
Sets if the logger should log to a file.
|
||||||
|
|
||||||
|
|||||||
@@ -1,30 +1,35 @@
|
|||||||
# Basalt
|
|
||||||
This is the UI Manager and the starting point for your project. The following functions allow you to influence the default behavior of Basalt.
|
This is the UI Manager and the starting point for your project. The following functions allow you to influence the default behavior of Basalt.
|
||||||
|
|
||||||
Before you can access Basalt, you need to add the following code on top of your file:
|
Before you can access Basalt, you need to add the following code on top of your file:
|
||||||
|
|
||||||
### Usage
|
|
||||||
```lua
|
|
||||||
local basalt = require("basalt")
|
|
||||||
```
|
|
||||||
|
|
||||||
What this code does is it loads basalt into the project, and you can access it by using the variable defined as "basalt".
|
What this code does is it loads basalt into the project, and you can access it by using the variable defined as "basalt".
|
||||||
|
# Basalt
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
|Field|Type|Description|
|
||||||
|
|---|---|---|
|
||||||
|
|traceback|`boolean`|Whether to show a traceback on errors|
|
||||||
|
|_events|`table`|A table of events and their callbacks|
|
||||||
|
|_schedule|`function[]`|A table of scheduled functions|
|
||||||
|
|_plugins|`table`|A table of plugins|
|
||||||
|
|LOGGER|`Log`|The logger instance|
|
||||||
|
|path|`string`|The path to the Basalt library|
|
||||||
|
|
||||||
## Functions
|
## Functions
|
||||||
|
|
||||||
|Method|Returns|Description|
|
|Method|Returns|Description|
|
||||||
|---|---|---|
|
|---|---|---|
|
||||||
|[basalt.create](#basalt.create)|table|Creates a new UI element
|
|[basalt.create](#basalt.create)|table|Creates a new UI element
|
||||||
|[basalt.createFrame](#basalt.createFrame)|table|
|
|[basalt.createFrame](#basalt.createFrame)|table|Creates a new BaseFrame
|
||||||
|[basalt.getAPI](#basalt.getAPI)|-|
|
|[basalt.getAPI](#basalt.getAPI)|table|Returns a Plugin API
|
||||||
|[basalt.getElementManager](#basalt.getElementManager)|table|
|
|[basalt.getElementManager](#basalt.getElementManager)|table|Returns the element manager
|
||||||
|[basalt.getMainFrame](#basalt.getMainFrame)|BaseFrame|
|
|[basalt.getMainFrame](#basalt.getMainFrame)|BaseFrame|Gets or creates the main frame
|
||||||
|[basalt.removeSchedule](#basalt.removeSchedule)|-|
|
|[basalt.removeSchedule](#basalt.removeSchedule)|-|Removes a scheduled update
|
||||||
|[basalt.run](#basalt.run)|-|
|
|[basalt.run](#basalt.run)|-|Starts the Basalt runtime
|
||||||
|[basalt.scheduleUpdate](#basalt.scheduleUpdate)|number|
|
|[basalt.scheduleUpdate](#basalt.scheduleUpdate)|number|Schedules a function to be updated
|
||||||
|[basalt.setActiveFrame](#basalt.setActiveFrame)|-|
|
|[basalt.setActiveFrame](#basalt.setActiveFrame)|-|Sets the active frame
|
||||||
|[basalt.stop](#basalt.stop)|-|
|
|[basalt.stop](#basalt.stop)|-|Stops the Basalt runtime
|
||||||
|[basalt.update](#basalt.update)|-|
|
|[basalt.update](#basalt.update)|-|Updates all scheduled functions
|
||||||
|
|
||||||
## basalt.create(type, properties?)
|
## basalt.create(type, properties?)
|
||||||
Creates and returns a new UI element of the specified type.
|
Creates and returns a new UI element of the specified type.
|
||||||
@@ -42,7 +47,7 @@ local button = basalt.create("Button")
|
|||||||
```
|
```
|
||||||
|
|
||||||
## basalt.createFrame()
|
## basalt.createFrame()
|
||||||
Creates and returns a new frame
|
Creates and returns a new BaseFrame
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
* `table` `BaseFrame` The created frame instance
|
* `table` `BaseFrame` The created frame instance
|
||||||
@@ -52,7 +57,14 @@ Creates and returns a new frame
|
|||||||
local mainFrame = basalt.createFrame()
|
local mainFrame = basalt.createFrame()
|
||||||
```
|
```
|
||||||
|
|
||||||
## basalt.getAPI()
|
## basalt.getAPI(name)
|
||||||
|
Returns a Plugin API
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
* `name` `string` The name of the plugin
|
||||||
|
|
||||||
|
### Returns
|
||||||
|
* `table` `Plugin` The plugin API
|
||||||
|
|
||||||
## basalt.getElementManager()
|
## basalt.getElementManager()
|
||||||
Returns the element manager instance
|
Returns the element manager instance
|
||||||
|
|||||||
Reference in New Issue
Block a user