summaryrefslogtreecommitdiff
path: root/print_good2.lua
blob: 719120cb51f2c1ae954c364c99feef849ba18082 (plain)
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
local G = love.graphics
local font = G.getFont()
local text = G.newText(font)

local function print_good(str,x,y,tcol,bcol,nob)
	text:setFont(G.getFont())
	text:set(str)
	local w,h = text:getDimensions()
	local sx,sy = G.transformPoint(x,y)
	sx,sy = math.floor(sx),math.floor(sy)
	-- local W,H = G.getDimensions()
	-- if x == "center" then x = (W/2)-(w/2) end
	-- if y == "center" then y = (H/2)-(h/2) end
	-- if x == "end" then  x = W-w end
	-- if y == "end" then  y = H-h end
	G.push()
	G.origin()
	if not nob then
		G.setColor(bcol or {0,0,0,0.8})
		G.rectangle("fill",sx,sy,w,h) 
	end
	G.setColor(tcol or {1,1,1})
	G.draw(text,sx,sy)
	G.pop()
end


return print_good