mirror of
https://github.com/airstruck/luigi.git
synced 2025-12-18 18:06:44 +00:00
Scrolling improvements, fixes #13
This commit is contained in:
@@ -245,20 +245,4 @@ function Font:getAdvance (text)
|
||||
return w[0]
|
||||
end
|
||||
|
||||
function Font:getWrappedHeight (text)
|
||||
--[[
|
||||
-- TTF_Font *font, const char *text, int wrapLength, int *w, int *h, int *lineCount
|
||||
local w, h, lineCount = IntOut(), IntOut(), IntOut()
|
||||
|
||||
SDL2_ttf.TTF_SizeUTF8_Wrapped(self.sdlFont, text, self.width,
|
||||
w, h, lineCount)
|
||||
|
||||
return self:getLineHeight() * lineCount
|
||||
--]]
|
||||
|
||||
local w, h = IntOut(), IntOut()
|
||||
SDL2_ttf.TTF_SizeUTF8(self.sdlFont, text, w, h)
|
||||
return h[0]
|
||||
end
|
||||
|
||||
return Font
|
||||
|
||||
@@ -77,7 +77,7 @@ local function renderMulti (self, font, text, color, align, limit)
|
||||
sdl.setTextureAlphaMod(self.sdlTexture, alphaMod)
|
||||
end
|
||||
|
||||
self.width, self.height = surface.w, surface.h
|
||||
self.width, self.height = limit, height
|
||||
end
|
||||
|
||||
function Text:constructor (renderer, font, text, color, align, limit)
|
||||
|
||||
@@ -50,16 +50,4 @@ function Font:getAdvance (text)
|
||||
return (self.loveFont:getWidth(text))
|
||||
end
|
||||
|
||||
if love._version_minor < 10 then
|
||||
function Font:getWrappedHeight (text)
|
||||
local _, lines = self.loveFont:getWrap(text, self.width)
|
||||
return lines * self.loveFont:getHeight()
|
||||
end
|
||||
else
|
||||
function Font:getWrappedHeight (text)
|
||||
local _, lines = self.loveFont:getWrap(text, self.width)
|
||||
return #lines * self.loveFont:getHeight()
|
||||
end
|
||||
end
|
||||
|
||||
return Font
|
||||
|
||||
Reference in New Issue
Block a user