PGELua and pge.font.load

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
nimblejack
Posts: 4
Joined: Sun Jan 24, 2010 6:13 am

PGELua and pge.font.load

Post by nimblejack »

I've wanted to toy with PSP homebrew for awhile. I've actually taken the time to set up the PSP toolchain more than once, but I lost interest in it halfway. The other day I had the urge to recreate a very simple game that I LOVE (We Want You :official: :forum post:). So today I decided to use LuaPlayer at the suggestion of a friend of mine who used to do a lot of PSP homebrew for some quick and easy development (Lua is awesome). After about an hour of laying the framework for my game in Lua, I made a test and loaded it up on my PSP to find that LuaPlayer doesn't work on my PSP (slim, 5.00 m33-6).

Anyway, after a lot of searching and being annoyed, I decided to use PGELua (after seeing that it actually works).

I've finished converting the majority of my system to use pge and I seem to have hit a snag. I can't seem to get it to load fonts from a subdirectory properly. At the moment I have a list of fonts and their locations in the filesystem, but no matter how I set it up, if the font isn't in the same directory as the PBP it simply doesn't work.

Code: Select all

font_scribble	= "./fonts/Skribble.ttf"
...
s_font = pge.font.load(font_scribble, 12)
...
This is an example of exactly what I'm doing. I've reordered the location every which way I know how. "/fonts/", "fonts/", etc... I've also renamed the folder, and double checked that everything is in its proper place. Just moving the font to the same directory as the PBP and referencing it as just "Skribble.ttf" works perfectly.

Does anyone know why this might be happening?
Any suggestions would be appreciated.

edit: woops. I see there's a PSP LuaPlayer section.
Last edited by nimblejack on Sun Jan 24, 2010 6:52 am, edited 1 time in total.
WosRet
Posts: 14
Joined: Wed Apr 23, 2008 3:20 am
Location: Confoederatio Helvetica

Post by WosRet »

hmmm... how about using an absolute path like: "ms0:/PSP/GAME/whatever/fonts/Skribble.ttf" ?
nimblejack
Posts: 4
Joined: Sun Jan 24, 2010 6:13 am

Post by nimblejack »

WosRet wrote:hmmm... how about using an absolute path like: "ms0:/PSP/GAME/whatever/fonts/Skribble.ttf" ?
I considered that, but I reaaaaaaally would like not to, considering the folder could be moved anywhere.
I'd really prefer not to force something like that.

I haven't tested it though.
WosRet
Posts: 14
Joined: Wed Apr 23, 2008 3:20 am
Location: Confoederatio Helvetica

Post by WosRet »

i don't know lua much, but exist a command like pwd -print working directory- ? then use that as preference? ... reference. sorry for my english....

edit: btw, is there an existing source code for pge lua?
nimblejack
Posts: 4
Joined: Sun Jan 24, 2010 6:13 am

Post by nimblejack »

WosRet wrote:i don't know lua much, but exist a command like pwd -print working directory- ? then use that as preference? ... reference. sorry for my english....

edit: btw, is there an existing source code for pge lua?
You sir are a genius.

Unfortunately, pge.dir.getcwd() returns the proper location (ms0:/PSP/GAME/<game_dir>).
pge.file.exists("/fonts/etc...") is returning false nonetheless.
edit: I'm gonna try pge.file.exists(pge.dir.getcwd() .. "/fonts/etc...").

Quite frustrating.

Also, I have no clue if there's a public source code available.
WosRet
Posts: 14
Joined: Wed Apr 23, 2008 3:20 am
Location: Confoederatio Helvetica

Post by WosRet »

nimblejack wrote:You sir are a genius.
oh... thanks by the way. :) (looking for problem by it's easiest way...) don't know, but it's a simple bug in your code, or a simple bug in pge lua code.

edit: english is not really my native language...
edit2: looking in the samples dir didn't really help much yet....
edit3: perhaps defining path as local var like: local path = "/fonts" then using pge.dir.chdir(path), and then loading the .ttf?
nimblejack
Posts: 4
Joined: Sun Jan 24, 2010 6:13 am

Post by nimblejack »

Alright, I think it might have something to do with the fonts I'm trying to use.
I just did some tests loading multiple fonts, and it would report errors loading some, but not others.
All of them are truetype fonts, but for some reason some of them just don't "work."
Will test more and report back.
WosRet
Posts: 14
Joined: Wed Apr 23, 2008 3:20 am
Location: Confoederatio Helvetica

Post by WosRet »

nimblejack wrote:... loading some, but not others.
yeah, it's perhaps a version issue...
Post Reply