Searge-DP / grafx2

Automatically exported from code.google.com/p/grafx2
0 stars 0 forks source link

Save as C/C++ or assembler source #437

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi,

i think it is a great feature to add saving as C/C++ or assembler source, this 
would help programmers/game creators alot. I attach two samples for this 
showing an hardcoded font i can provide more examples if needed. The c file is 
exported with gimp the s file was converted from that file.

Original issue reported on code.google.com by HoraK-...@web.de on 29 Apr 2011 at 6:59

Attachments:

GoogleCodeExporter commented 8 years ago
The xpm format is already available and almost suitable for that.

I believe each developper has its own need in terms of file formats for these 
things, so you may prefer to write an export plugin as a lua script if you have 
specific needs.

An alternative is to use a tool such as xxd on a file to get a .h from it. Easy 
to do from a makefile.

Original comment by pulkoma...@gmail.com on 29 Apr 2011 at 7:22

GoogleCodeExporter commented 8 years ago
mmmh for me is going the old way better than. If i use the xpm format i must 
write an new converter and xxd converts the whole file with header and all 
other so i need an converter too :P. Maybe i have time someday to write an lua 
export script. thanks anyway

Original comment by HoraK-...@web.de on 29 Apr 2011 at 8:37

GoogleCodeExporter commented 8 years ago
It is possible to use xxd with skipping some bytes, so you can invoke it 
multiple times to get the palette and pixeldata separately. Using the IMG 
format this should be fine:

xxd -i -s128 -l256 image.IMG > palette
xxd -i -s384 image.IMG > pixels

Note you loose the infos about the picture size (this is stored in the header).

The "pixels" file will be identical to your C example, but without the palette 
info which you apparently drop from the .s anyway.

Is that ok for you ? If so, I'll add it to a wiki page, so that it doesn't get 
lost :)

Original comment by pulkoma...@gmail.com on 29 Apr 2011 at 8:56

GoogleCodeExporter commented 8 years ago
It can become usefull especially for creating c output but for assembler i need 
the exact size because there is no sizeof function

Original comment by HoraK-...@web.de on 29 Apr 2011 at 9:15

GoogleCodeExporter commented 8 years ago
As I said, everyone has its own needs in this area, so it seems a good use for 
a Lua script.

Original comment by pulkoma...@gmail.com on 24 Sep 2011 at 8:21