Instructions - Turbo Delphi

This article shows you how to get started creating a SwinGame using the Turbo Delphi version of the SwinGame SDK.

Requirements
You will need to following to use the Turbo Delphi version of SwinGame.
 * Turbo Delphi - A free download from Code Gear or Turbo Explorer, you will also need to download some prerequisite software. You also need to register for the free license of Turbo Delphi, so make sure you follow the instructions on the site.
 * The SwinGame SDK - download the latest zip file.



Installing
The zip file contains a Turbo Delphi project that you can use as a starting point for your game. You don't need to install this, just extract it and open with Turbo Delphi. To help with the building of the game you do need to setup a few things within Turbo Delphi, so lets go through that now.


 * 1) Extract the zip file, you can extract this to any location of your choice.
 * 2) Extracting the file will give you a folder called SGSDK-1-1-2-Delphi, rename this to the name of your game.
 * 3) [[Image:TurboDelphiStartup.png|thumb|right|Starting Turbo Delphi]]Open the folder, and then double click on the GameLauncher.dpr file. This will open Turbo Delphi which you can use to develop the game. The image to the right shows what the editor should look like.
 * 4) One of the important steps of creating the game will be to copy the resources (libraries, images, sounds, fonts, etc) from the project into the bin folder. The bin folder is used to contain the compiled executable version of your game (called a binary), and is what you can distribute to others to play. The executable will need to libraries and resources to be able to run. To get Turbo Delphi to copy these resources into the bin folder you need to create a Build Tool that you can then run to perform the copy for you. To create the build tool you need to do the following: (images are below)
 * 5) From the Tools menu choose Build Tools
 * 6) Click the Add button to add a new tool to Turbo Delphi. This will open the Edit Tool window.
 * 7) Set the following values:
 * 8) * Title: Copy Resources
 * 9) * Other Extensions: .exe
 * 10) * Target Extension: .exe
 * 11) * Command Line: $PROJECTPATH\copyresources.cmd
 * 12) Click the OK button to save the tool, and the Close to close the Build Tools window
 * 13) To use the new Copy Resources Build Tool right click on the GameLauncher.exe in the project browser of Turbo Delphi.
 * 14) From the context menu select Copy Resources



Upgrading
The following instructions indicate how to upgrade an existing project to a new version of the SDK.
 * To 1.1.5 - from 1.1.3
 * Delete the lib folder in your project
 * Copy lib folder from v1.1.3 into your project
 * To 1.1.3 - from 1.1.2
 * Delete the lib folder in your project
 * Copy lib folder from v1.1.3 into your project
 * To 1.1.2 - from 1.1.1
 * Delete the lib folder in your project
 * Copy lib folder from v1.1.2 into your project
 * To 1.1.1 - from 1.1.0
 * Delete the lib folder in your project
 * Copy lib folder from v1.1.1 into your project
 * Rename GameResources.pas in your project
 * Copy GameResources.pas into your project
 * Merge in changes to the LoadImage, etc. routines from your old GameResources.pas
 * Copy new images from v1.1.1 Resources folder

Starting a Game
With the tools setup you are ready to start your game. Now you most likely want to call it something other than "GameLauncher"...

To rename the executable right click the GameLauncher.exe in the project browser of Turbo Delphi and select the Rename. You can now rename the project as you want. The executable will have the same name as the name of the project.

In order to run the game you need to do the following:
 * 1) Build the executable - Open the Project menu then select Build all projects.
 * 2) Copy the resources - Right click the executable in the project browser and select Copy Resources
 * 3) Then to run the program - Open the Run menu and then select Run. The splash screen should show and then a screen showing "Hello World"...

That's all. You have now setup SwinGame and are ready to create your own games.

Distributing your Game
When your game is complete you can distribute it by packaging up all of the files in the bin folder. These can then be distributed to anyone running Windows. They run the game by double clicking the executable. They do not need to install anything to run the game.

As you have developed this game in Pascal it is also possible to distribute it to people running MacOS or Linux. To do this you will need to compile the game on Mac or Linux. You need to get the Free Pascal versions of SwinGame and copy all of your Pascal source code files (*.pas) to the Linux or Mac version of the SDK. Then run the scripts that accompany these SDKs and you will have a native Mac or Linux application!

Enjoy programming with SwinGame!