mirror of
https://github.com/S4mpsa/InfOS.git
synced 2025-08-04 02:16:05 -04:00
Resizing panel buttons and title
This commit is contained in:
parent
bb9cf07b30
commit
90612b7ae5
@ -64,16 +64,18 @@ Event.listen(
|
|||||||
|
|
||||||
local function drawTitle(title)
|
local function drawTitle(title)
|
||||||
local x = Constants.baseWidth
|
local x = Constants.baseWidth
|
||||||
local y = 0
|
local y = 1
|
||||||
local scale = 3
|
local width = 3 * Constants.baseWidth
|
||||||
Widget.drawBaseWidget(x, y, scale, title)
|
local height = 0.8 * Constants.baseHeight
|
||||||
|
Widget.drawBaseWidget(x, y, width, height, title)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function drawPanelSection(index, title)
|
local function drawPanelSection(index, title)
|
||||||
local x = 0
|
local width = 0.6 * Constants.baseWidth
|
||||||
local y = (index - 1) * Constants.baseHeight
|
local height = 0.6 * Constants.baseHeight
|
||||||
local scale = 1
|
local x = (Constants.baseWidth - width) / 2
|
||||||
Widget.drawBaseWidget(x, y, scale, title)
|
local y = (index - 1) * Constants.baseHeight + (Constants.baseHeight - height) / 2
|
||||||
|
Widget.drawBaseWidget(x, y, width, height, title)
|
||||||
end
|
end
|
||||||
|
|
||||||
function page.create(element)
|
function page.create(element)
|
||||||
|
@ -25,15 +25,21 @@ local function drawProgress(x, y, width, height, progress, maxProgress, color)
|
|||||||
DoubleBuffer.drawSemiPixelRectangle(x + 6 - lengths.first, y + 1, lengths.first, 1, color)
|
DoubleBuffer.drawSemiPixelRectangle(x + 6 - lengths.first, y + 1, lengths.first, 1, color)
|
||||||
DoubleBuffer.drawSemiPixelRectangle(x + 1, y + 2, 1, lengths.second, color)
|
DoubleBuffer.drawSemiPixelRectangle(x + 1, y + 2, 1, lengths.second, color)
|
||||||
DoubleBuffer.drawSemiPixelRectangle(x + 1, y + height, lengths.third, 1, color)
|
DoubleBuffer.drawSemiPixelRectangle(x + 1, y + height, lengths.third, 1, color)
|
||||||
DoubleBuffer.drawRectangle(x + width - 6, (y + height) / 2, 2, 1, Colors.machineBackground, Colors.machineBackground, "█")
|
DoubleBuffer.drawRectangle(
|
||||||
|
x + width - 6,
|
||||||
|
(y + height) / 2,
|
||||||
|
2,
|
||||||
|
1,
|
||||||
|
Colors.machineBackground,
|
||||||
|
Colors.machineBackground,
|
||||||
|
"█"
|
||||||
|
)
|
||||||
DoubleBuffer.drawSemiPixelRectangle(x + width - 4, y + height, lengths.first, 1, color)
|
DoubleBuffer.drawSemiPixelRectangle(x + width - 4, y + height, lengths.first, 1, color)
|
||||||
DoubleBuffer.drawSemiPixelRectangle(x + width, y + height - lengths.second, 1, lengths.second, color)
|
DoubleBuffer.drawSemiPixelRectangle(x + width, y + height - lengths.second, 1, lengths.second, color)
|
||||||
DoubleBuffer.drawSemiPixelRectangle(x + 1 + width - lengths.third, y + 1, lengths.third, 1, color)
|
DoubleBuffer.drawSemiPixelRectangle(x + 1 + width - lengths.third, y + 1, lengths.third, 1, color)
|
||||||
end
|
end
|
||||||
|
|
||||||
function widget.drawBaseWidget(x, y, scale, title)
|
function widget.drawBaseWidget(x, y, width, height, title)
|
||||||
local width = Constants.baseWidth * scale
|
|
||||||
local height = Constants.baseHeight
|
|
||||||
DoubleBuffer.drawRectangle(
|
DoubleBuffer.drawRectangle(
|
||||||
x + 1,
|
x + 1,
|
||||||
y + 1,
|
y + 1,
|
||||||
@ -43,9 +49,18 @@ function widget.drawBaseWidget(x, y, scale, title)
|
|||||||
Colors.machineBackground,
|
Colors.machineBackground,
|
||||||
"█"
|
"█"
|
||||||
)
|
)
|
||||||
|
DoubleBuffer.drawLine(
|
||||||
|
x + 3,
|
||||||
|
y + math.ceil(0.5 * height),
|
||||||
|
x + width - 3,
|
||||||
|
y + math.ceil(0.5 * height),
|
||||||
|
Colors.machineBackground,
|
||||||
|
Colors.textColor,
|
||||||
|
"─"
|
||||||
|
)
|
||||||
DoubleBuffer.drawFrame(x + 1, y + 1, width - 1, height - 1, Colors.labelColor)
|
DoubleBuffer.drawFrame(x + 1, y + 1, width - 1, height - 1, Colors.labelColor)
|
||||||
DoubleBuffer.drawLine(x + 3, y + 5, x + width - 3, y + 5, Colors.machineBackground, Colors.textColor, "─")
|
title = Unicode.len(title) < width - 8 and " " .. title .. " " or " " .. string.gsub(title, "%l*%s", "") .. " "
|
||||||
DoubleBuffer.drawText(x + math.floor((width - Unicode.len(title)) / 2), y + 3, Colors.labelColor, title)
|
DoubleBuffer.drawText(x + math.floor((width - Unicode.len(title) + 1) / 2), y + 3, Colors.labelColor, title)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function draw(self, index)
|
local function draw(self, index)
|
||||||
@ -58,7 +73,7 @@ local function draw(self, index)
|
|||||||
local x = Constants.baseWidth + Constants.baseWidth * ((index - 1) % 3)
|
local x = Constants.baseWidth + Constants.baseWidth * ((index - 1) % 3)
|
||||||
local y = height * math.ceil((index) / 3)
|
local y = height * math.ceil((index) / 3)
|
||||||
|
|
||||||
widget.drawBaseWidget(x, y, scale, self.name)
|
widget.drawBaseWidget(x, y, width, height, self.name)
|
||||||
|
|
||||||
drawProgress(x, 2 * y, width - 1, 2 * (height - 1), 1, 1, Colors.progressBackground)
|
drawProgress(x, 2 * y, width - 1, 2 * (height - 1), 1, 1, Colors.progressBackground)
|
||||||
drawProgress(x, 2 * y, width - 1, 2 * (height - 1), self.progress, self.maxProgress, Colors.barColor)
|
drawProgress(x, 2 * y, width - 1, 2 * (height - 1), self.progress, self.maxProgress, Colors.barColor)
|
||||||
|
@ -19,6 +19,11 @@ function MultiBlock:getNumberOfProblems()
|
|||||||
return Parser.parseProblems(sensorInformation[5])
|
return Parser.parseProblems(sensorInformation[5])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function MultiBlock:getProgress()
|
||||||
|
local sensorInformation = self:getSensorInformation()
|
||||||
|
return Parser.parseProgress(sensorInformation[1])
|
||||||
|
end
|
||||||
|
|
||||||
function MultiBlock:getEfficiencyPercentage()
|
function MultiBlock:getEfficiencyPercentage()
|
||||||
local sensorInformation = self:getSensorInformation()
|
local sensorInformation = self:getSensorInformation()
|
||||||
return Parser.parseEfficiency(sensorInformation[5])
|
return Parser.parseEfficiency(sensorInformation[5])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user