the story beginns
This commit is contained in:
parent
8d21db47f1
commit
203f111b8a
8 changed files with 33 additions and 9 deletions
|
@ -15,11 +15,14 @@ ui.endLine = 1
|
|||
local font = love.graphics.newFont("assets/ui/font.ttf", 24)
|
||||
love.graphics.setFont(font)
|
||||
|
||||
ui.windowWidth = love.graphics.getWidth()
|
||||
ui.windowHeight = love.graphics.getHeight()
|
||||
|
||||
function ui:showMessage(message)
|
||||
ui.active = true
|
||||
|
||||
local maxLines = math.floor((ui.height - ui.border) / font:getHeight())
|
||||
local fullLines = font:getWrap(ui.fullMessage, windowWidth - ui.border)
|
||||
local fullLines = font:getWrap(ui.fullMessage, ui.windowWidth - ui.border)
|
||||
|
||||
ui.textLines = {}
|
||||
|
||||
|
@ -57,9 +60,9 @@ function ui:getMaxString(stringTail)
|
|||
local index = string.len(stringTail)
|
||||
local width = font:getWidth(string.sub(stringTail, 1, index))
|
||||
|
||||
local needsCutting = width > windowWidth - ui.border
|
||||
local needsCutting = width > ui.windowWidth - ui.border
|
||||
|
||||
while width > windowWidth - ui.border do
|
||||
while width > ui.windowWidth - ui.border do
|
||||
width = font:getWidth(string.sub(stringTail, 1, index))
|
||||
index = index - 1
|
||||
end
|
||||
|
@ -79,10 +82,10 @@ end
|
|||
function ui:draw()
|
||||
if ui.active then
|
||||
love.graphics.setColor(255, 255, 255, 150)
|
||||
love.graphics.rectangle("fill", 0, windowHeight - ui.height, windowWidth, ui.height)
|
||||
love.graphics.rectangle("fill", 0, ui.windowHeight - ui.height, ui.windowWidth, ui.height)
|
||||
|
||||
love.graphics.setColor(55, 60, 60, 255)
|
||||
love.graphics.printf(ui.fullMessage, ui.border, windowHeight - ui.height + ui.border, windowWidth - ui.border)
|
||||
love.graphics.printf(ui.fullMessage, ui.border, ui.windowHeight - ui.height + ui.border, ui.windowWidth - ui.border)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue