-
Notifications
You must be signed in to change notification settings - Fork 3
EmuProgressBar
This class represents a progress bar, anchored on the left. Progress bars may also optionally respond to mouse input, which would let them serve as a slider instead.
A progress bar with an EmuText element above it. It is generally good practice to label progress bars.
Inheritance: EmuCore / EmuCallback
EmuProgressBar(name)
Parameter | Type | Description |
---|---|---|
x | real | The x coordinate where the progress bar will be created |
y | real | The y coordinate where the progress bar will be created |
w | real | The width of the progress bar |
h | real | The height of the progress bar |
thickness | real | The thickness of the progress bar |
min | real | The value of the progress bar when it is empty |
max | real | The value of the progress bar when it is full |
draggable | boolean | Whether or not the progress bar should respond to being dragged by the mouse |
value | real | The initial value of the progress bar |
callback | function | The function invoked when the value of the progress bar is changed by the user |
The minimum and maximum values of the progress bar will automatically be sorted, e.g. if you specify a minimum value of 100 and a maximum value of 0 the values will be swapped automatically. The value of the progress bar will be constrained to within those two values.
Returns: N/A
Parameter | Type | Description |
---|---|---|
integers_only | boolean | Whether or not the progress bar will snap to the nearest integer value when dragged |
Use this method to indicate if a progress bar slider will round to integers (true) or allow fractional values (false). This only has an effect for draggable progress bars.
var bar = new EmuProgressBar(32, 32, 256, 32, 12, 0, 10, true, 7, function() {
show_message("The value of the progress bar is now " + string(value) + ".");
});
bar.SetIntegersOnly(true);
container.AddContent(bar);
This will create a draggable EmuProgressBar. It will have a thickness of 12
, a minimum value of 0
, a maximum value of 10
and a starting value of 7
, and add it to a previously defined container. It will only accept integer values.