## Tutorial 3 is ok?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
peplos
Prole
Posts: 6
Joined: Wed Apr 01, 2009 12:24 pm

### Tutorial 3 is ok?

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.

Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

### Re: Tutorial 3 is ok?

What was your final source code? It worked for me. And welcome to the Löve Club, by the way .

peplos
Prole
Posts: 6
Joined: Wed Apr 01, 2009 12:24 pm

### Re: Tutorial 3 is ok?

code

main.lua
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

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.

Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

### Re: Tutorial 3 is ok?

Code: Select all

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

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.

peplos
Prole
Posts: 6
Joined: Wed Apr 01, 2009 12:24 pm

### Re: Tutorial 3 is ok?

Thanks. with drawf() works properly

mike