SFML community forums
Help => Graphics => Topic started by: Chuckleluck on March 05, 2012, 05:45:41 pm
-
Hello,
Is there a way to load images so they don't have to loaded each time the .exe file is run? Like if I had this bit of code:
"image.LoadFromFile("imgFolder\\img.png");"
What if the .exe file got moved to my desktop, where there isn't a folder named imgFolder? Or if I distributed my program, and I didn't want to include the source images? Is there a method in SFML to "remember" what the images were?
-
You can include all you image/font/data in your ,exe if i'm not wrong. But this will make your exe big and slower(?).
W8 for some1 expert, i'm interested too
-
Yes, you can do it, but your .exe would have the size of all images, it would take longer to load and would take up a lot more memory right from the start.
I think you would be better putting your resources on some container like .zip (using some library that supports loading files from it - SFML doesn't, nativelly), and creating a shortcut on the desktop.
You can put a password on the .zip to avoid leaking your resources, or something like that.
-
Yes, you can do it, but your .exe would have the size of all images, it would take longer to load and would take up a lot more memory right from the start.
I think you would be better putting your resources on some container like .zip (using some library that supports loading files from it - SFML doesn't, nativelly), and creating a shortcut on the desktop.
You can put a password on the .zip to avoid leaking your resources, or something like that.
ZipLoader from old wiki
http://www.sfml-dev.org/wiki/en/sources/ziploader
DAT file pack from old wiki
http://www.sfml-dev.org/wiki/en/tutorials/formatdat
-
What I do in my projects is put ALL the files of the program in a folder at %appdata%, including the exe. Then, I make a shortcut to the .exe wherever I want. In yours case, it would be the desktop, if I didn't misread.
If you are going to distribute the program, I would suggest a NSIS installer to make the shortcut/folder, or you could make yours own code, which is a bit more headaches. Both would work well.
Putting files inside a .exe is very complicated, heavy, and the other things that have been cited above. I think it's a bad idea, and I have searched for that before on google with no sucess. Generally, nobody includes files in a .exe.
If you want to proceed though, you will need some 1337 skillz. Good luck on yours problem.