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.

Beginners > Image to Header

#166322 - semihce - Wed Feb 04, 2009 7:16 pm

Hi,

I am new on GBA programming and i want to convert an image to header files. I cann't use ready programs such as gfx2gba, i have to do it by myself dynamically.
In my program, i get the image from user, and convert each pixels of this image to hexal like this,

r + (g << 5) + (b << 10)

Is this true?

What is more, after converting each pixel, i also have to generate two other arrays for palette and map. How can i do this? I dont know how can i construct map and palette arrays.

Please help me..

#166398 - silent_code - Sat Feb 07, 2009 12:53 pm

Grit is open source, so check it out to get some ideas. :^)
_________________
July 5th 08: "Volumetric Shadow Demo" 1.6.0 (final) source released
June 5th 08: "Zombie NDS" WIP released!
It's all on my page, just click WWW below.

#166472 - sgeos - Sun Feb 08, 2009 6:05 pm

I'm not sure what you are trying to do. Are you writing some sort of graphics tool that will spit out gba/ds graphics in source form?

#166647 - Kyoufu Kawa - Thu Feb 12, 2009 9:04 pm

I stopped reading after "images to header files". You don't put data in header files, semihce.

Can somebody who's better at explaining explain why you don't?

#166649 - Dwedit - Thu Feb 12, 2009 11:04 pm

The only reason not to put data in header files is compilation speed really. When you do it 30 times, it gets really slow to compile.

Putting data in SHARED header files on the other hand is just plain stupid, that's #including code.
_________________
"We are merely sprites that dance at the beck and call of our button pressing overlord."

#166651 - silent_code - Thu Feb 12, 2009 11:37 pm

... and when the binary plus allocated memory exceed physical RAM size...
There's a lot of good explanations aroud this forum, just use the search function. ?;^)
_________________
July 5th 08: "Volumetric Shadow Demo" 1.6.0 (final) source released
June 5th 08: "Zombie NDS" WIP released!
It's all on my page, just click WWW below.