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 

Problem with intraFont

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



Joined: 21 Feb 2008
Posts: 386

PostPosted: Fri May 09, 2008 12:19 am    Post subject: Problem with intraFont Reply with quote

I've to print a text over a image loaded with the graphic.c library,
bu the image will not display correctly!
Here is a sample of my source code:
Code:

...
intraFontInit();
intraFont* ltn;
char filen[40];
sprintf(filen, "flash0:/font/ltn8.pgf");
ltn = intraFontLoad(filen,INTRAFONT_CACHE_ASCII);
initGraphics();
while(running){
...
draw various image with blitAlphaImageTo Screen();
...
guStart();
   
intraFontSetStyle(ltn, 0.75f,BLACK,WHITE,0);
intraFontPrint(ltn, 36, 12, "Nome path \n");
   
sceGuFinish();
sceGuSync(0,0);
   
sceDisplayWaitVblankStart();
   
flipScreen();

}
intraFontUnload(ltn);
intraFontShutdown();
sceKernelSleepThread();   
return 0;

}

I've try with this solution but the image on background will show bad!
I've seen Umd Dumper that print text over images with the intraFont,
so is possible but how?
_________________
Get Xplora!


Last edited by ne0h on Sat May 10, 2008 10:21 pm; edited 1 time in total
Back to top
View user's profile Send private message
whistler



Joined: 04 Mar 2008
Posts: 40

PostPosted: Fri May 09, 2008 12:29 am    Post subject: Reply with quote

you could try the oslib mod here

http://forums.qj.net/showthread.php?t=139060&highlight=oslib

Back to top
View user's profile Send private message
ne0h



Joined: 21 Feb 2008
Posts: 386

PostPosted: Fri May 09, 2008 2:16 am    Post subject: Reply with quote

Yes, i can use OS-lib but i want to use graphic.c for this!
because it is much easy than oslib,
can anyone explain me how to do this?
_________________
Get Xplora!
Back to top
View user's profile Send private message
hibbyware



Joined: 28 Mar 2007
Posts: 78

PostPosted: Fri May 09, 2008 4:29 am    Post subject: Reply with quote

intrafont comes with a good example of use with graphics.h
Back to top
View user's profile Send private message
psPea



Joined: 01 Sep 2007
Posts: 64

PostPosted: Fri May 09, 2008 5:03 am    Post subject: Reply with quote

Code:
intraFont* ltn[1];

then
Code:
ltn[8] = intraFontLoad(filen,INTRAFONT_CACHE_ASCII);
???
Try this
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
Insert_witty_name



Joined: 10 May 2006
Posts: 376

PostPosted: Fri May 09, 2008 5:09 am    Post subject: Reply with quote

See the first couple of posts in this thread: http://forums.qj.net/f-psp-development-forum-11/t-cc-programming-help-thread-35024/page828.html#post2011599
Back to top
View user's profile Send private message
ne0h



Joined: 21 Feb 2008
Posts: 386

PostPosted: Fri May 09, 2008 11:32 pm    Post subject: Reply with quote

psPea, don't see this part of code, it's a example
_________________
Get Xplora!
Back to top
View user's profile Send private message
ne0h



Joined: 21 Feb 2008
Posts: 386

PostPosted: Sat May 10, 2008 12:45 am    Post subject: Reply with quote

... the screen is black, and nothing appear on the screen!
But, i've think to convert all my code for the osl lib if is to difficult to do this with the simple graphics lib.
However, can I load a object image included with bin2o with the osl?
_________________
Get Xplora!
Back to top
View user's profile Send private message
Cpasjuste



Joined: 29 May 2005
Posts: 214

PostPosted: Sat May 10, 2008 2:33 am    Post subject: Reply with quote

Porting your code to oslib is a great idea for me, i don't think there is an easier and better librarie for the psp yet.
Back to top
View user's profile Send private message
ne0h



Joined: 21 Feb 2008
Posts: 386

PostPosted: Sat May 10, 2008 5:28 am    Post subject: Reply with quote

I've just finished to port my code to using osl, but not all the same image are display ( i've writed a gui file manager and when list the file if is a folder show the folder.png image in the correct position, with the graphics lib that work great, but now with osl only 1 or (rarely) 2 folder are show whit image!
and than, after i've draw a image whit oslDrawImageXY(...) i've to do somthing or I have only to do oslEndDrawing(); and oslSyncFrame(); at
the end of the while loop? ( excuse me for my very bad english )
_________________
Get Xplora!
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Sat May 10, 2008 5:34 am    Post subject: Reply with quote

