Jump to content
  • Advertisement
Sign in to follow this  
negflar

Packing all multimedia in one file

This topic is 4436 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I would want to package all image of my game in one file like a .dat file. How can i do this? At moment i have various bmp image that i load (with SDL) with IMG_Load("image.bmp"). Tank's

Share this post


Link to post
Share on other sites
Advertisement
You can zip it, and extract it when you load data from your game.
That's probably the easiest way to do it, it might save you some disk space as well. :)

Share this post


Link to post
Share on other sites
I don't know about SDL but the way I do this with DirectDraw is to have a tool that converts my bitmaps to raw RGB Quads which are saved to a file. I can then structure the file how I want and include additional information like image size and offsets. When I load them onto a surface I use Win32 StretchDIBits which requires a windows device context to the surface and bung the RGB quad data back on the surface like that.

Don't know if SDL gives you a DC to its bitmap types.

Share this post


Link to post
Share on other sites
Using a virtual file system like PhysFS, you can have all of your game data in zip files and still read them in like a normal directory heirarchy. When you use this method, you'll be reading in surfaces via RWops. There a lot of information on how to read in surfaces via RWops here.

Share this post


Link to post
Share on other sites
Hello,
Fist of all many tank's for reponse.
I have tried to use RWops but i have some problems when i try to load a gzipped image . here the code:


file = gzopen("sfondo.bmp.gz", "r");

fileSize = gzread(file, buffer, 1550000);
rw = SDL_RWFromMem(buffer, fileSize);

sfondo = SDL_LoadBMP_RW(rw, 0);
applica_superficie( bgX, bgY, sfondo, screen );



applica_superficie function is my function for blitting surface with SDL_BlitSurface.

Here prototype:
void applica_superficie( int x, int y, SDL_Surface* source, SDL_Surface* destination )

The problem is taht the image is not loaded and i can see only a black screen.

What's the problem?

Tank's



Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!