Update modules

This commit is contained in:
Squishy (C6H12O6+NaCl+H2O)
2024-05-23 10:58:57 +07:00
parent 16e472f7ef
commit ffe1bf5049
5 changed files with 44 additions and 28 deletions

View File

@@ -1,6 +1,7 @@
-- Bigint library
bigint = require "libs.bigint.bigint"
number_names = require "libs.bigint.named-powers-of-ten"
require "libs.simple-slider"
-- Fonts
FONT_tromi = love.graphics.newFont('res/fonts/monofonto rg.otf', 28)
@@ -25,13 +26,15 @@ BUTTON.setDefaultOption{
love.graphics.rectangle('fill', self.x, self.y, self.w, self.h, self.r)
end
local text = type(self.text) == 'function' and self.text() or self.text
local lineAmount
do
local _, t
if need_big_font then
_, t = FONT_big:getWrap(self.text, self.w * 2)
_, t = FONT_big:getWrap(text, self.w * 2)
else
_, t = FONT_tromi:getWrap(self.text, self.w * 2)
_, t = FONT_tromi:getWrap(text, self.w * 2)
end
lineAmount = #t
end
@@ -42,9 +45,9 @@ BUTTON.setDefaultOption{
local textPos = self.y + (self.h * 0.5) - textHeight
if need_big_font then
drawBigText(self.text, self.x, textPos, self.w, 'center')
drawBigText(text, self.x, textPos, self.w, 'center')
else
drawText(self.text, self.x, textPos, self.w, 'center')
drawText(text, self.x, textPos, self.w, 'center')
end
love.graphics.setColor(1, 1, 1, 0.8)