@ne0h: If you noticed psPea's comment, your problem (at least one of them) was that you were using an array index that was out of range. No telling what happened to the font pointer when you stored it into a non-existent array index. In the intraFont example, Ben used an array because he opened more than one font. If you only open one font, don't use an array! It's a waste, and you only wound up confusing yourself. Just go with something like

Code:
intraFont* ltn8;
ltn8 = intraFontLoad("flash0:/font/ltn8.pgf",INTRAFONT_CACHE_ASCII);


Then just use ltn8 anywhere you currently use ltn[8].
Back to top
View user's profile Send private message AIM Address
ne0h



Joined: 21 Feb 2008
Posts: 386

PostPosted: Sat May 10, 2008 5:47 am    Post subject: Reply with quote

Yes, I've paste a part of the code of 2 sample!
I've writed my code right! It is a example, not a part of my code!
I'm not stupid, I know the difference beetween a array and a single declaration!
_________________
Get Xplora!
Back to top
View user's profile Send private message
hlide



Joined: 10 Sep 2006
Posts: 750

PostPosted: Sat May 10, 2008 6:06 am    Post subject: Reply with quote

ne0h wrote:
Yes, I've paste a part of the code of 2 sample!
I've writed my code right! It is a example, not a part of my code!
I'm not stupid, I know the difference beetween a array and a single declaration!


I'm sorry to say that you're more stupid than you think : if you want for us to help you, you need to paste your real code which has a problem, not any example.


Last edited by hlide on Sat May 10, 2008 9:38 am; edited 1 time in total
Back to top
View user's profile Send private message
whistler



Joined: 04 Mar 2008
Posts: 40

PostPosted: Sat May 10, 2008 7:16 am    Post subject: Reply with quote

ne0h wrote:
I've just finished to port my code to using osl, but not all the same image are display ( i've writed a gui file manager and when list the file if is a folder show the folder.png image in the correct position, with the graphics lib that work great, but now with osl only 1 or (rarely) 2 folder are show whit image!
and than, after i've draw a image whit oslDrawImageXY(...) i've to do somthing or I have only to do oslEndDrawing(); and oslSyncFrame(); at
the end of the while loop? ( excuse me for my very bad english )


there are some good oslib tutorials here
http://oslib.playeradvance.org/doku.php?id=home

as for the oslib intrafont mod, you'll need to check the sakya's src example
Back to top
View user's profile Send private message
Chrighton



Joined: 15 Jun 2005
Posts: 58

PostPosted: Sat May 10, 2008 8:22 am    Post subject: Reply with quote

hlide wrote:
I'm sorry to say that you're are more stupid than you think : if you want for us to help you, you need to paste your real code which has a problem, not any example.


Yeah.
Back to top
View user's profile Send private message
Art



Joined: 09 Nov 2005
Posts: 647

PostPosted: Sat May 10, 2008 2:14 pm    Post subject: Reply with quote

Yeah!
Not that any advice given would have helped :D

You need to add this:
Code:

   guStart();
   sceGuTexMode(GU_PSM_8888, 0, 0, 0);
   sceGuTexFunc(GU_TFX_REPLACE, GU_TCC_RGBA);
   sceGuTexFilter(GU_NEAREST, GU_NEAREST);
   sceGuFinish();
   sceGuSync(0,0);

At the end of every Intrafont function before flipping the screen.

So the whole thing looks like this:
Code:

      guStart();
      intraFontSetStyle(ltn8, 1.5f,optioncol,0,0);
      intraFontPrint(ltn8, 10, 10, "Hello");
      sceGuFinish();
      sceGuSync(0,0);

   guStart();
   sceGuTexMode(GU_PSM_8888, 0, 0, 0);
   sceGuTexFunc(GU_TFX_REPLACE, GU_TCC_RGBA);
   sceGuTexFilter(GU_NEAREST, GU_NEAREST);
   sceGuFinish();
   sceGuSync(0,0);


So to expanded further, asuming your image is already loaded,
and you're going to take J.F.'s advice:

Code:

intraFontInit();
intraFont* ltn8;
ltn8 = intraFontLoad("flash0:/font/ltn8.pgf",INTRAFONT_CACHE_ASCII);
initGraphics();

