Page 1 of 1

Tutorial 3 is ok?

Posted: Wed Apr 01, 2009 12:29 pm
by peplos
I coded the tutorial 3 and I believe that it didn't do all that I suppose that it do.

and....

Nice to meet you all.

Re: Tutorial 3 is ok?

Posted: Wed Apr 01, 2009 1:30 pm
by Robin
What was your final source code? It worked for me. And welcome to the Löve Club, by the way ^^.

Re: Tutorial 3 is ok?

Posted: Wed Apr 01, 2009 7:19 pm
by peplos
code

main.lua
function load()
font = love.graphics.newFont (love.default_font, 14)
love.graphics.setFont (font)

end

function draw()

love.graphics.draw("A really long sentence whitch will probably be broken into many ieces by my love.", 500,100,250, love.align_right)

love.graphics.draw("This text will be centered no matter what.\n(and you LOVE it)", 0, 400,800, love.align_center)

love.graphics.draw("Aligned to the left, yer very much so",100, 500,150)


end
output
Image


and I saw i little error in the tutorial "Using Input" ->http://love2d.org/documentation?page=tutorial&id=005 it need a " in the first function draw.

Re: Tutorial 3 is ok?

Posted: Wed Apr 01, 2009 7:40 pm
by Robin

Code: Select all

-- Tutorial: Fonts and Text
-- Adding font objects and drawing some text.

function load()

	defaultfont = love.graphics.newFont(love.default_font, 14)
	fontfile = love.graphics.newFont("LOTR.TTF", 14)
	imagefont = love.graphics.newImageFont("imagefont.png", " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,!?-+/():;%&`'*#=[]\"")
	
	love.graphics.setFont(defaultfont) -- change the font in here to see the changes
	love.graphics.setColor(255,255,255,255) -- we need to set a color as well
	num = 15

end

function draw()

	love.graphics.draw("This is some awesome text", 100, 100) -- drawn at the position (100,100)
	love.graphics.draw(num, 100, 150)
	love.graphics.draw("This is the first line\nThis is the second one.\n(and a third)\n\nfifth", 100, 200)
	love.graphics.drawf("A really long sentence which will probably be broken into many pieces by my love.", 500, 100, 250, love.align_right)
	love.graphics.drawf("This text will be centered no matter what!\n(and you LOVE it)", 0, 400, 800, love.align_center)
	love.graphics.drawf("Aligned to the left, yes very much so.", 100, 500, 150)

end
And if I run that, it looks normal. You need to call drawf() instead of draw() for those strings that you want word-wrapped. When calling draw(), the limit will be taken as an angle.

Re: Tutorial 3 is ok?

Posted: Thu Apr 02, 2009 5:09 pm
by peplos
Thanks. with drawf() works properly

Re: Tutorial 3 is ok?

Posted: Thu Apr 02, 2009 8:32 pm
by mike
Did somebody forget to update the tutorial? Yes.
Am I going to fix it? No.