| View previous topic :: View next topic |
| Author |
Message |
ne0h
Joined: 21 Feb 2008 Posts: 386
|
Posted: Fri May 09, 2008 12:19 am Post subject: Problem with intraFont |
|
|
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 |
|
 |
whistler
Joined: 04 Mar 2008 Posts: 40
|
|
| Back to top |
|
 |
ne0h
Joined: 21 Feb 2008 Posts: 386
|
Posted: Fri May 09, 2008 2:16 am Post subject: |
|
|
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 |
|
 |
hibbyware
Joined: 28 Mar 2007 Posts: 78
|
Posted: Fri May 09, 2008 4:29 am Post subject: |
|
|
| intrafont comes with a good example of use with graphics.h |
|
| Back to top |
|
 |
psPea
Joined: 01 Sep 2007 Posts: 64
|
Posted: Fri May 09, 2008 5:03 am Post subject: |
|
|
then | Code: | | ltn[8] = intraFontLoad(filen,INTRAFONT_CACHE_ASCII); | ???
Try this |
|
| Back to top |
|
 |
Insert_witty_name
Joined: 10 May 2006 Posts: 376
|
|
| Back to top |
|
 |
ne0h
Joined: 21 Feb 2008 Posts: 386
|
Posted: Fri May 09, 2008 11:32 pm Post subject: |
|
|
psPea, don't see this part of code, it's a example _________________ Get Xplora! |
|
| Back to top |
|
 |
ne0h
Joined: 21 Feb 2008 Posts: 386
|
Posted: Sat May 10, 2008 12:45 am Post subject: |
|
|
... 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 |
|
 |
Cpasjuste
Joined: 29 May 2005 Posts: 214
|
Posted: Sat May 10, 2008 2:33 am Post subject: |
|
|
| 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 |
|
 |
ne0h
Joined: 21 Feb 2008 Posts: 386
|
Posted: Sat May 10, 2008 5:28 am Post subject: |
|
|
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 |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Sat May 10, 2008 5:34 am Post subject: |
|
|
@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 |
|
 |
ne0h
Joined: 21 Feb 2008 Posts: 386
|
Posted: Sat May 10, 2008 5:47 am Post subject: |
|
|
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 |
|
 |
hlide
Joined: 10 Sep 2006 Posts: 750
|
Posted: Sat May 10, 2008 6:06 am Post subject: |
|
|
| 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 |
|
 |
whistler
Joined: 04 Mar 2008 Posts: 40
|
Posted: Sat May 10, 2008 7:16 am Post subject: |
|
|
| 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 |
|
 |
Chrighton
Joined: 15 Jun 2005 Posts: 58
|
Posted: Sat May 10, 2008 8:22 am Post subject: |
|
|
| 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 |
|
 |
Art
Joined: 09 Nov 2005 Posts: 647
|
Posted: Sat May 10, 2008 2:14 pm Post subject: |
|
|
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 |
|
 |
jean

Joined: 05 Jan 2008 Posts: 489
|
Posted: Sat May 10, 2008 7:35 pm Post subject: |
|
|
| 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 |
|
 |
ne0h
Joined: 21 Feb 2008 Posts: 386
|
Posted: Sat May 10, 2008 10:05 pm Post subject: |
|
|
...
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 |
|
 |
Art
Joined: 09 Nov 2005 Posts: 647
|
Posted: Sat May 10, 2008 10:42 pm Post subject: |
|
|
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 |
|
 |
ne0h
Joined: 21 Feb 2008 Posts: 386
|
Posted: Sat May 10, 2008 11:03 pm Post subject: |
|
|
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 |
|
 |
jean

Joined: 05 Jan 2008 Posts: 489
|
Posted: Sat May 10, 2008 11:53 pm Post subject: |
|
|
| 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 |
|
 |
ne0h
Joined: 21 Feb 2008 Posts: 386
|
Posted: Sun May 11, 2008 12:17 am Post subject: |
|
|
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 |
|
 |
hlide
Joined: 10 Sep 2006 Posts: 750
|
Posted: Sun May 11, 2008 12:31 am Post subject: |
|
|
| No wonder Mr neoh's topics were too miscellaneous in their subjects. Thanks Jean. |
|
| Back to top |
|
 |
|