Resource vs Non-resource loading

Started by
6 comments, last by hollowMedia 22 years, 4 months ago
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!
[xian]
Advertisement
Well thigns like cursors and icons are so small anyways... But it should be slightly faster since it gets compiled with your executable.
Resource loading is faster.
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?
AP: check MSDN - I think it''s possible.
Yes, a resource dll is possible, but it sounds messy. Why not use a wad file or something similar instead?
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
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
-Brannon

This topic is closed to new replies.

Advertisement