:: PlayerAdvance.org ::  

Pr嶰嶮ent   :: PlayerAdvance.org :: > :: Forums H嶵erg廥 :: > 無ibrary

無ibrary Official 無ibrary forum (English / Fran蓷is)

Publicit

R廧onse
 
Outils de la discussion Modes d'affichage
Vieux 26/03/2007, 16h22   #1
theNinjaBunny
Membre
 
Date d'inscription: 26/03/2007
Messages: 6
Par d嶨aut Using uLibrary&PALib at the same screen

Hi, is there a posibilty to use uLibrary to load PNG/JPG/GIF as backgrounds and PALib for Sprites?(i think not)

Is there something like "dual sprites" from PALib in uLibrary? I mean, my game is using both screen, i'm using DualSprites (which saves you a lot of time coding a sprite system yo use them in both screen) But i reached the 4Mb limit of ROM size, so my idea is to load external PNG/GIF/JPEGs to act as background but without coding so much (yeah, i'm so lazy)
theNinjaBunny est d嶰onnect   R廧onse avec citation

Publicit

Vieux 26/03/2007, 18h15   #2
Lazarus
Membre confirm
 
Date d'inscription: 15/11/2006
Messages: 93
Par d嶨aut

You can use gif and jpegs in PAlib directly, too

I think when you loading ulib it overrides the sprites, not the backgrounds, but maybe you can select, we'll need brunni
Lazarus est d嶰onnect   R廧onse avec citation
Vieux 26/03/2007, 20h12   #3
theNinjaBunny
Membre
 
Date d'inscription: 26/03/2007
Messages: 6
Par d嶨aut

Citation:
Envoy par Lazarus
You can use gif and jpegs in PAlib directly, too
No, I can't. I could use PAFS to load "external" GIF, but PAFS means some incompatibilities and ... patch the rom each time i compile and wanna test it!

Using uLib I'm able to load "real external" data and overcome the 4Mb limit (that's THE reason of loading externally)
theNinjaBunny est d嶰onnect   R廧onse avec citation
Vieux 26/03/2007, 20h39   #4
bong
Membre confirm
 
Date d'inscription: 02/02/2007
Localisation: Strasbourg
Messages: 143
Par d嶨aut

Citation:
Envoy par theNinjaBunny
No, I can't.
You can load "real external" gif/jpg with PALib...
__________________


~ C嶮ric. ~
bong est d嶰onnect   R廧onse avec citation
Vieux 26/03/2007, 20h51   #5
theNinjaBunny
Membre
 
Date d'inscription: 26/03/2007
Messages: 6
Par d嶨aut

how?
theNinjaBunny est d嶰onnect   R廧onse avec citation
Vieux 26/03/2007, 21h13   #6
bong
Membre confirm
 
Date d'inscription: 02/02/2007
Localisation: Strasbourg
Messages: 143
Par d嶨aut

Exactly the same way you would use it with pafs or built-in gfx:

For a background:
1) alloc a memory space for the file
2) load the file
3) use "void PA_LoadGif (u8 screen, void *gif)" (*gif points to the space you alloced before)
4) free the space 1)

For a sprite:
1) alloc a memory space for the file
2) alloc memory for the palette
3) load the file
4) use "use u8 * PA_GifToTiles (void *gif, u16 *temppal)"
5) free the space 1)
then use your sprite as usual with PA_CreateSprite()...
__________________


~ C嶮ric. ~
bong est d嶰onnect   R廧onse avec citation
Vieux 26/03/2007, 21h28   #7
Brunni
Super Mod廨ateur
 
Date d'inscription: 10/11/2005
Localisation: Un pays avec beaucoup de banques
Messages: 3 226
Par d嶨aut

No you can't do anything with the screen affected to 無ibrary, PALib will CRASH directly if it ever tries to access the same screen as 無ibrary
I don't know what is the problem, but I've not investigated much for now in fact
PALib includes functions to load from other types of file sources, but sometimes it's not as easy. If you don't find a way to do it simply with PALib, you could do something like this:
Code PHP:
UL_IMAGE *loadSomething(const char *fileNameint fileSize)            {
    
VIRTUAL_FILE *f;
    
void *data;
    
int source ulGetLoadUtilitySource();
    
int success 0;

    
//Open the file
    
VirtualFileOpen((void*)fileNamefileSizesourceVF_O_READ);
    
//Check if the file could be opened
    
if (f)            {
        
//Load our file entirely to RAM and get a pointer to it
        
data ulReadEntireFileToMemory(fNULL);
        
//The file is entirely loaded, so we don't need it anymore
        
VirtualFileClose(f);
        
//Now the pointer "data" contains a pointer to a RAM memory area containing the loaded file data, you can pass it to some PA function that would normally load from RAM
        
PA_DoSomething(data);
        
//Don't forget to free the memory block after you've finished with it!
        
free(data);
        
success 1;
    }
    return 
success;

However, beware, this will load your file to RAM entirely, needing a lot of temporary RAM space! If RAM is nearly full, necessary space may not be available and this loading routine will fail
Usual 無ibrary functions use streaming (no need to load the file entirely, but only the needed parts), and I guess PALib does as well, so use this routine only if you know what you are doing
Brunni est d嶰onnect   R廧onse avec citation
R廧onse

Liens sociaux

Publicit



Utilisateurs regardant la discussion actuelle : 1 (0 membre(s) et 1 invit(s))
 
Outils de la discussion
Modes d'affichage

R銶les de messages
Vous ne pouvez pas cr嶪r de nouvelles discussions
Vous ne pouvez pas envoyer des r廧onses
Vous ne pouvez pas envoyer des pi鋃es jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activ嶪s : oui
Les smileys sont activ廥 : oui
La balise [IMG] est activ嶪 : oui
Le code HTML peut 皻re employ : non
Navigation rapide


Fuseau horaire GMT +2. Il est actuellement 21h25.


丼it par : vBulletin® version 3.7.2
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd. Tous droits r廥erv廥.
Version fran蓷ise #16 par l'association vBulletin francophone
Design par Ass-Itch, DJP et Dr.Vince