blitAlphaImageToScreen(0, 0, 480, 272, backgroundimage, 0,0);
      guStart();
      intraFontSetStyle(ltn8, 1.5f,optioncol,0,0);
      intraFontPrint(ltn8, 10, 10, "Hello");
      sceGuFinish();
      sceGuSync(0,0);

   guStart();
   sceGuTexMode(GU_PSM_8888, 0, 0, 0);
   sceGuTexFunc(GU_TFX_REPLACE, GU_TCC_RGBA);
   sceGuTexFilter(GU_NEAREST, GU_NEAREST);
   sceGuFinish();
   sceGuSync(0,0);

      sceDisplayWaitVblankStart();
      flipScreen();


Great when you actually get help on a forum eh? ;)

Now in the author's defence, you only needed to RTFM! :D
Quote:

If you're using the graphics library then you may need to reset the sceGuTex* states to what
they are defaulted to in the initGraphics() functions, after using the intraFont* functions.

Cheers, Art.
_________________
If not actually, then potentially.
Back to top
View user's profile Send private message
jean



Joined: 05 Jan 2008
Posts: 489

PostPosted: Sat May 10, 2008 7:35 pm    Post subject: Reply with quote

Quote:
Yes, I've paste a part of the code of 2 sample!

He's right, dudes...he had to post partial code because maybe we can steal his precious code! Because he's asking only to stress we understood, not that he really needs it...
[WARNING: sarchasm relevations are beyond safety level...evacuate area immediately]
Back to top
View user's profile Send private message
ne0h



Joined: 21 Feb 2008
Posts: 386

PostPosted: Sat May 10, 2008 10:05 pm    Post subject: Reply with quote

...
whistler, i've already read the example!
( the part that i've writed wrong in the example is not important for do this, and in a following post i've already writed that this is not a problem )
However thanks Art.
jean, la smetti di rompere i coglioni cazzo? Fatti i cazzi tuoi ogni tanto e non rompere le palle agli altri su 20 forums diversi!
_________________
Get Xplora!
Back to top
View user's profile Send private message
Art



Joined: 09 Nov 2005
Posts: 647

PostPosted: Sat May 10, 2008 10:42 pm    Post subject: Reply with quote

Maybe just break everyone's balls on 19 forums.
I think it's how people are amused in programming breaks.
_________________
If not actually, then potentially.
Back to top
View user's profile Send private message
ne0h



Joined: 21 Feb 2008
Posts: 386

PostPosted: Sat May 10, 2008 11:03 pm    Post subject: Reply with quote

I've don't understand very well your post, is reported to me?
However i've just rebuilted my code and it's works great, thanks!
_________________
Get Xplora!
Back to top
View user's profile Send private message
jean



Joined: 05 Jan 2008
Posts: 489

PostPosted: Sat May 10, 2008 11:53 pm    Post subject: Reply with quote

Don't want to start a flame or go completely O.T... It's just a little quarrel between me and Mr neoh because here he demonstrate his little knowledge and huge need of help in pc/psp programming, but in other forums he boasts of great capabilities releasing some code you all contributed to write line by line answering his pressing (and sometimes silly) questions. I could never address someone like this only because i'm bored: i was silent for months, but now i'm sick of it; i'm italian too and now i understand why sometimes italians are avoided like pest. Please, don't make me feel ashamed of being from the same country as you.
Back to top
View user's profile Send private message
ne0h



Joined: 21 Feb 2008
Posts: 386

PostPosted: Sun May 11, 2008 12:17 am    Post subject: Reply with quote

I've never do this! I've never boasts for my project, i've lot to learn and I never write that I'm a good programmer!
Please, if are jealous of my compliments also tries you to write a good project, but leaves alone me!
I know that you from bother because I am not a great programmer and the whole forum of pspdev has given me a lot of help, a lot of times also on stupid things, therefore thanks to the whole forum of pspdev and excuse for all the my stupid posts!
I want to learn not write other post like this to you!, so please leave me alone!
_________________
Get Xplora!
Back to top
View user's profile Send private message
hlide



Joined: 10 Sep 2006
Posts: 750

PostPosted: Sun May 11, 2008 12:31 am    Post subject: Reply with quote

No wonder Mr neoh's topics were too miscellaneous in their subjects. Thanks Jean.
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 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