Archived

This topic is now archived and is closed to further replies.

hollowMedia

Resource vs Non-resource loading

Recommended Posts

hollowMedia    122
If I am using MS Visual C++ 6.0, is loading things like cursors, icons, and bitmaps through a linked resource the best idea? With portability aside, is it faster to load through a resource? Thanks!

Share this post


Link to post
Share on other sites
ANSI2000    122
Well thigns like cursors and icons are so small anyways... But it should be slightly faster since it gets compiled with your executable.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
I have a related question.
Is it possible to compile your resources (i.e. bitmaps) into a separate file from the EXE? For example, could I make graphics.dll which is just the resources, and link to it at run-time to get my game graphics?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Yes, a resource dll is possible, but it sounds messy. Why not use a wad file or something similar instead?

Share this post


Link to post
Share on other sites
darookie    1441
quote:
Original post by Anonymous Poster
Yes, a resource dll is possible, but it sounds messy. Why not use a wad file or something similar instead?


Yep. You could also add a simple compression scheme (like LZ77) and save diskspace by the way. This also protects your resources from users messing around with them...


Edited by - darookie on December 19, 2001 12:40:48 PM

Share this post


Link to post
Share on other sites
Brannon    122
Making a resource .dll is easy, not messy. Just create a new project (.dll), and add a resource script to it with all of your resources. Compile and voila! Resource .dll.

You might have to have an empty DllMain() if the compiler complains that there is no entry point.

Then in your code, you load the .dll using LoadLibrary(), and then use the HMODULE returned in your calls to the resource functions (in place of the hInstance for your app).

For windows resources (like cursors, etc) I would use resources. That what resources are designed for. For game assets (graphics, sounds, levels, etc), use the .wad/.pak/.zip file concept. Windows resources aren''t really designed for general purpose storage.


-Brannon

Share this post


Link to post
Share on other sites