love 0.9.2 support

This commit is contained in:
airstruck
2015-10-28 05:37:42 -04:00
parent 18f51c2ac3
commit 31b77234f5
4 changed files with 34 additions and 6 deletions

View File

@@ -52,9 +52,18 @@ function Font:getAdvance (text)
return (self.font:getWidth(text))
end
function Font:getWrappedHeight (text)
local _, lines = self.font:getWrap(text, self.layout.width)
return #lines * self.font:getHeight()
local major, minor, revision, codename = love.getVersion()
if minor < 10 then
function Font:getWrappedHeight (text)
local _, lines = self.font:getWrap(text, self.layout.width)
return lines * self.font:getHeight()
end
else
function Font:getWrappedHeight (text)
local _, lines = self.font:getWrap(text, self.layout.width)
return #lines * self.font:getHeight()
end
end
return Font