Skip to main content
GameDev.net gamedev.net
🔒 Locked

Effect from Resource

Started by Quat Jul 5, 2008 at 6:56 PM 0 replies 1.1k views
Original Post
Quat
Quat
Hello, Right now I am using .fx files for my effects. However, I only have a few .fx files for my application and I'd rather just embed them in the EXE as a resource. But I am not sure how to do this. In Visual Studio, do I just right click on the project > Add Resource > Import, and import the .fx file? Then how do I get a string/pointer to the resource to pass to D3DXCreateEffectFromResource?
-----Quat
Buckeye
Buckeye
I don't know much about adding resources to projects, I'm afraid. But the normal way of getting a pointer to a resource is MAKEINTRESOURCE(resourceId). That returns LPSTR.

If I remember (from the old days), when you import it, you'll have to give it a custom resource type. You can use something like RCDATA (which was actually recognized as a resource in the "old" days). It will be given a resource id. ID_RCDATA1 or something, which you can use in the MAKEINTRESOURCE call.

If I also remember correctly, that resource will be deleted from your resources whenever you add or create another resource since RCDATA is not recognized as a valid resource type. I think the way to hack around that is to create another resource file (.rc2) and copy and paste the RCDATA into it. Text edit the project .rc file and add a line "#include "whatever.rc2"

Try it out in a COPY of your project FIRST! Text editing resource files is not for the novice!
Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly. You don't forget how to play when you grow old; you grow old when you forget how to play.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.