Page 24 of 91

Re: "Questions that don't deserve their own thread" thread

Posted: Sun Oct 19, 2014 8:29 am
by Bya
Oh, that's what I've been doing, but I figured there might be some easier way to do it like a .terminate function I was unaware of or something. Thanks though!

Re: "Questions that don't deserve their own thread" thread

Posted: Tue Nov 11, 2014 7:26 am
by Ortimh
I need help on how to load a file without having the file inside *.love. Let me clear this up for you.
I have a *.love only with main.lua and conf.lua. I want to load an image inside the folder where the *.love created.

Re: "Questions that don't deserve their own thread" thread

Posted: Tue Nov 11, 2014 3:45 pm
by Ulydev
Hello everyone, I just wanted to know why setFilterData() has been removed since 0.8.0 ? Is there any other function to set filters ?

Thank you ! :3

Re: "Questions that don't deserve their own thread" thread

Posted: Tue Nov 11, 2014 5:00 pm
by ntnick
How do I set the background colour of text?

Code: Select all

love.graphics.setBackgroundColor(77, 77, 77) -- hex #4d4d4d
just sets the background colour of the whole window itself, not the text's background colour, this is what it looks like.

Re: "Questions that don't deserve their own thread" thread

Posted: Tue Nov 11, 2014 7:01 pm
by undef
Use love.graphics.setColor( r, g, b ), you will have to call this function before you change the color of something.

Re: "Questions that don't deserve their own thread" thread

Posted: Tue Nov 11, 2014 7:25 pm
by zorg
undef wrote:Use love.graphics.setColor( r, g, b ), you will have to call this function before you change the color of something.
He asked about the background color of a text, which you can't set by default, but you can write a quick and dirty wrapper: (untested, but should work)

Code: Select all

function drawBgText(text,x,y,fgc,bgc) -- bgc and fgc are tables, containing the color triplets, or quadruplets if you include alpha as well
local f = love.graphics.getFont()
local w,h = f:getWidth(text), f:getHeight()
love.graphics.setColor(unpack(bgc))
love.graphics.rectangle('fill',x,y,w,h)
love.graphics.setColor(unpack(fgc))
love.graphics.print(text,x,y)
end
You can of course extend something like this with wrapping, orientation, scale, offset, etc... but this is the basic way that i know of.

Re: "Questions that don't deserve their own thread" thread

Posted: Wed Nov 12, 2014 2:43 am
by ntnick
zorg wrote:
undef wrote:Use love.graphics.setColor( r, g, b ), you will have to call this function before you change the color of something.
He asked about the background color of a text, which you can't set by default, but you can write a quick and dirty wrapper: (untested, but should work)

Code: Select all

function drawBgText(text,x,y,fgc,bgc) -- bgc and fgc are tables, containing the color triplets, or quadruplets if you include alpha as well
local f = love.graphics.getFont()
local w,h = f:getWidth(text), f:getHeight()
love.graphics.setColor(unpack(bgc))
love.graphics.rectangle('fill',x,y,w,h)
love.graphics.setColor(unpack(fgc))
love.graphics.print(text,x,y)
end
You can of course extend something like this with wrapping, orientation, scale, offset, etc... but this is the basic way that i know of.
Thank you very much for your solution! :awesome:

Re: "Questions that don't deserve their own thread" thread

Posted: Wed Nov 12, 2014 9:09 am
by bartbes
Ulydev wrote:Hello everyone, I just wanted to know why setFilterData() has been removed since 0.8.0 ? Is there any other function to set filters ?
It wasn't removed, it was moved to Fixture.

Re: "Questions that don't deserve their own thread" thread

Posted: Wed Nov 12, 2014 12:30 pm
by Ulydev
Awesome ! Thank you for pointing this out.

Re: "Questions that don't deserve their own thread" thread

Posted: Wed Nov 12, 2014 1:29 pm
by zorg
Ortimh wrote:I need help on how to load a file without having the file inside *.love. Let me clear this up for you.
I have a *.love only with main.lua and conf.lua. I want to load an image inside the folder where the *.love created.
You can't, not with love.filesystem at least
You'd need to use lua's own io stuff, which you shouldn't