Advertisement

Using non-resource bitmaps

Started by August 12, 2001 12:02 PM
0 comments, last by GameDev135 23 years, 3 months ago
I have made an animation using directx and it loads bitmaps. My problem is when I open the ".exe" file, it doesnt work. It only works when I execute it from the compiler. My guess is that it isnt loading the bitmaps properly because they are in the wrong directory or something. Right now, I have put them in both the folder where the cpp files is and the folder with the exe. Any suggestions? Daniel
Feel free to email me at NYYanks432@hotmail.com if you have any questions
Your users will most likely be running the game from the executable, so the files should be in the same directory as the executable. The problem with running the game from the compiler is that the compiler might set the working directory to somewhere other than where the executable is.

To fix this in Visual C++, open the Project menu and click Settings. Select the configuration you want to modify, and then click the Debug tab. Then type out the directory of your executable in the edit box under ''Working Directory''. Doing this will not modify your program or anything like that, it will just change the working directory that VC++ sets when the program is run from within the compiler. If you do not use Visual C++, try looking through your compiler''s options or something until you can find something similar.

Also, the working directory can change while your program is running (some file-related functions will change it). So, it may be better to get the working directory (the getcwd() or GetCurrentDirectory() functions will do) at the start of the program and store and somewhere, and then use that for opening files.

If any of this is unclear to you, tell me and I will try to explain it better.

This topic is closed to new replies.

Advertisement