[SDL] Embedded Images
Gabriele Greco
gabriele.greco at darts.it
Tue Oct 10 09:21:04 PDT 2006
David Olofson wrote:
> Hints:
> SDL_RWops
> IMG_Load_RW()
>
>
There is still the problem to link the image in your source code. It's
an easy task if it's an XPM (you can include it with #include), but not
that easy if you want to use a binary format. There is a portable way to
do this without external programs that convert images in source files?
I've been able to use this trick to include a binary file in my source
with objdump, but it's not portable at all :) (but it was for a firmware
so it was ok :) )
[from Makefile]
firmware.o:
objcopy -I binary -O elf32-i386 -B i386 --rename-section
.data=.rodata,alloc,load,readonly,data,contents firmware.bin firmware.o
[from the source code using it]
extern char _binary_firmware_bin_start;
extern char _binary_firmware_bin_end;
#define firmware_ptr &_binary_firmware_bin_start
#define firmware_end_byte &_binary_firmware_bin_end
#define firmware_length ((unsigned long)(firmware_end_byte) - (unsigned
long)(firmware_ptr))
Bye,
Gabry
More information about the SDL
mailing list