This commit is contained in:
NoryiE
2025-02-14 13:40:48 +00:00
parent 346ded1c89
commit 4d99507f4f
16 changed files with 233 additions and 11 deletions

View File

@@ -16,8 +16,10 @@ The base class for all UI elements in Basalt
|---|---|---|
|[BaseElement.listenTo](#BaseElement.listenTo)|-|
|[BaseElement.new](#BaseElement.new)|table|
|[BaseElement:destroy](#BaseElement:destroy)|-|
|[BaseElement:dispatchEvent](#BaseElement:dispatchEvent)|boolean?|
|[BaseElement:fireEvent](#BaseElement:fireEvent)|table|
|[BaseElement:getBaseFrame](#BaseElement:getBaseFrame)|-|
|[BaseElement:handleEvent](#BaseElement:handleEvent)|boolean?|
|[BaseElement:init](#BaseElement:init)|table|
|[BaseElement:isType](#BaseElement:isType)|boolean|
@@ -52,6 +54,8 @@ Creates a new BaseElement instance
local element = BaseElement.new("myId", basalt)
```
## BaseElement:destroy()
## BaseElement:dispatchEvent(event)
Handles all events
@vararg any The arguments for the event
@@ -77,6 +81,8 @@ Triggers an event and calls all registered callbacks
element:fireEvent("mouse_click", 1, 2)
```
## BaseElement:getBaseFrame()
## BaseElement:handleEvent(event)
The default event handler for all events
@vararg any The arguments for the event

View File

@@ -11,14 +11,18 @@
|Method|Returns|Description|
|---|---|---|
|[BaseFrame.new](#BaseFrame.new)|-|
|[BaseFrame:blit](#BaseFrame:blit)|-|
|[BaseFrame:init](#BaseFrame:init)|-|
|[BaseFrame:multiBlit](#BaseFrame:multiBlit)|-|
|[BaseFrame:render](#BaseFrame:render)|-|
|[BaseFrame:setCursor](#BaseFrame:setCursor)|-|
|[BaseFrame:textBg](#BaseFrame:textBg)|-|
|[BaseFrame:textFg](#BaseFrame:textFg)|-|
## BaseFrame.new()
## BaseFrame:blit()
## BaseFrame:init()
## BaseFrame:multiBlit()
@@ -27,5 +31,7 @@
## BaseFrame:setCursor()
## BaseFrame:textBg()
## BaseFrame:textFg()

View File

@@ -0,0 +1,27 @@
# Checkbox : VisualElement
## Properties
|Property|Type|Default|Description|
|---|---|---|---|
|checked|boolean|Whether|checkbox is checked
|text|string|Label|text
|symbol|string|Check|symbol
## Functions
|Method|Returns|Description|
|---|---|---|
|[Checkbox.new](#Checkbox.new)|-|
|[Checkbox:init](#Checkbox:init)|-|
|[Checkbox:mouse_click](#Checkbox:mouse_click)|-|
|[Checkbox:render](#Checkbox:render)|-|
## Checkbox.new()
## Checkbox:init()
## Checkbox:mouse_click()
## Checkbox:render()

View File

@@ -6,6 +6,7 @@
|---|---|---|
|[Container.new](#Container.new)|-|
|[Container:addChild](#Container:addChild)|-|
|[Container:blit](#Container:blit)|-|
|[Container:char](#Container:char)|-|
|[Container:getChild](#Container:getChild)|-|
|[Container:handleEvent](#Container:handleEvent)|-|
@@ -29,6 +30,8 @@
## Container:addChild()
## Container:blit()
## Container:char()
## Container:getChild()

View File

@@ -6,7 +6,7 @@
|---|---|---|---|
|text|string|Input|- text to be displayed
|cursorPos|number|Input|- current cursor position
|viewOffset|number|Input|- offset für Text-Viewport
|viewOffset|number|Input|- offset of view
## Functions
@@ -18,14 +18,16 @@
|[Input:focus](#Input:focus)|-|
|[Input:init](#Input:init)|-|
|[Input:key](#Input:key)|-|
|[Input:mouse_click](#Input:mouse_click)|-|
|[Input:render](#Input:render)|-|
|[Input:updateViewport](#Input:updateViewport)|-|
## Input.new(id, basalt)
Neue Properties
## Input.new(props, basalt)
Creates a new Input instance
### Parameters
* `id` `string` The unique identifier for this element
* `props` `table` The properties to initialize the element with
* `basalt` `table` The basalt instance
### Returns
@@ -46,6 +48,8 @@ local element = Input.new("myId", basalt)
## Input:key()
## Input:mouse_click()
## Input:render()
## Input:updateViewport()

View File

@@ -14,11 +14,11 @@
|[Label:init](#Label:init)|-|
|[Label:render](#Label:render)|-|
## Label.new(name, basalt)
## Label.new(props, basalt)
Creates a new Label instance
### Parameters
* `name` `table` The properties to initialize the element with
* `props` `table` The properties to initialize the element with
* `basalt` `table` The basalt instance
### Returns

41
docs/references/List.md Normal file
View File

@@ -0,0 +1,41 @@
# List : VisualElement
## Properties
|Property|Type|Default|Description|
|---|---|---|---|
|items|table|List|of items to display
|selectedIndex|number|Currently|selected item index
|selectable|boolean|Whether|items can be selected
|offset|number|Scrolling|offset
|selectedColor|color|Color|for selected item
## Functions
|Method|Returns|Description|
|---|---|---|
|[List.new](#List.new)|-|
|[List:addItem](#List:addItem)|-|
|[List:clear](#List:clear)|-|
|[List:init](#List:init)|-|
|[List:mouse_click](#List:mouse_click)|-|
|[List:mouse_scroll](#List:mouse_scroll)|-|
|[List:removeItem](#List:removeItem)|-|
|[List:render](#List:render)|-|
## List.new()
## List:addItem()
## List:clear()
## List:init()
## List:mouse_click()
## List:mouse_scroll()
## List:removeItem()
## List:render()

View File

@@ -0,0 +1,56 @@
Rendering optimization (only render when screen changed)
Eventsystem improvement
Cursor is sometimes not visible on time
# Program : VisualElement
## Functions
|Method|Returns|Description|
|---|---|---|
|[BasaltProgram.new](#BasaltProgram.new)|-|
|[BasaltProgram:resize](#BasaltProgram:resize)|-|
|[BasaltProgram:resume](#BasaltProgram:resume)|-|
|[BasaltProgram:run](#BasaltProgram:run)|-|
|[BasaltProgram:stop](#BasaltProgram:stop)|-|
|[Program.new](#Program.new)|Program|
|[Program:dispatchEvent](#Program:dispatchEvent)|-|
|[Program:execute](#Program:execute)|-|
|[Program:focus](#Program:focus)|-|
|[Program:init](#Program:init)|-|
|[Program:render](#Program:render)|-|
## BasaltProgram.new()
## BasaltProgram:resize()
## BasaltProgram:resume()
## BasaltProgram:run()
## BasaltProgram:stop()
## Program.new(props, basalt)
Creates a new Program instance
### Parameters
* `props` `table` The properties to initialize the element with
* `basalt` `table` The basalt instance
### Returns
* `Program` `object` The newly created Program instance
### Usage
```lua
local element = Program.new("myId", basalt)
```
## Program:dispatchEvent()
## Program:execute()
## Program:focus()
## Program:init()
## Program:render()

View File

@@ -0,0 +1,24 @@
# ProgressBar : VisualElement
## Properties
|Property|Type|Default|Description|
|---|---|---|---|
|progress|number|Current|progress (0-100)
|showPercentage|boolean|Show|percentage text
|progressColor|color|Progress|bar color
## Functions
|Method|Returns|Description|
|---|---|---|
|[ProgressBar.new](#ProgressBar.new)|-|
|[ProgressBar:init](#ProgressBar:init)|-|
|[ProgressBar:render](#ProgressBar:render)|-|
## ProgressBar.new()
## ProgressBar:init()
## ProgressBar:render()

35
docs/references/Slider.md Normal file
View File

@@ -0,0 +1,35 @@
# Slider : VisualElement
## Properties
|Property|Type|Default|Description|
|---|---|---|---|
|step|number|1|Current step position (1 to width/height)
|max|number|100|Maximum value for value conversion
|horizontal|boolean|true|Whether the slider is horizontal
|barColor|color|color|Colors for the slider bar
|sliderColor|color|The|color of the slider handle
## Functions
|Method|Returns|Description|
|---|---|---|
|[Slider.new](#Slider.new)|-|
|[Slider:getValue](#Slider:getValue)|-|
|[Slider:init](#Slider:init)|-|
|[Slider:mouse_click](#Slider:mouse_click)|-|
|[Slider:mouse_scroll](#Slider:mouse_scroll)|-|
|[Slider:render](#Slider:render)|-|
## Slider.new()
## Slider:getValue()
## Slider:init()
## Slider:mouse_click()
## Slider:mouse_scroll()
## Slider:render()

View File

@@ -21,6 +21,7 @@
|Method|Returns|Description|
|---|---|---|
|[VisualElement.new](#VisualElement.new)|VisualElement|
|[VisualElement:blit](#VisualElement:blit)|-|
|[VisualElement:blur](#VisualElement:blur)|-|
|[VisualElement:focus](#VisualElement:focus)|-|
|[VisualElement:getAbsolutePosition](#VisualElement:getAbsolutePosition)|-|
@@ -33,6 +34,7 @@
|[VisualElement:multiBlit](#VisualElement:multiBlit)|-|
|[VisualElement:render](#VisualElement:render)|-|
|[VisualElement:setCursor](#VisualElement:setCursor)|-|
|[VisualElement:textBg](#VisualElement:textBg)|-|
|[VisualElement:textFg](#VisualElement:textFg)|-|
## VisualElement.new(props, basalt)
@@ -50,6 +52,8 @@ Creates a new VisualElement instance
local element = VisualElement.new("myId", basalt)
```
## VisualElement:blit()
## VisualElement:blur()
## VisualElement:focus()
@@ -120,6 +124,8 @@ element:render()
## VisualElement:setCursor()
## VisualElement:textBg()
## VisualElement:textFg(x, y, text, fg)
Draws a text character at the specified position, used in the rendering system

View File

@@ -1 +0,0 @@
Use xpcall with error handler

View File

@@ -4,6 +4,7 @@
|Method|Returns|Description|
|---|---|---|
|[PropertySystem.addSetterHook](#PropertySystem.addSetterHook)|-|
|[PropertySystem.blueprint](#PropertySystem.blueprint)|table|
|[PropertySystem.createFromBlueprint](#PropertySystem.createFromBlueprint)|-|
|[PropertySystem.defineProperty](#PropertySystem.defineProperty)|-|
@@ -12,8 +13,12 @@
|[PropertySystem:getPropertyConfig](#PropertySystem:getPropertyConfig)|-|
|[PropertySystem:instanceProperty](#PropertySystem:instanceProperty)|-|
|[PropertySystem:observe](#PropertySystem:observe)|-|
|[PropertySystem:removeAllObservers](#PropertySystem:removeAllObservers)|-|
|[PropertySystem:removeObserver](#PropertySystem:removeObserver)|-|
|[PropertySystem:removeProperty](#PropertySystem:removeProperty)|-|
## PropertySystem.addSetterHook()
## PropertySystem.blueprint(elementClass)
Creates a blueprint of an element class with all its properties
@@ -37,5 +42,9 @@ Creates a blueprint of an element class with all its properties
## PropertySystem:observe()
## PropertySystem:removeAllObservers()
## PropertySystem:removeObserver()
## PropertySystem:removeProperty()

View File

@@ -1,4 +0,0 @@
## BaseElement:setReactive()
## BaseElement:setReactiveProperty()

View File

@@ -6,6 +6,8 @@
## Render:blit()
## Render:blit()
## Render:clear()
## Render:clearArea()
@@ -19,7 +21,6 @@
## Render:multiBlit()
## Render:rectOverlaps()
Hilfsfunktionen für Rectangle-Management
## Render:render()
@@ -27,5 +28,7 @@ Hilfsfunktionen für Rectangle-Management
## Render:text()
## Render:textBg()
## Render:textFg()

7
docs/references/theme.md Normal file
View File

@@ -0,0 +1,7 @@
Has to be reworked
## BaseElement:applyTheme()
## Container.setup()
## Theme.registerTheme()