Files Hideing Question

Started by
1 comment, last by TheTroll 17 years, 12 months ago
I was wondering when people make software that has bitmaps in it, why are the bitmap files not in the file where the program is? I see this a lot in games, but I am not just talking about games I mean a lot of programs. Where is the card bitmaps in solitare, where is the bitmaps on games you download, where is the bitmaps you see in word or whatever? I know this is kind of a dumb question but I could never figure this out, because if the bitmaps are on a games cd what if it is a game that you put on ur hardrive and code doesnt come off of the cd?
Advertisement
Mad_Kod3r,

Most development environments allow you to attach files as "resources," to the executable. What this means is that when you compile the executable, the IDE goes out and grabs the files you've listed as resources, opens them, and takes all the contents and attaches it to the executable somewhere.

Then in the application, rather than putting a path on disk to where the file was located, you just reference the resource. Using your bitmap example: I tell my compiler I want a bitmap called "card.bmp" as a resource, and I want the resource called CARD_BITMAP_RES. Then in my application I can do something like:

Bitmap* pBitmap = LoadBitmapFromResource( CARD_BITMAP_RES );

So to answer your question more specifically, the files you are looking for are contained within the .exe file itself.

Cheers and good luck!
Jeromy Walsh
Sr. Tools & Engine Programmer | Software Engineer
Microsoft Windows Phone Team
Chronicles of Elyria (An In-development MMORPG)
GameDevelopedia.com - Blog & Tutorials
GDNet Mentoring: XNA Workshop | C# Workshop | C++ Workshop
"The question is not how far, the question is do you possess the constitution, the depth of faith, to go as far as is needed?" - Il Duche, Boondock Saints
Most people use either a directry to put all the media or (this is the more likely case) put it in a "package". A Package is a compressed normally encrypted file that contains multiple files. They extract the files out of the package when they need them in game. This reduces the number of files that you have to put on the machine and it also gives a little protection to the data files. Any halfway decient hacker can crack the package but it keeps honest folks honest.

theTroll

This topic is closed to new replies.

Advertisement