Submit Your Own Code

PSP Lua CodeBase : Centered Text with with your own font (.TTF)

Description:
This function allows you to print your own font and to center your
text. Thanks to Access_Denied for the center text function, and EminentJonFrost for
the load/print a font.

--Colors 
white=(255,255,255) 

--Font 
font=Font.load("font.ttf") 
font:setPixelSizes(0,10) 

--Functions 
function printCenteredfont(y,text,color) 
local length = string.len(text) 
local x = 240 - ((length*8)/2) 
screen:fontPrint(font,x,y,text,color) 
end 

--Main Loop 
while true do 
screen:clear() 
printCentered(100,"Wow, its my font and its in the middle!",white) 
screen.waitVblankStart() 
screen.flip() 
end

Back to CodeBase
 

Please welcome jramada, our newest member.

Who's Online: 5 Guests, 0 Users

Total Members: 555
Total Posts: 13059
Total Topics: 1480
Total Categories: 8
Total Boards: 35

Recent Posts:

Re: PGELua Help - need term for a special rotation fix (mathematical issue) by yaustar
Re: Lua Loader? by Buddy4point0
Re: Lua Loader? by osgeld
Re: Lua Loader? by acer5050
Re: Lua Loader? by bumuckl
Re: Lua Loader? by acer5050
Re: Lua Loader? by bumuckl
Lua Loader? by acer5050


Copyright © 2006-2007 www.EvilMana.com All rights reserved.
EvilMana Logo by emcp and Charlie