Outlined text

Discuss using and improving Lua and the Lua Player specific to the PSP.

Moderators: Shine, Insert_witty_name

Post Reply
Debug
Posts: 16
Joined: Thu Oct 06, 2005 4:16 am

Outlined text

Post by Debug »

I have made a function to outline your text in black, very simple but handy for when you don't know what color your background will be, or if you want your text to stand out.

Code: Select all

function printOutline(x,y,text, color)
	local x2, y2
	for x2 = 0,2 do
		for y2 = 0,2 do
			screen:print(x+x2, y+y2, text)
		end
	end
	screen:print(x+1,y+1,text,color)
end
I suppose you could use the same concept for bold...

Code: Select all

function printBold(x,y,text,color)
     screen:print(x,y,text,color)
     screen:print(x+1,y,text, color)
end
...and here's one to write 2x sized text:

Code: Select all

function strech(x,y,text,color)
	local buffer=Image.createEmpty(480,272)
	buffer:print(0,0,text,color)
	local b2 = Image.createEmpty(480,272)
	for x1 = 0, 240 do
		for y1 = 0, 136 do
			b2:blit(x1*2,y1*2,buffer,x1,y1,1,1)
		end
	end
	screen:blit(x,y,b2)
	screen:blit(x,y+1,b2)
	screen:blit(x+1,y,b2)
	screen:blit(x+1,y+1,b2)
end
I could write something that makes an image from a string to italicize it, but I'm too tired right now. I might after school tomorrow if anyone's interested.

Code: Select all

catch(IOException e){
//oh crap
}
Zenurb
Posts: 106
Joined: Fri Sep 30, 2005 8:33 am
Location: United Kingdom
Contact:

Post by Zenurb »

well just define the leading of the italic and move the x of the image on each y over by whatever until you get to the bottom so

| becomes /
Proud Dvorak User
US 1.5 PSP (Original)
Post Reply