From LUA to PGE-LUA, I have an little problem...

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

Moderators: Shine, Insert_witty_name

Post Reply
-DaRealXecon-
Posts: 31
Joined: Wed Jul 09, 2008 7:50 am

From LUA to PGE-LUA, I have an little problem...

Post by -DaRealXecon- »

Hi,

I try just PGE - LUA to learn but i have a small problem.... :(

I know how I can do this in LUA but in PGE-LUA there were other commands...

Code: Select all

file = io.open("ms0:/lol.txt","r")
mysting = file:read()
file:close()

newstring = string.sub(mystring,1,12)

screen:print(x,y,"The LoL-File says:" ..newstring)
....
..
and in PGE-LUA....? I don't know... :(

Please help me! :p

here some tipps ;)
http://pge.luaplayer.org/index.php?opti ... &Itemid=31

Thanks in Advance!!
Sorry for my bad English... :'( I hate it self! :D

-DaRealXecon-
the underminer
Posts: 123
Joined: Mon Oct 03, 2005 4:25 am
Location: Netherlands

Post by the underminer »

Although PGE has new file commands, the old ones are still in there and, according to me, just as good. So you can still use that. screen:print cannot be used in PGE. You need to load a font and use that.

http://pge.luaplayer.org/index.php?opti ... &Itemid=31
Behold! The Underminer got hold of a PSP
MistPhoenix
Posts: 22
Joined: Sun Jul 12, 2009 5:09 am

Post by MistPhoenix »

to load a font use the following:

Code: Select all

font = pge.font.load("verdana.ttf", 12, PGE_RAM)      --location of ttf, pixel size, mem location(either PGE_RAM or PGE_VRAM)
white = pge.gfx.createcolor(255, 255, 155)               --r,g,b

--Main Loop
while pge.running() do
   pge.controls.update()
   pge.gfx.startdrawing()
   pge.gfx.clearscreen()

   font:activate()                                           --Activate font for drawing
   font:print(40, 25, white, "Hello World!")       --print the font at x, y, color, text

   pge.gfx.enddrawing()
   pge.gfx.swapbuffers()
end
Make sure that your font is activate() first as shown above only between pge.gfx.startdrawing() and pge.gfx.enddrawing(). Also your font must have a specified color which is the third argument in print()
Post Reply