Page 1 of 2

Draw Text Rotated?

Posted: Thu Jul 30, 2009 11:51 pm
by peaches
I'm playing with kinetic type, but none of the text-drawing algorithms allow rotated text. Is there a way around this than other making images of A-Z, or doing procedural vectors?

Re: Draw Text Rotated?

Posted: Fri Jul 31, 2009 12:24 am
by Jasoco

Code: Select all

love.graphics.draw(text, x, y, rotation, scale)
Works with fonts based on images. Not sure if it'll work with fonts based on actual font calls.

For a starter image font, I just steal the one from one of the many examples (Like sinescroller) and shrink it to 50% (Using Photoshop's nearest neighbor method) and color it to black instead of blue. (I use it for my debug messages in my game since it looks good on any background and sticks out enough to know it's for debugging, not for release.)

Re: Draw Text Rotated?

Posted: Fri Jul 31, 2009 2:12 am
by TechnoCat
I love kinetic type. I'm really interested in seeing what you come up with.
YouTube - HARUHI intro - KineticTypography I love this stuff.

Re: Draw Text Rotated?

Posted: Fri Jul 31, 2009 6:35 pm
by peaches
So i was dumb; I mean is there a formatted draw (love.graphics.drawf) that can be rotated?

love.graphics.draw() is annoying because it doesn't offer good options for rotating around the center, other than computing it yourself.

Re: Draw Text Rotated?

Posted: Fri Jul 31, 2009 8:33 pm
by Jasoco
I think LÖVE's drawing commands should have been designed a little differently keeping the text drawing separate from the shape drawing. Like love.graphics.drawText("Hello!", x, y, rotation, angle) and love.graphics.drawImage(image, x, y, ...) to keep them separate from each other. Because it seems to be you can use both draw and drawf for text depending on if you want it rotated and scaled or not. I stumbled onto this accidentally when I gave my text wrong parameters and the wrong draw command, instead of drawing a text box with a fixed width, it drew a rotated, scaled text string. There should have been completely different commands for drawing different things. Because drawf may do text, but draw can also do text which gets confusing.

From the documentation:

Code: Select all

draw( string, x, y )   	 Draws text on screen.
draw( string, x, y, angle ) 	Draws rotated text on screen.
draw( string, x, y, angle, s ) 	Draws rotated/scaled text on screen.
draw( string, x, y, angle, sx, sy ) 	Draws rotated/scaled text on screen.
draw( sprite, x, y ) 	Draws an Image or Animation on screen.
draw( sprite, x, y, angle ) 	Draws a rotated Image or Animation on screen.
draw( sprite, x, y, angle, s ) 	Draws a rotated/scaled Image or Animation on screen.
draw( sprite, x, y, angle, sx, sy ) 	Draws a rotated/scaled Image or Animation on screen.
draw( particlesystem, x, y ) 	Draws a particle system on screen.

drawf( string, x, y, limit )   	 Draws formatted text on screen, with word wrap.
drawf( string, x, y, limit, align ) 	Draws formatted text on screen, with word wrap.
	
draws( image, x, y, cx, cy, w, h ) 	Draws a subsprite of an Image.
draws( image, x, y, cx, cy, w, h, angle ) 	Draws a rotated subsprite of an Image.
draws( image, x, y, cx, cy, w, h, angle, s ) 	Draws a rotated/scaled subsprite of an Image.
draws( image, x, y, cx, cy, w, h, angle, sx, sy ) 	Draws a rotated/scaled subsprite of an Image.
draws( image, x, y, cx, cy, w, h, angle, sx, sy, ox, oy )
Note draw is used for both text strings AND images. Depending on what you pass to it. And then it can also be used for particles! But you can also use draws for sprites of a different kind, or drawf for text. Now that's just confusing.

*sigh* I remember the good old simple days of
LOCATE 10,10
PRINT "HELLO!"
LINE (0,9)-(50,9), 15

Re: Draw Text Rotated?

Posted: Sat Aug 01, 2009 8:48 am
by Robin
Wasn't that changed in 0.6.0?

Re: Draw Text Rotated?

Posted: Sun Aug 02, 2009 12:34 am
by Jasoco
I don't know. Is 0.6.0 even out? I haven't seen it yet.

Re: Draw Text Rotated?

Posted: Sun Aug 02, 2009 5:51 am
by Robin
No, but if you feel reckless, I suppose you could use the development SVN/Mercurial or whatever they are using at the moment.

Re: Draw Text Rotated?

Posted: Sun Aug 02, 2009 5:53 am
by Jasoco
Not sure I'm feeling wreckless at the moment, but I will look at the changes coming so far. :ultraglee:

Re: Draw Text Rotated?

Posted: Thu Aug 27, 2009 9:35 am
by Mr. Strange
I've been waiting for rotated + line-wrapped text for quite a while now. I don't see it listed specifically in the 0.6.0 list linked above...

Perhaps you simply mean that draw functions for images and text are disambiguated? That's cool, but the OP and I still want to rotate our formatted text.

Can we get confirmation on the presence / absence of that feature in the next release?

--Mr. Strange