Tutorial 3 is ok?

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.
Post Reply
User avatar
peplos
Prole
Posts: 6
Joined: Wed Apr 01, 2009 12:24 pm

Tutorial 3 is ok?

Post by peplos » Wed Apr 01, 2009 12:29 pm

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.

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

Re: Tutorial 3 is ok?

Post by Robin » Wed Apr 01, 2009 1:30 pm

What was your final source code? It worked for me. And welcome to the Löve Club, by the way ^^.
Help us help you: attach a .love.

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

Re: Tutorial 3 is ok?

Post by peplos » Wed Apr 01, 2009 7:19 pm

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.

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

Re: Tutorial 3 is ok?

Post by Robin » Wed Apr 01, 2009 7:40 pm

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.
Help us help you: attach a .love.

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

Re: Tutorial 3 is ok?

Post by peplos » Thu Apr 02, 2009 5:09 pm

Thanks. with drawf() works properly

User avatar
mike
Administrator
Posts: 364
Joined: Mon Feb 04, 2008 5:24 pm

Re: Tutorial 3 is ok?

Post by mike » Thu Apr 02, 2009 8:32 pm

Did somebody forget to update the tutorial? Yes.
Am I going to fix it? No.
Now posting IN STEREO (where available)

Post Reply

Who is online

Users browsing this forum: ivan and 10 guests