This commit is contained in:
kepler155c
2017-10-08 17:45:37 -04:00
parent bba7841c43
commit ed2d6eeef1
23 changed files with 222 additions and 207 deletions

View File

@@ -1,8 +1,14 @@
require = requireInjector(getfenv(1))
_G.requireInjector()
local Event = require('event')
local UI = require('ui')
local colors = _G.colors
local device = _G.device
local turtle = _G.turtle
local multishell = _ENV.multishell
multishell.setTitle(multishell.getCurrent(), 'Music')
local radio = device.drive or error('No drive attached')
@@ -16,8 +22,6 @@ end
UI:configure('Music', ...)
local monitor = UI.term
UI.Button.defaults.backgroundFocusColor = colors.gray
local page = UI.Page({
@@ -146,12 +150,12 @@ function page:eventHandler(event)
end
end
function page:setVolume(volume, displayOnly)
function page:setVolume(volume)
volume = math.min(volume, 15)
volume = math.max(volume, 1)
self.volume = volume
volume = math.ceil(volume / 2)
for i = 1, volume do
self.volumeControls[i].backgroundColor =
self.volumeControls[i].color
@@ -224,7 +228,7 @@ end
function page:updateStationName()
local title = radio.getAudioTitle()
if title then
self.stationName.value = title
self.stationName:draw()