Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Is there a way to not have to include image files?  (Read 2715 times)

0 Members and 1 Guest are viewing this topic.

Chuckleluck

  • Jr. Member
  • **
  • Posts: 52
    • View Profile
Is there a way to not have to include image files?
« 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?

TheEnigmist

  • Full Member
  • ***
  • Posts: 119
    • View Profile
Is there a way to not have to include image files?
« Reply #1 on: March 05, 2012, 06:50:10 pm »
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

Tex Killer

  • Full Member
  • ***
  • Posts: 242
    • View Profile
Is there a way to not have to include image files?
« Reply #2 on: March 05, 2012, 10:36:05 pm »
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.

TheEnigmist

  • Full Member
  • ***
  • Posts: 119
    • View Profile
Is there a way to not have to include image files?
« Reply #3 on: March 05, 2012, 10:44:33 pm »
Quote from: "Tex Killer"
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

Davi

  • Newbie
  • *
  • Posts: 6
    • View Profile
Is there a way to not have to include image files?
« Reply #4 on: March 17, 2012, 03:52:45 pm »
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.