ProgressBar
A UI element that shows a bar, that can be filled to different amounts in multiple orientations.
Different kinds of porgress bar.
Contents:
Properties
Name |
Type |
Default |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
minVal
Smallest value the progress bar can display.
uilib.ProgressBar.minVal = nil
Type:
numberDefault:
nil
maxVal
Biggest value the progress bar can display.
uilib.ProgressBar.maxVal = nil
Type:
numberDefault:
nil
val
Current value the progress bar should display.
uilib.ProgressBar.val = nil
Type:
numberDefault:
nil
x
X component of the position on the screen.
uilib.ProgressBar.x = nil
Type:
numberDefault:
nil
y
Y component of the position on the screen.
uilib.ProgressBar.y = nil
Type:
numberDefault:
nil
w
Width of the progress bar.
uilib.ProgressBar.w = nil
Type:
numberDefault:
nil
h
Height of the progress bar.
uilib.ProgressBar.h = nil
Type:
numberDefault:
nil
vertical
Enables vertical mode for the progress bar.
uilib.ProgressBar.vertical = false
Type:
booleanDefault:
false
inverted
Enables inverted mode for the progress bar.
uilib.ProgressBar.inverted = false
Type:
booleanDefault:
false
style
Style of the progress bar.
uilib.ProgressBar.style = uilib.Style:new()
Type: uilib.Style
Default: Default Style
visible
Contains information about the progress bar being visible or not.
uilib.ProgressBar.visible = true
Type:
booleanDefault:
true
Functions
new()
Function to create a new instance of ProgressBar.
function M.ProgressBar:new(minVal, maxVal, val, x, y, w, h, vertical, inverted, style)
...
return prog
end
Arguments:
Name |
Type |
Default |
Description |
|---|---|---|---|
minVal |
|
|
Smallest value the progress bar can display. |
maxVal |
|
|
Biggest value the progress bar can display. |
val |
|
|
Current value the progress bar should display. |
x |
|
|
X component of position of the progress bar. |
y |
|
|
Y component of position of the progress bar. |
w |
|
|
Width of the progress bar. |
h |
|
|
Height of the progress bar. |
vertical |
|
|
Enables vertical mode for the progres bar. |
inverted |
|
|
Enables inverted mode for the progres bar. |
style |
Style of the progress bar. |
Note
Progress bars can only use the default state for styling.
Returns:
Type |
Description |
|---|---|
Instance of ProgressBar with specified properties. |
Example:
local uilib = require("uilib")
local prog = uilib.ProgressBar:new(0, 100, 35, 2, 2, 10, 1, false, false, uilib.Style:new())
This would create an instance of ProgressBar with possible values between 0 and 100 and an initial value of 35.
The progress bar would be displayed at the position (2, 2) and would be 10 x 1 pixels in size. It would be in horizontal mode, since vertical is set to false.
The style of the progress bar will be the default style.
draw()
Function to draw the progress bar.
function M.ProgressBar:draw()
...
end
Arguments: nil
Returns: nil
Example:
local uilib = require("uilib")
local prog = uilib.ProgressBar:new(0, 100, 35, 2, 2, 10, 1, false, false, uilib.Style:new())
prog:draw()
This would create an instance of ProgressBar and draw it to the screen.
show()
Function to make the progress bar visible.
function uilib.ProgressBar:show()
...
end
Arguments: nil
Returns: nil
Example:
local uilib = require("uilib")
local prog = uilib.ProgressBar:new(0, 100, 35, 2, 2, 10, 1, false, false, uilib.Style:new())
prog:show()
This would create an instance of ProgressBar and make it visible.
hide()
Function to make the progress bar invisible.
function uilib.ProgressBar:hide()
...
end
Arguments: nil
Returns: nil
Example:
local uilib = require("uilib")
local prog = uilib.ProgressBar:new(0, 100, 35, 2, 2, 10, 1, false, false, uilib.Style:new())
prog:hide()
This would create an instance of ProgressBar and make it invisible.