Bitmaps in one large file

Hello,
I have following problem: I have xxx bitmaps (stored in separate files) and I
read them via the usual SDL_LoadBMP() function. Is there any way how to put
these bitmaps in one big file from which SDL would load all the bitmaps?

Thanks for help,
Vojtech Toman

Hello,
I have following problem: I have xxx bitmaps (stored in separate files)
and I
read them via the usual SDL_LoadBMP() function. Is there any way how to
put
these bitmaps in one big file from which SDL would load all the bitmaps?

I’ve had a lot of fun getting it to work with visual C++, but the zzip
library uses RWops (a semi-documented SDL feature) to let you load arbitrary
files from a zip file. (It uses the zlib library for file decompression.)
It has linux style makefiles/configure scripts, so should work fairly well
on most other systems. If that doesn’t work for you, it’s possible (though
not trivial) to write your own code to read zip files (zlib will deal with
all the (de)compression for you) If you then make an RWops interface to your
code, SDL will happily load the bitmap from a zip file. (You might also want
to look at writing an RWop interface to a WAD file, as well.) It definately
is possible, though.

If you look at SDL_LoadBMP() in SDL_video.h you’ll see that it just creates
an RWops structure to read from a file, and passes that to SDL_LoadBMP_RW.
You can create any system to read from a file, and set up an appropriate
RWops structure to let SDL read the file.

RWops is an I/O abstraction used by a number of SDL functions that load data
from disk.

The ZZip library http://zziplib.sourceforge.net/zzip-sdl-rwops.html

The ZLib library http://www.gzip.org/zlib/

An RWops tutorial http://www.kekkai.org/roger/sdl/rwops/rwops.html

I hope that’s some help.

SDL can do that through the RWops stuff, which is undocumented officially,
so best to look at the source code itself, or find a tutorial for it.
There’s a link to Roger’s tutorials from the SDL site. Then you’d want to
look into using an archiving library, or create your own. It’s not that
hard to create one. If you want compression too, then you probably want to
go with a library to handle that. Some file formats are already compressed,
though, so using those wouldn’t require additional compression.

-Jason> ----- Original Message -----

From: vtoman@lit.cz (Vojtech Toman)
To:
Sent: Friday, April 12, 2002 4:34 AM
Subject: [SDL] Bitmaps in one large file

Hello,
I have following problem: I have xxx bitmaps (stored in separate files)
and I
read them via the usual SDL_LoadBMP() function. Is there any way how to
put
these bitmaps in one big file from which SDL would load all the bitmaps?

Thanks for help,
Vojtech Toman


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Why not just put them in one large file to begin with?> ----- Original Message -----

From: vtoman@lit.cz (Vojtech Toman)
To:
Sent: Friday, April 12, 2002 1:34 AM
Subject: [SDL] Bitmaps in one large file

Hello,
I have following problem: I have xxx bitmaps (stored in separate files)
and I
read them via the usual SDL_LoadBMP() function. Is there any way how to
put
these bitmaps in one big file from which SDL would load all the bitmaps?

Thanks for help,
Vojtech Toman


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Heh, nevermind this… I misunderstood the original question… I thought
he had a bunch of small textures that he wanted to load at once from a big
file… lol.> ----- Original Message -----

From: @Eron_Hennessey (Eron Hennessey)
To:
Sent: Friday, April 12, 2002 9:45 AM
Subject: Re: [SDL] Bitmaps in one large file

Why not just put them in one large file to begin with?

----- Original Message -----
From: “Vojtech Toman”
To:
Sent: Friday, April 12, 2002 1:34 AM
Subject: [SDL] Bitmaps in one large file

Hello,
I have following problem: I have xxx bitmaps (stored in separate files)
and I
read them via the usual SDL_LoadBMP() function. Is there any way how to
put
these bitmaps in one big file from which SDL would load all the bitmaps?

Thanks for help,
Vojtech Toman


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

You could just use the Doom/Quake WAD file format. It would be very handy because there are a lot of editors/GUIs that support it. However, I don’t know where to
find any useful piece of source code…>>

