mirror of
https://gitea.com/SweetSea-ButImNotSweet/tromi_mobile.git
synced 2025-01-08 17:33:09 +08:00
Update font related stuff
This commit is contained in:
29
load.lua
29
load.lua
@@ -1,9 +1,11 @@
|
||||
-- Fonts
|
||||
FONT_tromi = love.graphics.newFont('res/fonts/MplusCodeLatin50-Regular.otf', 28)
|
||||
FONT_big = love.graphics.newFont('res/fonts/MplusCodeLatin50-Bold.otf', 56)
|
||||
|
||||
FONT_tromi:setFallbacks(love.graphics.newFont('res/fonts/techmino_proportional.otf', 28))
|
||||
FONT_big :setFallbacks(love.graphics.newFont('res/fonts/techmino_proportional.otf', 56))
|
||||
FONT_tromi = love.graphics.newFont('res/fonts/MplusCodeLatin50-Regular.otf', 26)
|
||||
FONT_bold = love.graphics.newFont('res/fonts/MplusCodeLatin50-Bold.otf', 26)
|
||||
FONT_big = love.graphics.newFont('res/fonts/MplusCodeLatin50-Bold.otf', 54)
|
||||
-- Icons
|
||||
FONT_tromi:setFallbacks(love.graphics.newFont('res/fonts/techmino_proportional.otf', 26))
|
||||
FONT_bold :setFallbacks(love.graphics.newFont('res/fonts/techmino_proportional.otf', 26))
|
||||
FONT_big :setFallbacks(love.graphics.newFont('res/fonts/techmino_proportional.otf', 54))
|
||||
CHAR = require("char")
|
||||
|
||||
local font_height = FONT_tromi:getHeight() * 0.5
|
||||
@@ -19,7 +21,7 @@ BUTTON = require "libs.simple-button"
|
||||
BUTTON.setDefaultOption{
|
||||
draw = function(self)
|
||||
local need_big_font = (self.font == FONT_big)
|
||||
|
||||
|
||||
love.graphics.setColor(self.backgroundColor)
|
||||
love.graphics.rectangle('fill', self.x, self.y, self.w, self.h, self.r)
|
||||
|
||||
@@ -35,22 +37,19 @@ BUTTON.setDefaultOption{
|
||||
|
||||
local lineAmount
|
||||
do
|
||||
local _, t
|
||||
if need_big_font then
|
||||
_, t = FONT_big:getWrap(text, (self.w - 5) * 2)
|
||||
else
|
||||
_, t = FONT_tromi:getWrap(text, (self.w - 5) * 2)
|
||||
end
|
||||
local _, t = self.font:getWrap(text, (self.w - 5) * 2)
|
||||
lineAmount = #t
|
||||
end
|
||||
|
||||
|
||||
local _font_height = need_big_font and font_big_height or font_height
|
||||
|
||||
|
||||
local textHeight = _font_height * (lineAmount * 0.5)
|
||||
local textPos = self.y + (self.h * 0.5) - textHeight
|
||||
|
||||
if need_big_font then
|
||||
if self.font == FONT_big then
|
||||
drawBigText(text, self.x + 2.5, textPos, self.w - 5, self.textOrientation, self.textColor)
|
||||
elseif self.font == FONT_bold then
|
||||
drawBoldText(text, self.x + 2.5, textPos, self.w - 5, self.textOrientation, self.textColor)
|
||||
else
|
||||
drawText(text, self.x + 2.5, textPos, self.w - 5, self.textOrientation, self.textColor)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user