diff --git a/Applications.cfg b/Applications.cfg index cc7f702d..a46b93f2 100644 --- a/Applications.cfg +++ b/Applications.cfg @@ -301,7 +301,7 @@ url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/lib/GUI.lua", type="Library", preloadFile=true, - version=1.71, + version=1.72, }, { path="/lib/rayEngine.lua", diff --git a/Documentation/GUI.md b/Documentation/GUI.md index a6324691..dbff96be 100644 --- a/Documentation/GUI.md +++ b/Documentation/GUI.md @@ -510,11 +510,11 @@ GUI.**button**( x, y, width, height, buttonColor, textColor, buttonPressedColor, - GUI.**framedButton**(...) отрисовывается с рамкой по краям кнопки - ![Imgur](http://i.imgur.com/xwuFWqG.png) + ![Imgur](https://i.imgur.com/ajmXYFR.png) - GUI.**roundedButton**(...) имеет симпатичные скругленные уголки - ![Imgur](http://i.imgur.com/p2exfKn.png) + ![Imgur](https://i.imgur.com/0UO3Vbm.png) Для удобства имеется также альтернативные способы создания кнопки: @@ -558,7 +558,7 @@ mainContainer:startEventHandling() Результат: -![Imgur](http://i.imgur.com/yJ9V4c8.gif) +![Imgur](https://i.imgur.com/9zZvR6g.gif) GUI.**inputField**( x, y, width, height, backgroundColor, textColor, placeholderTextColor, backgroundFocusedColor, textFocusedColor, text, [placeholderText, eraseTextOnFocus, textMask ): *table* inputField ------------------------------------------------------------------------ diff --git a/lib/GUI.lua b/lib/GUI.lua index 25b88986..b3eac477 100755 --- a/lib/GUI.lua +++ b/lib/GUI.lua @@ -475,22 +475,30 @@ end local function buttonDraw(object) local xText, yText = GUI.getAlignmentCoordinates(object, {width = unicode.len(object.text), height = 1}) - local buttonColor, textColor, transparency = object.colors.default.background, object.colors.default.text, object.colors.default.transparency + local buttonColor, textColor = object.colors.default.background, object.colors.default.text if object.disabled then - buttonColor, textColor, transparency = object.colors.disabled.background, object.colors.disabled.text, object.colors.disabled.transparency + buttonColor, textColor = object.colors.disabled.background, object.colors.disabled.text else if object.pressed then - buttonColor, textColor, transparency = object.colors.pressed.background, object.colors.pressed.text, object.colors.pressed.transparency + buttonColor, textColor = object.colors.pressed.background, object.colors.pressed.text end end if buttonColor then if object.buttonType == 1 then - buffer.square(object.x, object.y, object.width, object.height, buttonColor, textColor, " ", transparency) + buffer.square(object.x, object.y, object.width, object.height, buttonColor, textColor, " ") elseif object.buttonType == 2 then - buffer.text(object.x + 1, object.y, buttonColor, string.rep("▄", object.width - 2), transparency) - buffer.square(object.x, object.y + 1, object.width, object.height - 2, buttonColor, textColor, " ", transparency) - buffer.text(object.x + 1, object.y + object.height - 1, buttonColor, string.rep("▀", object.width - 2), transparency) + local x2, y2 = object.x + object.width - 1, object.y + object.height - 1 + + buffer.text(object.x + 1, object.y, buttonColor, string.rep("▄", object.width - 2)) + buffer.text(object.x, object.y, buttonColor, "⣠") + buffer.text(x2, object.y, buttonColor, "⣄") + + buffer.square(object.x, object.y + 1, object.width, object.height - 2, buttonColor, textColor, " ") + + buffer.text(object.x + 1, y2, buttonColor, string.rep("▀", object.width - 2)) + buffer.text(object.x, y2, buttonColor, "⠙") + buffer.text(x2, y2, buttonColor, "⠋") else buffer.frame(object.x, object.y, object.width, object.height, buttonColor) end