Make time display bigger
This commit is contained in:
parent
42ab042e59
commit
3267fba979
17
main.lua
17
main.lua
@ -21,12 +21,13 @@ function love.load()
|
||||
|
||||
local exitNote = "Press \"Esc\" to exit."
|
||||
local column2Width = love.graphics.getWidth() - column2X - margin
|
||||
local font = love.graphics.newFont(love.graphics.getHeight() / 20)
|
||||
local textFont = love.graphics.newFont(love.graphics.getHeight() / 20)
|
||||
local timeFont = love.graphics.newFont(love.graphics.getHeight() / 10)
|
||||
|
||||
local _, exitNoteWraps = font:getWrap(exitNote, column2Width)
|
||||
local exitNoteY = love.graphics.getHeight() - table.maxn(exitNoteWraps) * font:getHeight() - margin
|
||||
local _, exitNoteWraps = textFont:getWrap(exitNote, column2Width)
|
||||
local exitNoteY = love.graphics.getHeight() - table.maxn(exitNoteWraps) * textFont:getHeight() - margin
|
||||
|
||||
local checkboxSize = font:getBaseline()
|
||||
local checkboxSize = textFont:getBaseline()
|
||||
local checkboxLine = love.graphics.getHeight()/180
|
||||
local checkbox = Checkbox:new(checkboxSize, checkboxLine, love.math.newTransform(column2X, margin), false)
|
||||
local showTime = checkbox.checked
|
||||
@ -37,13 +38,13 @@ function love.load()
|
||||
local textCanvas = love.graphics.newCanvas(love.graphics.getWidth(), love.graphics.getHeight())
|
||||
love.graphics.setCanvas(textCanvas)
|
||||
love.graphics.setColor(1,1,1)
|
||||
love.graphics.printf(" Show time", font, column2X + checkboxSize + checkboxLine, margin, column2Width)
|
||||
love.graphics.printf("Press \"Esc\" to exit.", font, column2X, exitNoteY, column2Width)
|
||||
love.graphics.printf(" Show time", textFont, column2X + checkboxSize + checkboxLine, margin, column2Width)
|
||||
love.graphics.printf("Press \"Esc\" to exit.", textFont, column2X, exitNoteY, column2Width)
|
||||
love.graphics.setCanvas()
|
||||
|
||||
local timeString
|
||||
local timeIndent
|
||||
local figureWidth = font:getWidth("0")
|
||||
local figureWidth = timeFont:getWidth("0")
|
||||
clock.onSetHands = function(t)
|
||||
timeString = tostring(clock:getTime())
|
||||
if #timeString < 5 then
|
||||
@ -74,7 +75,7 @@ function love.load()
|
||||
checkbox:draw()
|
||||
love.graphics.draw(textCanvas, 0, 0)
|
||||
if showTime then
|
||||
love.graphics.printf(timeString, font, column2X+timeIndent, margin+font:getHeight(), column2Width)
|
||||
love.graphics.printf(timeString, timeFont, column2X+timeIndent, margin+textFont:getHeight(), column2Width)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user