|
@@ -20,4 +20,45 @@ function array_loop(_arr, _curr, _add){
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return _curr
|
|
return _curr
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+// @function progressbar();
|
|
|
|
|
+/// @param {real} _curr Current value
|
|
|
|
|
+/// @param {real} _max Max value
|
|
|
|
|
+/// @param {real} _width Max width (in pixels) of bar
|
|
|
|
|
+/// @description Draw current width of a progress bar
|
|
|
|
|
+function progressbar(_curr, _max, _width){
|
|
|
|
|
+ return (_width / _max) * _curr
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+// @function draw_rect();
|
|
|
|
|
+/// @param {real} _x x pos
|
|
|
|
|
+/// @param {real} _y y pos
|
|
|
|
|
+/// @param {real} _width rect width
|
|
|
|
|
+/// @param {real} _height rect height
|
|
|
|
|
+/// @param {boolean} _outline With outline?
|
|
|
|
|
+/// @description Draw a rectangle from width and height
|
|
|
|
|
+function draw_rect(_x, _y, _width, _height, _outline){
|
|
|
|
|
+ var _x2 = (_x + _width);
|
|
|
|
|
+ var _y2 = (_y + _height);
|
|
|
|
|
+
|
|
|
|
|
+ draw_rectangle(_x, _y, _x2, _y2, _outline);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+// @function draw_rect_inset();
|
|
|
|
|
+/// @param {real} _x x pos
|
|
|
|
|
+/// @param {real} _y y pos
|
|
|
|
|
+/// @param {real} _width rect width
|
|
|
|
|
+/// @param {real} _height rect height
|
|
|
|
|
+/// @param {real} _inset how much of inset
|
|
|
|
|
+/// @description Draw a rectangle from width and height (and opt. inset)
|
|
|
|
|
+function draw_rect_inset(_x, _y, _width, _height, _inset = 0){
|
|
|
|
|
+ var _x1 = _x + _inset;
|
|
|
|
|
+ var _x2 = (_x + _width) - _inset;
|
|
|
|
|
+
|
|
|
|
|
+ var _y1 = _y + _inset;
|
|
|
|
|
+ var _y2 = (_y + _height) - _inset;
|
|
|
|
|
+
|
|
|
|
|
+ draw_rectangle(_x1, _y1, _x2, _y2, false);
|
|
|
}
|
|
}
|