forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

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

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development
View previous topic :: View next topic  
Author Message
-DaRealXecon-



Joined: 09 Jul 2008
Posts: 31

PostPosted: Mon Sep 08, 2008 3:46 am    Post subject: From LUA to PGE-LUA, I have an little problem... Reply with quote

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:
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?option=com_content&task=view&id=23&Itemid=31

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

-DaRealXecon-
Back to top
View user's profile Send private message MSN Messenger
the underminer



Joined: 03 Oct 2005
Posts: 124
Location: Netherlands

PostPosted: Fri Jun 12, 2009 8:50 pm    Post subject: Reply with quote

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?option=com_content&task=view&id=19&Itemid=31
_________________
Behold! The Underminer got hold of a PSP
Back to top
View user's profile Send private message
MistPhoenix



Joined: 12 Jul 2009
Posts: 23

PostPosted: Wed Jul 22, 2009 1:07 pm    Post subject: Reply with quote

to load a font use the following:

Code:

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()
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group