-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtext.lua
32 lines (26 loc) · 997 Bytes
/
text.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
text = {}
function text.print(txt, x, y, fontAlias)
local _shader = love.graphics.getShader()
if fontAlias then love.graphics.setShader(shaders.fontAlias) end
love.graphics.print(txt, lume.round(x), lume.round(y))
love.graphics.setShader(_shader)
end
function text.printSmall(txt, x, y, fontAlias)
local _canvas = love.graphics.getCanvas()
local _shader = love.graphics.getShader()
setGameCanvas2x()
if fontAlias then love.graphics.setShader(shaders.fontAlias) end
love.graphics.push()
-- set camera with 2x screen size
if camera.isSet then
love.graphics.origin()
love.graphics.translate(camera.ssx, camera.ssy)
love.graphics.scale(camera.scale)
love.graphics.rotate(camera.rotation)
love.graphics.translate(-camera.x*2, -camera.y*2)
end
love.graphics.print(txt, lume.round(x*2), lume.round(y*2))
love.graphics.pop()
love.graphics.setCanvas(_canvas)
love.graphics.setShader(_shader)
end