 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
PosX100
Joined: 15 Aug 2007 Posts: 98
|
Posted: Sun Mar 16, 2008 7:58 am Post subject: BMP font or TTF font library/code sample? |
|
|
Hey guys! , anyone knows where can i find some code (or library)
using bmp font files? or TTF files.
Thanks!
Last edited by PosX100 on Mon Mar 17, 2008 6:32 am; edited 1 time in total |
|
| Back to top |
|
 |
Insert_witty_name
Joined: 10 May 2006 Posts: 376
|
|
| Back to top |
|
 |
PosX100
Joined: 15 Aug 2007 Posts: 98
|
Posted: Mon Mar 17, 2008 5:59 am Post subject: |
|
|
Wow , your lib looks nice.
Im using OSLIB but the font support is very poor.
I have created a "CTextEffects" class which prints preloaded images(OSL_IMAGE **) at a given position(x,y) , and increases the position by m_Img->width().
Im using my class like this:
| Code: |
//loads images from a directory A..Z a..z 0..9
CTextEffects text("data//raw_font_images//");
//add cached text
text.put_in_cache("Test text","TEST1");
//print cached text
text.print_from_cache("TEST1");
//another example(without using cached text)
text.print("Hello..");
//clean up
text.clear();
|
Easy ,...but very slow ..
Just 2 questions..
1)Your library is compatible with OSLIB?
2)And i would also like to know if it supports complex(with cool characters) TTF files.
Edit: Ohh , it uses freetype library..hmm then i guess it will work with any font file :) |
|
| Back to top |
|
 |
PosX100
Joined: 15 Aug 2007 Posts: 98
|
Posted: Mon Mar 17, 2008 9:38 pm Post subject: |
|
|
Too bad ...it doesn't work with oslib....(or im doing something wrong)
Here's my test code :
DEMO.CPP :
| Code: |
e->init(INIT_SOUND|INIT_GFX);
e->sound.push("lol.wav","L1");
pgeFont *f = pgeFontLoad("impact.ttf", 20, PGE_FONT_SIZE_PIXELS, 128);
if(!f)e->sys.shutdown();
pgeFontActivate(f);
while(e->sys.running())
{
e->sound.play("L1");
int t = e->timer.elapsedTime();
std::string s = e->conv_util.int2str(t);
e->events.proccess();
if(e->buttonPressed(B_CROSS))e->sys.shutdown();
e->gfx.begin();
pgeFontPrint(f,200, 200, RED, s.c_str());
e->gfx.end();
e->sound.proccessChannels();
e->timer.update();
}
|
| Code: |
gfx begin code:
oslCls();
oslStartDrawing();
gfx end code :
oslEndDrawing();
oslSwapBuffers();
oslEndFrame();
|
|
|
| Back to top |
|
 |
|
|
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
|