Page 1 of 1

Text

Posted: Wed Sep 29, 2010 8:32 pm
by intensity
Is there a way to edit the text and position of a love.graphics.print() string? If not is there another type of onscreen text?

Re: Text

Posted: Wed Sep 29, 2010 8:47 pm
by Robin
How familiar are you with Lua/programming in general?

You see, for that purpose variables are used. If you know how to program, there's your answer. If not, I'd recommend learning some basic programming skills first. :)

Re: Text

Posted: Wed Sep 29, 2010 8:57 pm
by intensity
I've been using Lua for about a year, but I just downloaded Love. Are you saying love.graphics.print() returns the text object?

Re: Text

Posted: Wed Sep 29, 2010 9:06 pm
by Taehl
No, it's a function. You pass it the parameters of text and position.

Re: Text

Posted: Wed Sep 29, 2010 9:07 pm
by Robin
intensity wrote:I've been using Lua for about a year, but I just downloaded Love. Are you saying love.graphics.print() returns the text object?
No, but you can use variables as arguments to love.graphics.print():

Code: Select all

love.graphics.print(t, x, y)
Changing the value of any of these will change what or where it is printed the next frame.

Re: Text

Posted: Wed Sep 29, 2010 9:09 pm
by intensity
So if I wanted to make a changing text on screen, what should I use?

Re: Text

Posted: Wed Sep 29, 2010 9:45 pm
by Robin

Re: Text

Posted: Wed Sep 29, 2010 10:05 pm
by intensity
All it is is changing the value of a variable called text... does text actually represent something in the renderer?

Re: Text

Posted: Wed Sep 29, 2010 10:10 pm
by TechnoCat
intensity wrote:All it is is changing the value of a variable called text... does text actually represent something in the renderer?
It does if you pass 'text' to love.graphics.draw()
I have a feeling love callbacks is what you actually need to read though. Hopefully learning about the LOVE callbacks will help you understand what is going on.

Re: Text

Posted: Wed Sep 29, 2010 10:19 pm
by Robin
TechnoCat wrote:
intensity wrote:All it is is changing the value of a variable called text... does text actually represent something in the renderer?
It does if you pass 'text' to love.graphics.print()
FIFY.