mirror of
https://github.com/IgorTimofeev/MineOS.git
synced 2026-09-14 11:06:16 +05:00
Пора лизать грязную вагину
This commit is contained in:
parent
e0c89bdcda
commit
64485ac368
@ -300,13 +300,13 @@
|
||||
name="lib/GUI.lua",
|
||||
url="IgorTimofeev/OpenComputers/master/lib/GUI.lua",
|
||||
type="Library",
|
||||
version=1.26,
|
||||
version=1.27,
|
||||
},
|
||||
{
|
||||
name="lib/windows.lua",
|
||||
url="IgorTimofeev/OpenComputers/master/lib/windows.lua",
|
||||
type="Library",
|
||||
version=1.08,
|
||||
version=1.09,
|
||||
},
|
||||
{
|
||||
name="lib/rayEngine.lua",
|
||||
|
||||
60
lib/GUI.lua
60
lib/GUI.lua
@ -1425,12 +1425,17 @@ local function scrollBarDraw(scrollBar)
|
||||
local isVertical = scrollBar.height > scrollBar.width
|
||||
local valuesDelta = scrollBar.maximumValue - scrollBar.minimumValue + 1
|
||||
local part = scrollBar.value / valuesDelta
|
||||
local barSize = math.ceil(scrollBar.shownValueCount / valuesDelta * scrollBar.height)
|
||||
local halfBarSize = math.floor(barSize / 2)
|
||||
|
||||
buffer.square(scrollBar.x, scrollBar.y, scrollBar.width, scrollBar.height, scrollBar.colors.background, 0x0, " ")
|
||||
if not isVertical and scrollBar.thinHorizontalMode then
|
||||
buffer.text(scrollBar.x, scrollBar.y, scrollBar.colors.background, string.rep("▄", scrollBar.width))
|
||||
else
|
||||
buffer.square(scrollBar.x, scrollBar.y, scrollBar.width, scrollBar.height, scrollBar.colors.background, 0x0, " ")
|
||||
end
|
||||
|
||||
if isVertical then
|
||||
local barSize = math.ceil(scrollBar.shownValueCount / valuesDelta * scrollBar.height)
|
||||
local halfBarSize = math.floor(barSize / 2)
|
||||
|
||||
scrollBar.ghostPosition.x = scrollBar.x
|
||||
scrollBar.ghostPosition.y = scrollBar.y + halfBarSize
|
||||
scrollBar.ghostPosition.width = scrollBar.width
|
||||
@ -1444,24 +1449,31 @@ local function scrollBarDraw(scrollBar)
|
||||
scrollBar.colors.foreground, 0x0, " "
|
||||
)
|
||||
else
|
||||
local barSize = math.ceil(scrollBar.shownValueCount / valuesDelta * scrollBar.width)
|
||||
local halfBarSize = math.floor(barSize / 2)
|
||||
|
||||
scrollBar.ghostPosition.x = scrollBar.x + halfBarSize
|
||||
scrollBar.ghostPosition.y = scrollBar.y
|
||||
scrollBar.ghostPosition.width = scrollBar.width - barSize
|
||||
scrollBar.ghostPosition.height = scrollBar.height
|
||||
|
||||
buffer.square(
|
||||
math.floor(scrollBar.ghostPosition.x + part * scrollBar.ghostPosition.width - halfBarSize),
|
||||
scrollBar.ghostPosition.y,
|
||||
barSize,
|
||||
scrollBar.ghostPosition.height,
|
||||
scrollBar.colors.foreground, 0x0, " "
|
||||
)
|
||||
if not isVertical and scrollBar.thinHorizontalMode then
|
||||
buffer.text(math.floor(scrollBar.ghostPosition.x + part * scrollBar.ghostPosition.width - halfBarSize), scrollBar.ghostPosition.y, scrollBar.colors.foreground, string.rep("▄", barSize))
|
||||
else
|
||||
buffer.square(
|
||||
math.floor(scrollBar.ghostPosition.x + part * scrollBar.ghostPosition.width - halfBarSize),
|
||||
scrollBar.ghostPosition.y,
|
||||
barSize,
|
||||
scrollBar.ghostPosition.height,
|
||||
scrollBar.colors.foreground, 0x0, " "
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
return scrollBar
|
||||
end
|
||||
|
||||
function GUI.scrollBar(x, y, width, height, backgroundColor, foregroundColor, minimumValue, maximumValue, value, shownValueCount, onScrollValueIncrement, horizontalThin)
|
||||
function GUI.scrollBar(x, y, width, height, backgroundColor, foregroundColor, minimumValue, maximumValue, value, shownValueCount, onScrollValueIncrement, thinHorizontalMode)
|
||||
local scrollBar = GUI.object(x, y, width, height)
|
||||
|
||||
scrollBar.maximumValue = maximumValue
|
||||
@ -1469,7 +1481,7 @@ function GUI.scrollBar(x, y, width, height, backgroundColor, foregroundColor, mi
|
||||
scrollBar.value = value
|
||||
scrollBar.onScrollValueIncrement = onScrollValueIncrement
|
||||
scrollBar.shownValueCount = shownValueCount
|
||||
scrollBar.thin = horizontalThin
|
||||
scrollBar.thinHorizontalMode = thinHorizontalMode
|
||||
scrollBar.colors = {
|
||||
background = backgroundColor,
|
||||
foreground = foregroundColor,
|
||||
@ -1482,33 +1494,13 @@ end
|
||||
|
||||
--------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
buffer.start()
|
||||
buffer.clear(0x1b1b1b)
|
||||
-- buffer.start()
|
||||
-- buffer.clear(0x1b1b1b)
|
||||
|
||||
-- GUI.scrollBar(1, 5, 1, 20, 0x444444, 0x00DBFF, 1, 100, 50, 20, 1, true):draw()
|
||||
|
||||
-- buffer.draw()
|
||||
|
||||
-- local comboBox = GUI.comboBox(2, 2, 30, 1, 0xFFFFFF, 0x262626, 0xDDDDDD, 0x262626, {"PIC", "RAW", "PNG", "JPG"})
|
||||
-- comboBox:selectItem()
|
||||
|
||||
-- buffer.draw()
|
||||
|
||||
-- GUI.chart(2, 10, 40, 20, 0xFFFFFF, 0xBBBBBB, 0xFFDB40, "t", "EU", 0, 2, {
|
||||
-- 0.5,
|
||||
-- 0.12
|
||||
-- }):draw()
|
||||
|
||||
-- local menu = GUI.dropDownMenu(2, 2, 40, 1, 0xFFFFFF, 0x000000, 0xFFDB40, 0xFFFFFF, 0x999999, 0x777777, 50)
|
||||
-- menu:addItem("New")
|
||||
-- menu:addItem("Open")
|
||||
-- menu:addSeparator()
|
||||
-- menu:addItem("Save")
|
||||
-- menu:addItem("Save as")
|
||||
-- menu:show()
|
||||
|
||||
-- GUI.contextMenu(2, 2, {"Hello"}, {"World"}, "-", {"You are the"}, {"Best of best", false, "^S"}, {"And bestest yopta"}):show()
|
||||
|
||||
--------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
return GUI
|
||||
|
||||
@ -282,18 +282,10 @@ end
|
||||
-- buffer.draw(true)
|
||||
|
||||
-- local myWindow = windows.empty(2, 2, 60, 20, 60, 20)
|
||||
-- myWindow:addScrollBar(1, 1, 1, 20, 0x444444, 0x00DBFF, 1, 100, 50, 20, 4, true)
|
||||
-- myWindow:draw()
|
||||
-- buffer.draw()
|
||||
-- myWindow:handleEvents()
|
||||
|
||||
-- local myWindow = windows.empty(10, 5, 60, 20, 60, 20)
|
||||
-- myWindow:addPanel(1, 1, myWindow.width, myWindow.height, 0xEEEEEE)
|
||||
-- myWindow:addLabel(2, 5, 20, 1, 0x000000, tostring(10)):setAlignment(GUI.alignment.horizontal.center, GUI.alignment.vertical.top)
|
||||
-- myWindow:addHorizontalSlider(2, 4, 20, 0x880000, 0x000000, 0xFF4444, 0, 100, 10).onValueChanged = function(object)
|
||||
-- myWindow.counter.text = tostring(object.value)
|
||||
-- local scrollBar = myWindow:addScrollBar(1, 1, 20, 1, 0x444444, 0x00DBFF, 1, 100, 50, 20, 4, true)
|
||||
-- scrollBar.onTouch = function()
|
||||
-- buffer.text(4, 1, 0xFFFFFF, "Value: " .. scrollBar.value)
|
||||
-- end
|
||||
|
||||
-- myWindow:draw()
|
||||
-- buffer.draw()
|
||||
-- myWindow:handleEvents()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user