Hello,
I have following problem: I have xxx bitmaps (stored in separate files)
and I
read them via the usual SDL_LoadBMP() function. Is there any way how to
put
these bitmaps in one big file from which SDL would load all the bitmaps?

Thanks for help,
Vojtech Toman

I can produce some in about 15 minutes, but I won’t. Zziplib or PhysicsFS
are reasonable things to use, and you really should use one of them.On Fri, Apr 12, 2002 at 08:13:40PM +0200, CRV?ADER/KY wrote:

You could just use the Doom/Quake WAD file format. It would be very handy because there are a lot of editors/GUIs that support it. However, I don’t know where to
find any useful piece of source code…


Joseph Carter This thing is an AI

I am dyslexic of Borg. Prepare to have your ass laminated.

-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 273 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20020412/bbedd0a7/attachment.pgp

I was a little surprised abou tthe other answers in this thread, because the
solution that found immediately was the following:

  1. Copy all your pictures into one big image, using your favourite Paint
    Proggi…
  2. Open this picture an blit it using SDL_BlitSurface(SDL_Surface *src,
    SDL_Rect *srcrect, …);
    and set the srcrect to the x/y/w/h of the pic you want to blit.
    You can also use this to blit them into separate surfaces before using them.

To avoid meesing arround with compress libs you could use PNG-images or
whatever you prefer and SDL_image.

Of course this is only a good solution if your pics are not too big and some
of them have the same hight or width.

I personally did this for animated sprites and my own bitmap-font-functions.
There it works great, because normally all “frames” of an animation are the
same size.
So if your pics are all 30*30pixels, you just move 30 pixels down or left
each frame.

geets
Stiefel> ----- Original Message -----

From: vtoman@lit.cz (Vojtech Toman)
To:
Sent: Friday, April 12, 2002 10:34 AM
Subject: [SDL] Bitmaps in one large file

Hello,
I have following problem: I have xxx bitmaps (stored in separate files)
and I
read them via the usual SDL_LoadBMP() function. Is there any way how to
put
these bitmaps in one big file from which SDL would load all the bitmaps?

Thanks for help,
Vojtech Toman


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

I was a little surprised abou tthe other answers in this thread, because
the
solution that found immediately was the following:

It can be easy to misinterpret what he really means here. Look again at
what he wrote:

Hello,
I have following problem: I have xxx bitmaps (stored in separate files)
and I
read them via the usual SDL_LoadBMP() function. Is there any way how to
put
these bitmaps in one big file from which SDL would load all the bitmaps?

Notice the last word there? Bitmaps, not bitmap. So it would appear he
still wants to load each bitmap, but he wants it all stored in one file on
his hard drive, which is what an archive is all about. That’s why people
were suggestion archive libraries and such.

Besides, if there’s a lot of bitmaps, I’m not convinced it’s really such a
wise idea to stuff them all into one huge bitmap anyway. One problem I can
think of off the top of my head is that it might not get put into video
memory, for several reasons.

-Jason

----- Original Message -----
From: mail@stiefelweb.de (Daniel Stiefelmaier)
To:
Sent: Friday, April 12, 2002 6:03 PM
Subject: Re: [SDL] Bitmaps in one large file
----- Original Message -----
From: Vojtech Toman
To:
Sent: Friday, April 12, 2002 10:34 AM
Subject: [SDL] Bitmaps in one large file

I can produce some in about 15 minutes, but I won’t. Zziplib or PhysicsFS
are reasonable things to use, and you really should use one of them.

PhysicsFS has MacOS Classic and Win2000 support in the latest CVS.

–ryan.

What is PhysicFS exactly ?

On Fri, Apr 12, 2002 at 07:28:50PM -0400, Ryan C. Gordon wrote :>

I can produce some in about 15 minutes, but I won’t. Zziplib or PhysicsFS
are reasonable things to use, and you really should use one of them.

PhysicsFS has MacOS Classic and Win2000 support in the latest CVS.

–ryan.


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Please always Cc to me when replying to me on the lists.
GnuPG Key: http://guru.josefine.at/~mfischer/C2272BD0.asc
"Mind if I MFH ?" “What QA did you do on it?” “the usual?” “ah… none :)”

