From a20835f68e85285f643e3a437232daafe79646c5 Mon Sep 17 00:00:00 2001 From: ascpial Date: Fri, 13 Sep 2024 18:43:18 +0200 Subject: [PATCH 1/3] Update docs --- docs/index.html | 515 ++++++++++++++++++++++++------------------------ 1 file changed, 258 insertions(+), 257 deletions(-) diff --git a/docs/index.html b/docs/index.html index 15615c0..5c9fa0f 100644 --- a/docs/index.html +++ b/docs/index.html @@ -44,7 +44,7 @@

Modules

Module PrimeUI

-

+

A collection of UI component primitives for ComputerCraft.

@@ -52,7 +52,7 @@

Functions

- + @@ -79,7 +79,7 @@

Functions

- + @@ -91,10 +91,18 @@

Functions

+ + + + + + + + @@ -132,7 +140,7 @@

Functions

- + @@ -142,6 +150,10 @@

Functions

+ + + +
addTask (func)Adds a task to run in the main loop.
resolve (...) Draws a thin border around a screen region.
button (win, x, y, text, action, fgColor, bgColor, clickedColor)button (win, x, y, text, action, fgColor, bgColor, clickedColor, periphName) Creates a clickable button on screen with text.
Creates a list of entries with toggleable check boxes.
clickRegion (win, x, y, width, height, action, periphName)Creates a clickable region on screen without any content.
drawImage (win, x, y, data, index, setPalette) Draws a BIMG-formatted image to the screen.
drawNFT (win, x, y, data)Draws a NFT-formatted image to the screen.
drawText (win, text, resizeToFit, fgColor, bgColor) Draws a block of text inside a window with word wrapping, optionally resizing the window to fit.
selectionBox (win, x, y, width, height, entries, action, selectChangeAction, fgColor, bgColor)Creates a list of entries that can each be selected with the Enter key.Creates a list of entries that can each be selected.
textBox (win, x, y, width, height, text, fgColor, bgColor) timeout (time, action) Runs a function or action after the specified time period, with optional canceling.
verticalLine (win, x, y, height, right, fgColor, bgColor)Draws a vertical line at a position with the specified height.

@@ -156,14 +168,13 @@

Functions

addTask (func)
- Adds a task to run in the main loop. +

Parameters:

  • func - function - The function to run, usually an `os.pullEvent` loop + function The function to run, usually an `os.pullEvent` loop
@@ -218,8 +229,7 @@

Parameters:

Parameters:

  • win - window - |nil The window to set as the active window + window|nil The window to set as the active window
@@ -239,27 +249,22 @@

Parameters:

Parameters:

  • win - window - The window to check + window The window to check
  • x - number - The relative X position of the point + number The relative X position of the point
  • y - number - The relative Y position of the point + number The relative Y position of the point

Returns:

  1. - number - The absolute X position of the window
  2. + number x The absolute X position of the window
  3. - number - The absolute Y position of the window
  4. + number y The absolute Y position of the window
@@ -278,8 +283,7 @@

Returns:

Returns:

    - any - ... The result of the coroutine that exited + any ... The result of the coroutine that exited
@@ -297,32 +301,25 @@

Returns:

Parameters:

  • win - window - The window to draw on + window The window to draw on
  • x - number - The X coordinate of the inside of the box + number The X coordinate of the inside of the box
  • y - number - The Y coordinate of the inside of the box + number The Y coordinate of the inside of the box
  • width - number - The width of the inner box + number The width of the inner box
  • height - number - The height of the inner box + number The height of the inner box
  • fgColor - color - |nil The color of the border (defaults to white) + color|nil The color of the border (defaults to white)
  • bgColor - color - |nil The color of the background (defaults to black) + color|nil The color of the background (defaults to black)
@@ -333,7 +330,7 @@

Parameters:

- button (win, x, y, text, action, fgColor, bgColor, clickedColor) + button (win, x, y, text, action, fgColor, bgColor, clickedColor, periphName)
Creates a clickable button on screen with text. @@ -342,36 +339,31 @@

Parameters:

