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

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.
Locked
Bya
Prole
Posts: 20
Joined: Sat Sep 06, 2014 4:24 am

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

Post 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!
User avatar
Ortimh
Citizen
Posts: 90
Joined: Tue Sep 09, 2014 5:07 am
Location: Indonesia

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

Post 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.
User avatar
Ulydev
Party member
Posts: 445
Joined: Mon Nov 10, 2014 10:46 pm
Location: Paris
Contact:

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

Post 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
ntnick
Prole
Posts: 8
Joined: Tue Nov 11, 2014 4:51 pm

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

Post 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.
:awesome: :x
User avatar
undef
Party member
Posts: 438
Joined: Mon Jun 10, 2013 3:09 pm
Location: Berlin
Contact:

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

Post by undef »

Use love.graphics.setColor( r, g, b ), you will have to call this function before you change the color of something.
twitter | steam | indieDB

Check out quadrant on Steam!
User avatar
zorg
Party member
Posts: 3444
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

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

Post 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.
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.
ntnick
Prole
Posts: 8
Joined: Tue Nov 11, 2014 4:51 pm

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

Post 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:
:awesome: :x
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

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

Post 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.
User avatar
Ulydev
Party member
Posts: 445
Joined: Mon Nov 10, 2014 10:46 pm
Location: Paris
Contact:

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

Post by Ulydev »

Awesome ! Thank you for pointing this out.
User avatar
zorg
Party member
Posts: 3444
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

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

Post 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
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.
Locked

Who is online

Users browsing this forum: Google [Bot] and 211 guests