Centering a rectangle

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
Purple Fedora
Prole
Posts: 20
Joined: Fri Oct 26, 2018 8:41 pm

Centering a rectangle

Post by Purple Fedora » Thu Nov 22, 2018 1:59 pm

Code: Select all

	canvas = love.graphics.newCanvas(values.width, values.height, {type="2d"}, {format="normal"}, 1)
	love.graphics.setCanvas(canvas)
	love.graphics.clear()
	love.graphics.setColor(blue.r, blue.g, blue.b, blue.a)
	love.graphics.rectangle("fill", 0, 0, values.width, values.width)
	love.graphics.setColor(red.r, red.g, red.b, red.a)
	love.graphics.rectangle("fill", 0, values.width, values.width, values.width)
	love.graphics.setLineWidth(values.edge)
	love.graphics.setColor(0, 0, 0, 0.3)
	love.graphics.rectangle("line", values.edge / 2, values.edge / 2, values.width - values.edge, values.height - values.edge)
	love.graphics.setCanvas()
Why does the darker rectangle look on this canvas so out of the center, did i mess up the code or is it an optical illusion?
Attachments
Unbenannt.PNG
Unbenannt.PNG (942 Bytes) Viewed 1015 times

Post Reply

Who is online

Users browsing this forum: No registered users and 17 guests