Parameters:

  • win - window - The window to draw on + window The window to draw on
  • x - number - The X position of the button + number The X position of the button
  • y - number - The Y position of the button + number The Y position of the button
  • text - string - The text to draw on the button + string The text to draw on the button
  • action - function - |string A function to call when clicked, or a string to send with a `run` event + function|string A function to call when clicked, or a string to send with a `run` event
  • fgColor - color - |nil The color of the button text (defaults to white) + color|nil The color of the button text (defaults to white)
  • bgColor - color - |nil The color of the button (defaults to light gray) + color|nil The color of the button (defaults to light gray)
  • clickedColor - color - |nil The color of the button when clicked (defaults to gray) + color|nil The color of the button when clicked (defaults to gray) +
  • +
  • periphName + string|nil The name of the monitor peripheral, or nil (set if you're using a monitor - events will be filtered to that monitor)
@@ -391,32 +383,25 @@

Parameters:

Parameters:

  • win - window - The window to draw on + window The window to draw on
  • x - number - The X position of the left side of the box + number The X position of the left side of the box
  • y - number - The Y position of the box + number The Y position of the box
  • width - number - The width of the box to draw in + number The width of the box to draw in
  • text - string - The text to draw + string The text to draw
  • fgColor - color - |nil The color of the text (defaults to white) + color|nil The color of the text (defaults to white)
  • bgColor - color - |nil The color of the background (defaults to black) + color|nil The color of the background (defaults to black)
@@ -436,40 +421,69 @@

Parameters:

Parameters:

  • win - window - The window to draw on + window The window to draw on
  • x - number - The X coordinate of the inside of the box + number The X coordinate of the inside of the box
  • y - number - The Y coordinate of the inside of the box + number The Y coordinate of the inside of the box
  • width - number - The width of the inner box + number The width of the inner box
  • height - number - The height of the inner box + number The height of the inner box
  • selections - table - A list of entries to show, where the value is whether the item is pre-selected (or `"R"` for required/forced selected) + table A list of entries to show, where the value is whether the item is pre-selected (or `"R"` for required/forced selected)
  • action - function - |string|nil A function or `run` event that's called when a selection is made + function|string|nil A function or `run` event that's called when a selection is made
  • fgColor - color - |nil The color of the text (defaults to white) + color|nil The color of the text (defaults to white)
  • bgColor - color - |nil The color of the background (defaults to black) + color|nil The color of the background (defaults to black) +
  • +
+ + + + + +
+
+ + clickRegion (win, x, y, width, height, action, periphName) +
+
+ Creates a clickable region on screen without any content. + + +

Parameters:

+
    +
  • win + window The window to draw on +
  • +
  • x + number The X position of the button +
  • +
  • y + number The Y position of the button +
  • +
  • width + number The width of the inner box +
  • +
  • height + number The height of the inner box +
  • +
  • action + function|string A function to call when clicked, or a string to send with a `run` event +
  • +
  • periphName + string|nil The name of the monitor peripheral, or nil (set if you're using a monitor - events will be filtered to that monitor)
@@ -491,28 +505,51 @@

Parameters:

Parameters:

  • win - window - The window to draw on + window The window to draw on
  • x - number - The X position of the top left corner of the image + number The X position of the top left corner of the image
  • y - number - The Y position of the top left corner of the image + number The Y position of the top left corner of the image
  • data - string - |table The path to the image to load, or the image data itself + string|table The path to the image to load, or the image data itself
  • index - number - |nil The index of the frame to draw (defaults to 1) + number|nil The index of the frame to draw (defaults to 1)
  • setPalette - boolean - |nil Whether to set the palette if the image contains one (defaults to true) + boolean|nil Whether to set the palette if the image contains one (defaults to true) +
  • +
+ + + + + +
+
+ + drawNFT (win, x, y, data) +
+
+ Draws a NFT-formatted image to the screen. + + +

Parameters:

+
    +
  • win + window The window to draw on +
  • +
  • x + number The X position of the top left corner of the image +
  • +
  • y + number The Y position of the top left corner of the image +
  • +
  • data + string|table The path to the image to load, or the image data itself
@@ -532,32 +569,26 @@

Parameters:

Parameters:

  • win - window - The window to draw in + window The window to draw in
  • text - string - The text to draw + string The text to draw
  • resizeToFit - boolean - |nil Whether to resize the window to fit the text (defaults to false). This is useful for scroll boxes. + boolean|nil Whether to resize the window to fit the text (defaults to false). This is useful for scroll boxes.
  • fgColor - color - |nil The color of the text (defaults to white) + color|nil The color of the text (defaults to white)
  • bgColor - color - |nil The color of the background (defaults to black) + color|nil The color of the background (defaults to black)

Returns:

    - number - The total number of lines drawn + number lines The total number of lines drawn
@@ -575,28 +606,22 @@

Returns:

Parameters:

  • win - window - The window to draw on + window The window to draw on
  • x - number - The X position of the left side of the line + number The X position of the left side of the line
  • y - number - The Y position of the line + number The Y position of the line
  • width - number - The width/length of the line + number The width/length of the line
  • fgColor - color - |nil The color of the line (defaults to white) + color|nil The color of the line (defaults to white)
  • bgColor - color - |nil The color of the background (defaults to black) + color|nil The color of the background (defaults to black)
@@ -616,48 +641,37 @@

Parameters:

Parameters:

  • win - window - The window to draw on + window The window to draw on
  • x - number - The X position of the left side of the box + number The X position of the left side of the box
  • y - number - The Y position of the box + number The Y position of the box
  • width - number - The width/length of the box + number The width/length of the box
  • action - function - |string A function or `run` event to call when the enter key is pressed + function|string A function or `run` event to call when the enter key is pressed
  • fgColor - color - |nil The color of the text (defaults to white) + color|nil The color of the text (defaults to white)
  • bgColor - color - |nil The color of the background (defaults to black) + color|nil The color of the background (defaults to black)
  • replacement - string - |nil A character to replace typed characters with + string|nil A character to replace typed characters with
  • history - string - []|nil A list of previous entries to provide + string[]|nil A list of previous entries to provide
  • completion - function - |nil A function to call to provide completion + function|nil A function to call to provide completion
  • default - string - |nil A string to return if the box is empty + string|nil A string to return if the box is empty
@@ -679,20 +693,17 @@

Parameters:

Parameters:

  • time - number - The amount of time to wait for each time, in seconds + number The amount of time to wait for each time, in seconds
  • action - function - |string The function to call when the timer completes, or a `run` event to send + function|string The function to call when the timer completes, or a `run` event to send

Returns:

    - function - A function to cancel the timer + function cancel A function to cancel the timer
@@ -710,12 +721,10 @@

Returns:

Parameters:

  • key - key - The key to trigger on, from `keys.*` + key The key to trigger on, from `keys.*`
  • action - function - |string A function to call when clicked, or a string to use as a key for a `run` return event + function|string A function to call when clicked, or a string to use as a key for a `run` return event
@@ -735,24 +744,19 @@

Parameters:

Parameters:

  • key - key - The key to trigger on, from `keys.*` + key The key to trigger on, from `keys.*`
  • withCtrl - boolean - Whether Ctrl is required + boolean Whether Ctrl is required
  • withAlt - boolean - Whether Alt is required + boolean Whether Alt is required
  • withShift - boolean - Whether Shift is required + boolean Whether Shift is required
  • action - function - |string A function to call when clicked, or a string to use as a key for a `run` return event + function|string A function to call when clicked, or a string to use as a key for a `run` return event
@@ -772,28 +776,22 @@

Parameters:

Parameters:

  • win - window - The window to draw on + window The window to draw on
  • x - number - The X position of the left side of the line + number The X position of the left side of the text
  • y - number - The Y position of the line + number The Y position of the text
  • text - string - The text to draw + string The text to draw
  • fgColor - color - |nil The color of the text (defaults to white) + color|nil The color of the text (defaults to white)
  • bgColor - color - |nil The color of the background (defaults to black) + color|nil The color of the background (defaults to black)
@@ -813,40 +811,32 @@

Parameters:

Parameters:

  • win - window - The window to draw on + window The window to draw on
  • x - number - The X position of the left side of the bar + number The X position of the left side of the bar
  • y - number - The Y position of the bar + number The Y position of the bar
  • width - number - The width of the bar + number The width of the bar
  • fgColor - color - |nil The color of the activated part of the bar (defaults to white) + color|nil The color of the activated part of the bar (defaults to white)
  • bgColor - color - |nil The color of the inactive part of the bar (defaults to black) + color|nil The color of the inactive part of the bar (defaults to black)
  • useShade - boolean - |nil Whether to use shaded areas for the inactive part (defaults to false) + boolean|nil Whether to use shaded areas for the inactive part (defaults to false)

Returns:

    - function - A function to call to update the progress of the bar, taking a number from 0.0 to 1.0 + function redraw A function to call to update the progress of the bar, taking a number from 0.0 to 1.0
@@ -864,52 +854,41 @@

Returns:

Parameters:

  • win - window - The parent window of the scroll box + window The parent window of the scroll box
  • x - number - The X position of the box + number The X position of the box
  • y - number - The Y position of the box + number The Y position of the box
  • width - number - The width of the box + number The width of the box
  • height - number - The height of the outer box + number The height of the outer box
  • innerHeight - number - The height of the inner scroll area + number The height of the inner scroll area
  • allowArrowKeys - boolean - |nil Whether to allow arrow keys to scroll the box (defaults to true) + boolean|nil Whether to allow arrow keys to scroll the box (defaults to true)
  • showScrollIndicators - boolean - |nil Whether to show arrow indicators on the right side when scrolling is available, which reduces the inner width by 1 (defaults to false) + boolean|nil Whether to show arrow indicators on the right side when scrolling is available, which reduces the inner width by 1 (defaults to false)
  • fgColor - number - |nil The color of scroll indicators (defaults to white) + number|nil The color of scroll indicators (defaults to white)
  • bgColor - color - |nil The color of the background (defaults to black) + color|nil The color of the background (defaults to black)

Returns:

    - window - The inner window to draw inside + window inner The inner window to draw inside
@@ -921,50 +900,40 @@

Returns:

selectionBox (win, x, y, width, height, entries, action, selectChangeAction, fgColor, bgColor)
- Creates a list of entries that can each be selected with the Enter key. + Creates a list of entries that can each be selected.

Parameters:

  • win - window - The window to draw on + window The window to draw on
  • x - number - The X coordinate of the inside of the box + number The X coordinate of the inside of the box
  • y - number - The Y coordinate of the inside of the box + number The Y coordinate of the inside of the box
  • width - number - The width of the inner box + number The width of the inner box
  • height - number - The height of the inner box + number The height of the inner box
  • entries - string - [] A list of entries to show, where the value is whether the item is pre-selected (or `"R"` for required/forced selected) + string[] A list of entries to show, where the value is whether the item is pre-selected (or `"R"` for required/forced selected)
  • action - function - |string A function or `run` event that's called when a selection is made + function|string A function or `run` event that's called when a selection is made
  • selectChangeAction - function - |string|nil A function or `run` event that's called when the current selection is changed + function|string|nil A function or `run` event that's called when the current selection is changed
  • fgColor - color - |nil The color of the text (defaults to white) + color|nil The color of the text (defaults to white)
  • bgColor - color - |nil The color of the background (defaults to black) + color|nil The color of the background (defaults to black)
@@ -984,44 +953,35 @@

Parameters:

Parameters:

  • win - window - The parent window of the text box + window The parent window of the text box
  • x - number - The X position of the box + number The X position of the box
  • y - number - The Y position of the box + number The Y position of the box
  • width - number - The width of the box + number The width of the box
  • height - number - The height of the box + number The height of the box
  • text - string - The initial text to draw + string The initial text to draw
  • fgColor - color - |nil The color of the text (defaults to white) + color|nil The color of the text (defaults to white)
  • bgColor - color - |nil The color of the background (defaults to black) + color|nil The color of the background (defaults to black)

Returns:

    - function - A function to redraw the window with new contents + function redraw A function to redraw the window with new contents
@@ -1039,12 +999,53 @@

Returns:

Parameters:

  • time - number - The amount of time to wait for, in seconds + number The amount of time to wait for, in seconds
  • action - function - |string The function to call when the timer completes, or a `run` event to send + function|string The function to call when the timer completes, or a `run` event to send +
  • +
+ +

Returns:

+
    + + function cancel A function to cancel the timer +
+ + + + +
+
+ + verticalLine (win, x, y, height, right, fgColor, bgColor) +
+
+ Draws a vertical line at a position with the specified height. + + +

Parameters:

+
    +
  • win + window The window to draw on +
  • +
  • x + number The X position of the line +
  • +
  • y + number The Y position of the top of the line +
  • +
  • height + number The height of the line +
  • +
  • right + boolean|nil Whether to align the line to the right instead of the left (defaults to false) +
  • +
  • fgColor + color|nil The color of the line (defaults to white) +
  • +
  • bgColor + color|nil The color of the background (defaults to black)
@@ -1059,8 +1060,8 @@

Parameters:

-generated by LDoc 1.5.0 -Last updated 2023-08-02 15:36:53 +generated by LDoc 1.5.0 +Last updated 2024-09-13 18:39:47
From b749bd4be7a4c10ed2a62a658cad7c6f3ee364d3 Mon Sep 17 00:00:00 2001 From: ascpial Date: Fri, 13 Sep 2024 19:10:22 +0200 Subject: [PATCH 2/3] Fix addTask description --- docs/index.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/index.html b/docs/index.html index 5c9fa0f..e7a6f0a 100644 --- a/docs/index.html +++ b/docs/index.html @@ -52,7 +52,7 @@

Functions

- + @@ -168,13 +168,13 @@

Functions

addTask (func)
- + Adds a task to run in the main loop.

Parameters:

  • func - function The function to run, usually an `os.pullEvent` loop +
@@ -1061,7 +1061,7 @@

Parameters:

generated by LDoc 1.5.0 -Last updated 2024-09-13 18:39:47 +Last updated 2024-09-13 19:06:54
From 14957deaae54e257cf523d6f887477e067b8f65c Mon Sep 17 00:00:00 2001 From: ascpial Date: Fri, 13 Sep 2024 19:11:20 +0200 Subject: [PATCH 3/3] Really fix it that time --- docs/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/index.html b/docs/index.html index e7a6f0a..3655bb3 100644 --- a/docs/index.html +++ b/docs/index.html @@ -174,7 +174,7 @@

Functions

Parameters:

  • func - + function The function to run, usually an `os.pullEvent` loop
@@ -1061,7 +1061,7 @@

Parameters:

generated by LDoc 1.5.0 -Last updated 2024-09-13 19:06:54 +Last updated 2024-09-13 19:11:00
addTask (func)Adds a task to run in the main loop.
resolve (...)