embedding a file

Post your questions, suggestions and experiences regarding game design, integration of external libraries here. For irrEdit, irrXML and irrKlang, see the
ambiera forums
Post Reply
JPulham
Posts: 320
Joined: Sat Nov 19, 2005 12:06 pm

embedding a file

Post by JPulham »

If i have a file (image, sound, font) how can I link it into the executable or a module, and how can I load a pointer to the data afterwards?

EDIT: I'm trying to use platform independent C code rather than Win32 etc.
pushpork
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Convert it to hex values, make a static byte array in C code and initalize it with those values (u8 data = {data...}) and create a memory read file from that.
FlyingIsFun1217
Posts: 219
Joined: Fri Apr 13, 2007 8:29 pm
Location: Illinois
Contact:

Post by FlyingIsFun1217 »

For Hybrid: You can't put it's binary data into a container?

FlyingIsFun1217 :)
sio2
Competition winner
Posts: 1003
Joined: Thu Sep 21, 2006 5:33 pm
Location: UK

Post by sio2 »

bin2h
JPulham
Posts: 320
Joined: Sat Nov 19, 2005 12:06 pm

Post by JPulham »

cheers :D
I thought I heard of a way using the linker... but thinking about it I think it was using Win32 resource files :?
pushpork
3ddev
Posts: 169
Joined: Tue Sep 19, 2006 6:51 am
Contact:

Post by 3ddev »

If you are willing to sacrifice cross-platform support, then Windows Resource Files are the best option, IMO. Here is nice tutorial :arrow: http://www.softlookup.com/tutorial/vc++/vcu10fi.asp
Post Reply