PDA

View Full Version : Print text rotated 90 degrees in lua?



Anonymous D
July 19th, 2007, 19:00
does anyone know of a way to print text rotated 90 degress right? im making a game in LUA and i want to have the psp turned round to play it, to take advantage of the longer screen length. but this means i need to print the variables "down" the right side. is there a simple way to do this?

sorta like this:
http://i184.photobucket.com/albums/x170/Anonymous_D/demo.jpg

drEDN4wt
July 19th, 2007, 20:18
well if you use the 3d functions you could print your text to an image, then use the image as a skin for a flat plane and rotate it to whatever you like, even give it perspective, lighting, even reflections supposedly.

Or edit a font script from another app that doesnt use truetype or standard lua fonts , but have the characters rotated 90 degrees

Anonymous D
July 19th, 2007, 21:28
im rly not good on 3d functions, ill look into the true type font thing

ive looked at the ttf example on evil mana and i dont think i rly cvan do it with that, at least not myself, cud you point me in the right directions with the 3D functions? mb its time i learnt them

drEDN4wt
July 19th, 2007, 21:35
look at ttlde as an example....its a text editor...look at ascii.png and rotate it in a graphics program.
then when you understand that bit and get it working, do your own font.

-Xandu-
July 19th, 2007, 21:39
The font thing with truetype is pretty stupid no offence, the text will come out like this:
http://i166.photobucket.com/albums/u120/SXandu/TEXT.png

But yeah, you can print the text to a buffer and then rotate it using the GU.

Note: PM me if you need help with coding, I have no current project in hand.

Anonymous D
July 19th, 2007, 21:46
using the GU?? plz explain to me and yes thats the conclusion i came to.

-Xandu-
July 19th, 2007, 22:19
Here's the link to 3D GU mapping in Lua (http://wiki.ps2dev.org/psp:lua_player:functions#3d_gu_mapping).

Anonymous D
July 19th, 2007, 22:39
i presume Gum.rotateXYZ might be the thing i need
so can i like...
Gu.start3d()
(normal print command)
Gum.rotateXYZ (rotate text)(though i dont know what format the values go in if any)
screen:clear()

(normal blit functions)

dangee
July 20th, 2007, 14:04
Dont believe it, ur heading for GumsVille less than
a month after arriving at the main() gates of LuaLand!
Wondered if this means the 2d-sidescrollers on its way
to 3d-frontscrollerness...
I found a detailed Gu library guide (funcs,args,func. descriptons)
somewhere not long ago but didnt save the url, so U'd
have to hunt for it,if SUM1 dont post the link.

Anonymous D
July 20th, 2007, 14:12
the only trhing i need to do is rotate the text rly, themamin game is 2d sprites and is basically finished, i just thought itd be cool to have it run "vertically", as you can just turn the psp, but then the text is dodgy.

dangee
July 20th, 2007, 14:55
thought maybe ur doing the 2plyr heads-up space invaders thng.
found this dog-eared .html in my Recycle bin.

Anonymous D
July 20th, 2007, 18:58
right.....this is so confudisng me i think ill stick to horizontal for now

dangee
July 20th, 2007, 20:18
Didnt intend to put u off using Gu, its a powerful
resource ,well worth any time taken to get it working.
Guess its 1 of them thngs thats easier to learn by
hacking about with working code snippets to see what
happens, rather than trying to decipher the manual. Not
yet much Lua Gu source about tho.

So sure I saw a Lua function somewhere (no Gum) that
rewrote the pixels of an image to turn it 90,180 or 270.

drEDN4wt
July 20th, 2007, 22:05
the pixel by pixel method is too slow.

i believe the fastest method would be a re-write of the method used in ttlde and others.

ttlde does not use print or fontprint.
it has the font laid out in an image file as below.
yours could be alot simpler if you don't need chinease :) .

you then have the text you wish to print, read it character by character and using its ascii code you look-up the character in your font image file.
then blit just the area of the font image file that has your char in....then the next but instead of bliting the next to the right of the previous one....blit it below/above it ;) .

or if you want to try 3d gu...heres a link to an early app of mine that uses the 3d gu to show thousands of triangles.

http://www.dcemu.co.uk/vbulletin/showthread.php?t=21242

dangee
July 22nd, 2007, 05:35
Dammit, got into this-didnt want to ,but enjoyed it anyway.
hope you can use this code AnonD, should help you avoid the
goo ...for the time being...,
(unless, of course,
drED's tasty sauce
changed ur mind at all)

drEDN4wt
July 22nd, 2007, 22:26
wow...thats whats i was talking about....nice one dangee.

it may be even faster though if it created all the needed characters in one go before they were needed, to get all the print commands out of the way,

or have them in an image file as i said earlier.

but still, your solution is superb :thumbup: and probably far better than he deserves :p jk.

dangee
July 23rd, 2007, 15:53
..& ur praise is probbly more than I deserve
but thx NEhow drED, its always easier to code a clearly described
solution. Actually,it was great to find some more GU stuff
to work with.
I dont think AnonD really expected what looked like a
straight-forward piece of coding to get so complex.

Itd be nice to see a Sticky Gum 'n' Goo tutorial...