mirror of
https://github.com/IgorTimofeev/MineOS.git
synced 2025-12-20 11:09:21 +01:00
Кнопочки покрасивее
This commit is contained in:
parent
5499fd8d40
commit
6eb09505ab
@ -301,7 +301,7 @@
|
|||||||
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/lib/GUI.lua",
|
url="https://raw.githubusercontent.com/IgorTimofeev/OpenComputers/master/lib/GUI.lua",
|
||||||
type="Library",
|
type="Library",
|
||||||
preloadFile=true,
|
preloadFile=true,
|
||||||
version=1.71,
|
version=1.72,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path="/lib/rayEngine.lua",
|
path="/lib/rayEngine.lua",
|
||||||
|
|||||||
@ -510,11 +510,11 @@ GUI.**button**( x, y, width, height, buttonColor, textColor, buttonPressedColor,
|
|||||||
|
|
||||||
- GUI.**framedButton**(...) отрисовывается с рамкой по краям кнопки
|
- GUI.**framedButton**(...) отрисовывается с рамкой по краям кнопки
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
- GUI.**roundedButton**(...) имеет симпатичные скругленные уголки
|
- GUI.**roundedButton**(...) имеет симпатичные скругленные уголки
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
Для удобства имеется также альтернативные способы создания кнопки:
|
Для удобства имеется также альтернативные способы создания кнопки:
|
||||||
|
|
||||||
@ -558,7 +558,7 @@ mainContainer:startEventHandling()
|
|||||||
|
|
||||||
Результат:
|
Результат:
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
GUI.**inputField**( x, y, width, height, backgroundColor, textColor, placeholderTextColor, backgroundFocusedColor, textFocusedColor, text, [placeholderText, eraseTextOnFocus, textMask ): *table* inputField
|
GUI.**inputField**( x, y, width, height, backgroundColor, textColor, placeholderTextColor, backgroundFocusedColor, textFocusedColor, text, [placeholderText, eraseTextOnFocus, textMask ): *table* inputField
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
|||||||
22
lib/GUI.lua
22
lib/GUI.lua
@ -475,22 +475,30 @@ end
|
|||||||
local function buttonDraw(object)
|
local function buttonDraw(object)
|
||||||
local xText, yText = GUI.getAlignmentCoordinates(object, {width = unicode.len(object.text), height = 1})
|
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
|
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
|
else
|
||||||
if object.pressed then
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
if buttonColor then
|
if buttonColor then
|
||||||
if object.buttonType == 1 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
|
elseif object.buttonType == 2 then
|
||||||
buffer.text(object.x + 1, object.y, buttonColor, string.rep("▄", object.width - 2), transparency)
|
local x2, y2 = object.x + object.width - 1, object.y + object.height - 1
|
||||||
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)
|
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
|
else
|
||||||
buffer.frame(object.x, object.y, object.width, object.height, buttonColor)
|
buffer.frame(object.x, object.y, object.width, object.height, buttonColor)
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user