deploy: 2b8a0764bc
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
# BaseElement
|
# BaseElement : PropertySystem
|
||||||
The base class for all UI elements in Basalt
|
The base class for all UI elements in Basalt
|
||||||
|
|
||||||
## Properties
|
## Properties
|
||||||
|
|||||||
@@ -1,3 +1,14 @@
|
|||||||
|
# BaseFrame : Container
|
||||||
|
|
||||||
|
## Functions
|
||||||
|
|
||||||
|
|Method|Returns|Description|
|
||||||
|
|---|---|---|
|
||||||
|
|[BaseFrame.new](#BaseFrame.new)|-|
|
||||||
|
|[BaseFrame:multiBlit](#BaseFrame:multiBlit)|-|
|
||||||
|
|[BaseFrame:render](#BaseFrame:render)|-|
|
||||||
|
|[BaseFrame:textFg](#BaseFrame:textFg)|-|
|
||||||
|
|
||||||
## BaseFrame.new()
|
## BaseFrame.new()
|
||||||
@diagnostic disable-next-line: duplicate-set-field
|
@diagnostic disable-next-line: duplicate-set-field
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,13 @@
|
|||||||
|
# Button : VisualElement
|
||||||
|
|
||||||
|
## Functions
|
||||||
|
|
||||||
|
|Method|Returns|Description|
|
||||||
|
|---|---|---|
|
||||||
|
|[Button.new](#Button.new)|-|
|
||||||
|
|[Button:render](#Button:render)|-|
|
||||||
|
|
||||||
|
@event mouse_click The event that is triggered when the button is clicked
|
||||||
## Button.new()
|
## Button.new()
|
||||||
@diagnostic disable-next-line: duplicate-set-field
|
@diagnostic disable-next-line: duplicate-set-field
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,23 @@
|
|||||||
|
# Container : VisualElement
|
||||||
|
|
||||||
|
## Functions
|
||||||
|
|
||||||
|
|Method|Returns|Description|
|
||||||
|
|---|---|---|
|
||||||
|
|[Container.new](#Container.new)|-|
|
||||||
|
|[Container:addChild](#Container:addChild)|-|
|
||||||
|
|[Container:handleEvent](#Container:handleEvent)|-|
|
||||||
|
|[Container:multiBlit](#Container:multiBlit)|-|
|
||||||
|
|[Container:registerChildEvent](#Container:registerChildEvent)|-|
|
||||||
|
|[Container:registerChildrenEvents](#Container:registerChildrenEvents)|-|
|
||||||
|
|[Container:removeChild](#Container:removeChild)|-|
|
||||||
|
|[Container:removeChildrenEvents](#Container:removeChildrenEvents)|-|
|
||||||
|
|[Container:render](#Container:render)|-|
|
||||||
|
|[Container:sortChildren](#Container:sortChildren)|-|
|
||||||
|
|[Container:sortChildrenEvents](#Container:sortChildrenEvents)|-|
|
||||||
|
|[Container:textFg](#Container:textFg)|-|
|
||||||
|
|[Container:unregisterChildEvent](#Container:unregisterChildEvent)|-|
|
||||||
|
|
||||||
## Container.new()
|
## Container.new()
|
||||||
@diagnostic disable-next-line: duplicate-set-field
|
@diagnostic disable-next-line: duplicate-set-field
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,10 @@
|
|||||||
## Frame.new()
|
# Frame : Container
|
||||||
@diagnostic disable-next-line: duplicate-set-field
|
|
||||||
|
## Functions
|
||||||
|
|
||||||
|
|Method|Returns|Description|
|
||||||
|
|---|---|---|
|
||||||
|
|[Frame.new](#Frame.new)|-|
|
||||||
|
|
||||||
|
## Frame.new()
|
||||||
|
|
||||||
|
|||||||
@@ -1,37 +1,115 @@
|
|||||||
## VisualElement.new()
|
@alias color number
|
||||||
@diagnostic disable-next-line: duplicate-set-field
|
# VisualElement : BaseElement
|
||||||
|
|
||||||
|
## Properties
|
||||||
|
|
||||||
|
|Property|Type|Default|Description|
|
||||||
|
|---|---|---|---|
|
||||||
|
|x|number|1|x position of the element
|
||||||
|
|y|number|1|y position of the element
|
||||||
|
|z|number|1|z position of the element
|
||||||
|
|width|number|1|width of the element
|
||||||
|
|height|number|1|height of the element
|
||||||
|
|background|color|black|background color of the element
|
||||||
|
|foreground|color|white|foreground color of the element
|
||||||
|
|clicked|boolean|false|element is currently clicked
|
||||||
|
|
||||||
|
## Functions
|
||||||
|
|
||||||
|
|Method|Returns|Description|
|
||||||
|
|---|---|---|
|
||||||
|
|[VisualElement.new](#VisualElement.new)|VisualElement|
|
||||||
|
|[VisualElement:getAbsolutePosition](#VisualElement:getAbsolutePosition)|-|
|
||||||
|
|[VisualElement:getRelativePosition](#VisualElement:getRelativePosition)|number,|
|
||||||
|
|[VisualElement:handleEvent](#VisualElement:handleEvent)|-|
|
||||||
|
|[VisualElement:isInBounds](#VisualElement:isInBounds)|boolean|
|
||||||
|
|[VisualElement:mouse_click](#VisualElement:mouse_click)|boolean|
|
||||||
|
|[VisualElement:mouse_release](#VisualElement:mouse_release)|-|
|
||||||
|
|[VisualElement:mouse_up](#VisualElement:mouse_up)|-|
|
||||||
|
|[VisualElement:multiBlit](#VisualElement:multiBlit)|-|
|
||||||
|
|[VisualElement:render](#VisualElement:render)|-|
|
||||||
|
|[VisualElement:textFg](#VisualElement:textFg)|-|
|
||||||
|
|
||||||
|
## VisualElement.new(id, basalt)
|
||||||
|
Creates a new VisualElement instance
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
* `id` `string` The unique identifier for this element
|
||||||
|
* `basalt` `table` The basalt instance
|
||||||
|
|
||||||
|
### Returns
|
||||||
|
* `VisualElement` `object` The newly created VisualElement instance
|
||||||
|
|
||||||
|
### Usage
|
||||||
|
```lua
|
||||||
|
local element = VisualElement.new("myId", basalt)
|
||||||
|
```
|
||||||
|
|
||||||
## VisualElement:getAbsolutePosition(x?, y?)
|
## VisualElement:getAbsolutePosition(x?, y?)
|
||||||
Returns the absolute position of the element or the given coordinates.
|
Returns the absolute position of the element or the given coordinates.
|
||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
* `x` *(optional)* `number` -- x position
|
* `x` *(optional)* `number` x position
|
||||||
* `y` *(optional)* `number` -- y position
|
* `y` *(optional)* `number` y position
|
||||||
|
|
||||||
## VisualElement:getRelativePosition(x?, y?)
|
## VisualElement:getRelativePosition(x?, y?)
|
||||||
Returns the relative position of the element or the given coordinates.
|
Returns the relative position of the element or the given coordinates.
|
||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
* `x` *(optional)* `number` -- x position
|
* `x` *(optional)* `number` x position
|
||||||
* `y` *(optional)* `number` -- y position
|
* `y` *(optional)* `number` y position
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
* `nil` `nil` nil
|
* `nil` `nil` nil
|
||||||
|
|
||||||
## VisualElement:handleEvent()
|
## VisualElement:handleEvent()
|
||||||
|
|
||||||
## VisualElement:isInBounds()
|
## VisualElement:isInBounds(x, y)
|
||||||
|
Checks if the specified coordinates are within the bounds of the element
|
||||||
|
|
||||||
## VisualElement:mouse_click()
|
### Parameters
|
||||||
|
* `x` `number` The x position to check
|
||||||
|
* `y` `number` The y position to check
|
||||||
|
|
||||||
|
### Returns
|
||||||
|
* `boolean` `isInBounds` Whether the coordinates are within the bounds of the element
|
||||||
|
|
||||||
|
## VisualElement:mouse_click(button, x, y)
|
||||||
|
Handles a mouse click event
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
* `button` `number` The button that was clicked
|
||||||
|
* `x` `number` The x position of the click
|
||||||
|
* `y` `number` The y position of the click
|
||||||
|
|
||||||
|
### Returns
|
||||||
|
* `boolean` `clicked` Whether the element was clicked
|
||||||
|
|
||||||
## VisualElement:mouse_release()
|
## VisualElement:mouse_release()
|
||||||
|
|
||||||
## VisualElement:mouse_up()
|
## VisualElement:mouse_up()
|
||||||
|
|
||||||
## VisualElement:multiBlit()
|
## 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()
|
||||||
@diagnostic disable-next-line: duplicate-set-field
|
@diagnostic disable-next-line: duplicate-set-field
|
||||||
|
|
||||||
## VisualElement:textFg()
|
## VisualElement:textFg(x, y, text, fg)
|
||||||
|
Draws a text character at the specified position, used in the rendering system
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
* `x` `number` The x position to draw
|
||||||
|
* `y` `number` The y position to draw
|
||||||
|
* `text` `string` The text char to draw
|
||||||
|
* `fg` `color` The foreground color
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ What this code does is it loads basalt into the project, and you can access it b
|
|||||||
|[basalt.update](#basalt.update)|-|
|
|[basalt.update](#basalt.update)|-|
|
||||||
|
|
||||||
## basalt.create(type, id?)
|
## basalt.create(type, id?)
|
||||||
Creates and returns a new UI element of the specified type
|
Creates and returns a new UI element of the specified type.
|
||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
* `type` `string` The type of element to create (e.g. "Button", "Label", "BaseFrame")
|
* `type` `string` The type of element to create (e.g. "Button", "Label", "BaseFrame")
|
||||||
@@ -84,11 +84,11 @@ Removes a scheduled update
|
|||||||
basalt.removeSchedule(scheduleId)
|
basalt.removeSchedule(scheduleId)
|
||||||
```
|
```
|
||||||
|
|
||||||
## basalt.run(isActive)
|
## basalt.run(isActive?)
|
||||||
Starts the Basalt runtime
|
Starts the Basalt runtime
|
||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
* `isActive` `boolean` Whether to start active (default: true)
|
* `isActive` *(optional)* `boolean` Whether to start active (default: true)
|
||||||
|
|
||||||
### Usage
|
### Usage
|
||||||
```lua
|
```lua
|
||||||
|
|||||||
@@ -1,3 +1,14 @@
|
|||||||
|
# PropertySystem
|
||||||
|
|
||||||
|
## Functions
|
||||||
|
|
||||||
|
|Method|Returns|Description|
|
||||||
|
|---|---|---|
|
||||||
|
|[PropertySystem.defineProperty](#PropertySystem.defineProperty)|-|
|
||||||
|
|[PropertySystem:__init](#PropertySystem:__init)|-|
|
||||||
|
|[PropertySystem:_updateProperty](#PropertySystem:_updateProperty)|-|
|
||||||
|
|[PropertySystem:observe](#PropertySystem:observe)|-|
|
||||||
|
|
||||||
## PropertySystem.defineProperty()
|
## PropertySystem.defineProperty()
|
||||||
|
|
||||||
## PropertySystem:__init()
|
## PropertySystem:__init()
|
||||||
|
|||||||
Reference in New Issue
Block a user