Can Canvasses have Background Colour?

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
User avatar
MicroMacro
Citizen
Posts: 92
Joined: Fri May 30, 2014 2:30 am
Location: Boston, MA, USA
Contact:

Can Canvasses have Background Colour?

Post by MicroMacro » Fri Dec 30, 2016 10:07 pm

Title says all. I'm trying to get a cool effect where my canvas (which coincidentally is the same size as my physics area) has a different colour than the rest of the background.

I suppose I could just add a rectangle the size of the canvas before everything else on the canvas, but I wanted to know if background colours are possible.

Thanks!
https://github.com/ebernerd- where you can find all my work.

User avatar
raidho36
Party member
Posts: 1797
Joined: Mon Jun 17, 2013 12:00 pm

Re: Can Canvasses have Background Colour?

Post by raidho36 » Fri Dec 30, 2016 10:09 pm

There is a command to clear entire canvas to a solid color (and alpha) - [wiki]love.graphics.clear[/wiki].

If you wanted to know if Canvas objects have such property - no, they do not. Canvas is a region of VRAM with some contents, it doesn't have parameters beyond pixel format and resolution (also filtering type, since it also acts as a texture).

User avatar
MicroMacro
Citizen
Posts: 92
Joined: Fri May 30, 2014 2:30 am
Location: Boston, MA, USA
Contact:

Re: Can Canvasses have Background Colour?

Post by MicroMacro » Fri Dec 30, 2016 10:37 pm

Thanks! I already was using love.graphics.clear(), didn't know it could pass colours. Woop!
https://github.com/ebernerd- where you can find all my work.

User avatar
zorg
Party member
Posts: 2619
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Can Canvasses have Background Colour?

Post by zorg » Sat Dec 31, 2016 9:54 am

That's what the wiki's there for! :3 [wiki]love.graphics.clear[/wiki]
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 9 guests