#19525 - Viper - Wed Apr 21, 2004 2:38 pm
Hi all I'm sorta new here to all GBA programming etc. and I got a few questions about it.
I'm looking for a good bmp to array (header) converter. I did found one on the site but I didn't like that one. Does anyone know one that does work good?
Thanks in advance
#19527 - windfive - Wed Apr 21, 2004 2:51 pm
You can try the "gfx2gba" tool, and also the official tool "bmp2agb" is good enough.
#19549 - sajiimori - Wed Apr 21, 2004 7:42 pm
I've heard there are 2 utilities called gfx2gba. It seems like the one here is good:
http://www.ohnehirn.de/tools/
If you can manage, avoid using headers and C files to store bitmaps. It's slow to compile and bad style in general. Try using raw binaries.
#19573 - Spockmeat - Thu Apr 22, 2004 5:34 am
I'm curious as to why storing bitmaps in a .h or .c file would be considered bad style. I mean, it's far easier to simply use an array and index into it to get the info you want than it is to read through a raw data file. I mean, there is no space savings, the and the code is far easier to write and understand.
And compile time shouldn't be affected unless you recompile the files, which doesn't happen unless you clean the build or change them.
#19574 - windfive - Thu Apr 22, 2004 6:31 am
#19578 - Sweex - Thu Apr 22, 2004 8:35 am
I agree with sajiimori, that it is bad style and all. BUT, for a newbie, it is a good way of learning how things work. And I'm sure that once one is familiar the way graphics work, he wants to move away from generated .c/.h files asap!
I've started with generated code myself, but then written my own filesystem + (really neat!:) conversion/packing tool that is included in my make file.
_________________
If everything fails, read the manual: If even that fails, post on forum!
#19605 - sajiimori - Thu Apr 22, 2004 7:17 pm
Quote: |
I mean, it's far easier to simply use an array and index into it to get the info you want than it is to read through a raw data file.
|
You can treat anything as an array -- it doesn't have to be declared as such. In other words, you can index into raw data if you want (though most gfx data will probably be DMA copied anyway).
Quote: |
And compile time shouldn't be affected unless you recompile the files, which doesn't happen unless you clean the build or change them.
|
Perhaps this is true if you are developing a game where the graphics are all done beforehand, and never change. In real life, resources are changed all the time.
Anyway, Sweex is right that it doesn't matter that much when you're just learning.
#19819 - sgeos - Mon Apr 26, 2004 2:24 am
How do I compile some image.raw into my binary? How do I access the data in image.raw from my source code?
-Brendan
#19826 - MumblyJoe - Mon Apr 26, 2004 8:50 am
Depends how complex you want to get and how much time you have but personally i write all my own tools, i have a bunch for different bitmap conversion tools that output headers with extra data specifically for the engine i wrote.
Also if you are doing a really simple picture its not hard to just type in a picture straight into the code, if you are using under five colors it almost looks like ascii art. Of course the byte ordering screws this a little but if you make constants for colors that are all one letter it works pretty well all round.
_________________
www.hungrydeveloper.com
Version 2.0 now up - guaranteed at least 100% more pleasing!
#21579 - tornadokick - Tue Jun 01, 2004 5:13 am
I'm having a similar problem; I want to display an image (I'm still in the basic stages of gba development.), but most programs seem to only accept .pcx files. I don't know how to make a .pcx file, and the only thing I can use is a .bmp file (16, 256-color types).
And I'll repeat sgeos's question, "How do I compile some image.raw into my binary? How do I access the data in image.raw from my source code?"
#21589 - sajiimori - Tue Jun 01, 2004 4:10 pm
tornadokick, did you look at the converter that's linked earlier in this thread?
The simplest way I've found to get raw data into a ROM is to make an object file out of it and link it in. This way is nice because you get a plain C symbol to access it. Use this command:
Code: |
ld -A elf32-littlearm --format binary --oformat \
elf32-littlearm -r -EL -T bin2rodata.x \
-o data.o data.raw
|
Where bin2rodata.x is a file containing this:
Code: |
SECTIONS {
.rodata : {
*(.data)
}
}
|
Then the contents of data.raw will be accessible via the C symbols:
Code: |
extern void* _binary_data_raw_start;
extern void* _binary_data_raw_end;
extern void* _binary_data_raw_size;
|
Anybody know an easier way? Appending can work (especially when you're using a filesystem), but how about easier ways to get multiple raw data objects accessible via C symbols?
#21655 - tepples - Wed Jun 02, 2004 6:47 pm
tornadokick wrote: |
but most programs seem to only accept .pcx files. I don't know how to make a .pcx file, and the only thing I can use is a .bmp file (16, 256-color types). |
Then you might want to raid the tools built as part of TOD's build process for ideas. All my tools can handle all the formats that the Allegro library can handle by default, namely .bmp, .pcx, and .tga.
What paint program are you using? GIMP should be able to work with both .pcx and .bmp files.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.