gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Graphics > Quick Question on pcx2gba and pcx2sprite

#8904 - ChaosX2 - Wed Jul 23, 2003 4:15 pm

I'm new to GBA development and I've been writting some of my own tools... one of my tools exports BMP files into C code in a simular way as pcx2sprite does with pcx files. My only questions is what is the difference in the C code output between pcx2gba and pcx2sprite?

FYI I found pcx2gba and pcx2sprite on "The Pern Project's" website.

#8907 - djei-dot - Wed Jul 23, 2003 4:37 pm

pcx2sprite splits your image into 8x8 tiles. It's used for sprites and tiled backgrounds. pcx2gba converts images to C without splitting. It's used for Mode 4 BGs.

#8908 - ChaosX2 - Wed Jul 23, 2003 4:46 pm

I don't know if I totally understand what you are saying could you give me a small example of each.

Say like a 32x32 bitmap - mapped as a sprite and mapped as a BG.

#8910 - ChaosX2 - Wed Jul 23, 2003 5:39 pm

Nevermind my last post I now understand.

To help others here is the way it works.

For this example I'll use 16x16 psudo-image
1111111122222222
1111111122222222
1111111122222222
1111111122222222
1111111122222222
1111111122222222
1111111122222222
1111111122222222
3333333344444444
3333333344444444
3333333344444444
3333333344444444
3333333344444444
3333333344444444
3333333344444444
3333333344444444

A background would break up like so
{ 1, 1, 1, 1, 1, 1, 1, 1, 2, 2
2, 2, 2, 2, 2, 2, 1, 1, 1, 1
1, 1, ... }

A sprite would break up like so
{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ... 64 Times total, then
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ... 64 tiles total
...}
A sprite being broken up into 8x8 chunks but a background is layed out exacly like a BMP

Thanks for the help it pointed me in the right direction

#8940 - djei-dot - Thu Jul 24, 2003 11:59 am

That's it! In fact, you explained it better than I would...