From 3267fba979b3edfa8dd5091eac794c718ba0faeb Mon Sep 17 00:00:00 2001 From: Brandon Dyck Date: Sun, 21 Apr 2024 16:44:14 -0600 Subject: [PATCH] Make time display bigger --- main.lua | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/main.lua b/main.lua index 033994b..40bf801 100644 --- a/main.lua +++ b/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