diff --git a/docs/references/elements/BaseElement.md b/docs/references/elements/BaseElement.md index 6d0cd1a..068a618 100644 --- a/docs/references/elements/BaseElement.md +++ b/docs/references/elements/BaseElement.md @@ -14,6 +14,8 @@ The base class for all UI elements in Basalt. This class provides basic properti |Method|Returns|Description| |---|---|---| +|[BaseElement.defineEvent](#BaseElement.defineEvent)|-| +|[BaseElement.registerEventCallback](#BaseElement.registerEventCallback)|-| |[BaseElement:destroy](#BaseElement:destroy)|-|Destroys the element and cleans up all references |[BaseElement:fireEvent](#BaseElement:fireEvent)|table|Triggers an event and calls all registered callbacks |[BaseElement:getBaseFrame](#BaseElement:getBaseFrame)|table|Returns the base frame of the element @@ -33,6 +35,12 @@ The base class for all UI elements in Basalt. This class provides basic properti |[BaseElement:init](#BaseElement:init)|table|Initializes the BaseElement instance |[BaseElement:postInit](#BaseElement:postInit)|table|Post initialization +## BaseElement.defineEvent() +Registers a new event listener for the element (on class level) + +## BaseElement.registerEventCallback() +Registers a new event callback for the element (on class level) + ## BaseElement:destroy() Destroys the element and cleans up all references diff --git a/docs/references/elements/Image.md b/docs/references/elements/Image.md index 0bd67c1..ae7b431 100644 --- a/docs/references/elements/Image.md +++ b/docs/references/elements/Image.md @@ -1,6 +1,6 @@ # Image : VisualElement -This is the Image element class which can be used to display bimg format images. -The bimg format is a universal ComputerCraft image format. +This is the Image element class which can be used to display bimg formatted images. +Bimg is a universal ComputerCraft image format. See: https://github.com/SkyTheCodeMaster/bimg ## Properties @@ -24,21 +24,21 @@ See: https://github.com/SkyTheCodeMaster/bimg |Method|Returns|Description| |---|---|---| |[Image:addFrame](#Image:addFrame)|Image|Adds a new frame to the image -|[Image:getBg](#Image:getBg)|-| -|[Image:getFg](#Image:getFg)|-| +|[Image:getBg](#Image:getBg)|string|Gets the background color at the specified position +|[Image:getFg](#Image:getFg)|string|Gets the foreground color at the specified position |[Image:getFrame](#Image:getFrame)|table|Gets the specified frame |[Image:getImageSize](#Image:getImageSize)|number|Gets the size of the image -|[Image:getMetadata](#Image:getMetadata)|-| +|[Image:getMetadata](#Image:getMetadata)|table|Gets the metadata of the image |[Image:getPixelData](#Image:getPixelData)|number?|Gets pixel information at position -|[Image:getText](#Image:getText)|-| +|[Image:getText](#Image:getText)|string|Gets the text at the specified position |[Image:nextFrame](#Image:nextFrame)|Image|Advances to the next frame in the animation |[Image:resizeImage](#Image:resizeImage)|Image|Resizes the image to the specified width and height |[Image:setBg](#Image:setBg)|Image|Sets the background color at the specified position |[Image:setFg](#Image:setFg)|Image|Sets the foreground color at the specified position -|[Image:setMetadata](#Image:setMetadata)|-| +|[Image:setMetadata](#Image:setMetadata)|Image|Sets the metadata of the image |[Image:setPixel](#Image:setPixel)|Image|Sets the pixel at the specified position |[Image:setText](#Image:setText)|Image|Sets the text at the specified position -|[Image:updateFrame](#Image:updateFrame)|-| +|[Image:updateFrame](#Image:updateFrame)|Image|Updates the specified frame with the provided data ## Protected Functions @@ -54,9 +54,27 @@ Adds a new frame to the image ### Returns * `Image` `self` The Image instance -## Image:getBg() +## Image:getBg(x, y, length) +Gets the background color at the specified position -## Image:getFg() +### Parameters +* `x` `number` The x position +* `y` `number` The y position +* `length` `number` The length of the background color pattern to get + +### Returns +* `string` `bg` The background color pattern + +## Image:getFg(x, y, length) +Gets the foreground color at the specified position + +### Parameters +* `x` `number` The x position +* `y` `number` The y position +* `length` `number` The length of the foreground color pattern to get + +### Returns +* `string` `fg` The foreground color pattern ## Image:getFrame(frameIndex) Gets the specified frame @@ -75,6 +93,10 @@ Gets the size of the image * `number` `height` The height of the image ## Image:getMetadata() +Gets the metadata of the image + +### Returns +* `table` `metadata` The metadata of the image ## Image:getPixelData(x, y) Gets pixel information at position @@ -88,7 +110,16 @@ Gets pixel information at position * `number?` `bg` Background color * `string?` `char` Character at position -## Image:getText() +## Image:getText(x, y, length) +Gets the text at the specified position + +### Parameters +* `x` `number` The x position +* `y` `number` The y position +* `length` `number` The length of the text to get + +### Returns +* `string` `text` The text at the specified position ## Image:nextFrame() Advances to the next frame in the animation @@ -128,7 +159,15 @@ Sets the foreground color at the specified position ### Returns * `Image` `self` The Image instance -## Image:setMetadata() +## Image:setMetadata(key, value) +Sets the metadata of the image + +### Parameters +* `key` `string` The key of the metadata to set +* `value` `string` The value of the metadata to set + +### Returns +* `Image` `self` The Image instance ## Image:setPixel(x, y, char, fg, bg) Sets the pixel at the specified position @@ -154,6 +193,14 @@ Sets the text at the specified position ### Returns * `Image` `self` The Image instance -## Image:updateFrame() +## Image:updateFrame(frameIndex, frame) +Updates the specified frame with the provided data + +### Parameters +* `frameIndex` `number` The index of the frame to update +* `frame` `table` The new frame data + +### Returns +* `Image` `self` The Image instance diff --git a/docs/references/elements/VisualElement.md b/docs/references/elements/VisualElement.md index ef3c275..d29ae90 100644 --- a/docs/references/elements/VisualElement.md +++ b/docs/references/elements/VisualElement.md @@ -32,7 +32,7 @@ and provides core functionality for positioning, sizing, colors, and rendering. |Event|Parameters|Description| |---|---|---| -|onClick|`button, x, y`|Fired on mouse click| +|onClick|`button string, x number, y number`|Fired on mouse click| |onMouseUp|`button, x, y`|Fired on mouse button release| |onRelease|`button, x, y`|Fired when mouse leaves while clicked| |onDrag|`button, x, y`|Fired when mouse moves while clicked|