What is PhysicFS exactly ?

http://icculus.org/physfs/

–ryan.

But has the unfortunate dependency on zlib, a horrid mass of code nobody
likes, but nobody really wants to rewrite, either.

Still, I prefer it to Zziplib personally for small things that I am not
likely to want to write my own archive management for.On Fri, Apr 12, 2002 at 07:28:50PM -0400, Ryan C. Gordon wrote:

I can produce some in about 15 minutes, but I won’t. Zziplib or PhysicsFS
are reasonable things to use, and you really should use one of them.

PhysicsFS has MacOS Classic and Win2000 support in the latest CVS.


Joseph Carter You want fries with that?

If you are what you eat, I guess that makes me a cheese danish.
– Anonymous

-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 273 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20020412/3ce39bc5/attachment.pgp

So one again :-)> It can be easy to misinterpret what he really means here. Look again at

what he wrote:

----- Original Message -----
From: Vojtech Toman <@Vojtech_Toman>
To:
Sent: Friday, April 12, 2002 10:34 AM
Subject: [SDL] Bitmaps in one large file

Hello,
I have following problem: I have xxx bitmaps (stored in separate files)

and I

read them via the usual SDL_LoadBMP() function. Is there any way how to

put

these bitmaps in one big file from which SDL would load all the
bitmaps?

Notice the last word there? Bitmaps, not bitmap. So it would appear he
still wants to load each bitmap, but he wants it all stored in one file on
his hard drive, which is what an archive is all about.

YES, THIS IS WHAT I MEANT. I have about 1,000 small bitmaps (sprites for a
game) and I thought it would be better to put them in one file from which I
could read them than to call SDL_LoadBMP() thousand times. (Just wanted to
save IO operations.)
I am programming it on Linux.

Vojtech Toman

You can write a program to load all of them and tile them on one bitmap (or
tile them yourself), and then load that bitmap, and pull the sprite you need
out by a blit.

-Jim> ----- Original Message -----

From: vtoman@lit.cz (Vojtech Toman)
To:
Sent: Saturday, April 13, 2002 5:00 AM
Subject: [SDL] Bitmaps in one large file - second attempt

So one again :slight_smile:

It can be easy to misinterpret what he really means here. Look again at

what he wrote:

----- Original Message -----
From: Vojtech Toman
To:
Sent: Friday, April 12, 2002 10:34 AM
Subject: [SDL] Bitmaps in one large file

Hello,
I have following problem: I have xxx bitmaps (stored in separate
files)

and I

read them via the usual SDL_LoadBMP() function. Is there any way how
to

put

these bitmaps in one big file from which SDL would load all the
bitmaps?

Notice the last word there? Bitmaps, not bitmap. So it would appear he
still wants to load each bitmap, but he wants it all stored in one file
on

his hard drive, which is what an archive is all about.

YES, THIS IS WHAT I MEANT. I have about 1,000 small bitmaps (sprites for a
game) and I thought it would be better to put them in one file from which
I
could read them than to call SDL_LoadBMP() thousand times. (Just wanted to
save IO operations.)
I am programming it on Linux.

Vojtech Toman


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

The bitmap would be huge. Besides the bitmaps haven’t the same size so tiling
would be difficult

Vojtech TomanOn Saturday 13 April 2002 11:38, Steven James Stapleton wrote:

You can write a program to load all of them and tile them on one bitmap (or
tile them yourself), and then load that bitmap, and pull the sprite you
need out by a blit.

Too bad I seem I can’t get it to run on win32. It requires
userenv.h and some functions from userenv.dll which are not
shipped with the MSVC 6 version (seems to be some addition
for the latest VStudio ?!) …

On Fri, Apr 12, 2002 at 08:13:54PM -0400, Ryan C. Gordon wrote :>

What is PhysicFS exactly ?

http://icculus.org/physfs/

–ryan.


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Please always Cc to me when replying to me on the lists.
GnuPG Key: http://guru.josefine.at/~mfischer/C2272BD0.asc
"Mind if I MFH ?" “What QA did you do on it?” “the usual?” “ah… none :)”