Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("/agui")
- local update
- local on = 1
- local bX = 0
- local bY = 0
- local function round(num)
- return math.floor(num+0.5)
- end
- local m = agui:new()
- m:setBackgroundColor(colors.cyan)
- local bar = m:create("button")
- bar:setSize(1, 4)
- bar:setPosition(51, 1)
- bar:setBackgroundColor(colors.gray)
- bar:setText("")
- bar.button1Click(function(x, y)
- local px, py = bar:getPosition()
- bX = px - x
- bY = py - y
- end)
- bar.button1Drag(function(x, y)
- y = y + bY
- if y < 1 then
- y = 1
- end
- if y > 19-3 then
- y = 19-3
- end
- on = round((((y-(19-3))/((19-3))+1))*(32-18))
- bar:setPosition(51, y)
- update()
- m:draw()
- end)
- local items = {}
- for i = 1, 19 do
- local it = m:create("label")
- it:setSize(50, 1)
- it:setPosition(1, i)
- it:setText("Derp")
- it:setBackgroundColor(colors.black)
- it:setTextColor(colors.white)
- table.insert(items, it)
- end
- function update()
- for i = on, on + 18 do
- local it = items[1 - on + i]
- it:setText("Number: " .. i)
- end
- end
- update()
- m:draw()
- m:listen()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement