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

Author Topic: How To: Executable For Game [C++]  (Read 4263 times)

0 Members and 1 Guest are viewing this topic.

Cryonic

  • Newbie
  • *
  • Posts: 16
    • View Profile
How To: Executable For Game [C++]
« on: July 31, 2015, 03:55:43 am »
When you buy a game at the store, and want to play it on your computer, you do the following:

(1) Run a setup.exe
(2) Install on computer
(3) End up with an exe on your desktop (separate from its source files, asset files, etc.)

(1) How do I format my program (created from Visual Studio) to be like that?

The farthest I have toward this goal is how my folder is currently structured:
Main Folder: [Folder]
    Program.exe
    Main.cpp
    Header.h
    Class.cpp
    sfml.dll
    Assets [Folder]
        Picture.png
        Music.wav

(2) If you do not know how to completely separate my .exe from my source and asset files, then do you know how to be able to put my source, header, and sfml DLL's into a folder like the following:

Main Folder: [Folder]
    Program.exe
    Assets [Folder]
        Picture.png
        Music.wav
    Source [Folder]
        Main.cpp
        Header.h
        Class.cpp
        sfml.dll

(3) Or if you know how to just bundle everything into 1 exe..

Any help will be greatly appreciated!
« Last Edit: July 31, 2015, 06:00:47 am by SFML_Guy »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10846
    • View Profile
    • development blog
    • Email
AW: How To: Executable For Game [C++]
« Reply #1 on: July 31, 2015, 06:10:31 am »
Just put the resources and source files in a folder and adjust the paths correctly.

As for setups, there are many applications that let you create setup files, just google a bit.

Btw. I find your text formatting rather distracting. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Cryonic

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: How To: Executable For Game [C++]
« Reply #2 on: July 31, 2015, 06:14:13 am »
Yes, I know how to put my assets into folder, but not source files.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10846
    • View Profile
    • development blog
    • Email
AW: How To: Executable For Game [C++]
« Reply #3 on: July 31, 2015, 09:44:00 am »
Remove the files from your VS project, move the files into a folder, add them back to the VS project.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Hapax

  • Hero Member
  • *****
  • Posts: 3360
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: How To: Executable For Game [C++]
« Reply #4 on: July 31, 2015, 01:25:03 pm »
When distributing the program, there's no need to include the headers and source files. They're used to make the executable so are not needed to run the executable. They're only useful for editing.

Basically, create a new folder with these in it:
New Folder [Folder]
    Program.exe
    sfml.dll
    Assets [Folder]
        Picture.png
        Music.wav

That is assuming that sfml.dll is all of your required SFML DLLs.

It's possible to statically link to remove the need for the SFML DLLs but there's no real need for this and many people have more problems when attempting to statically link rather than dynamically link.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*