Instructions - Free Pascal - Mac

This article shows you how to get started creating a SwinGame using the Macintosh Free Pascal version of the SwinGame SDK.

Requirements
You will need the following to use the Macintosh Free Pascal version of the SwinGame.


 * Free Pascal Compiler - A free download from Free Pascal.
 * Xcode - Can be installed from the MacOSX install disc. You can also download it for free from here. (Free ADC membership is required to download)
 * Text editor - Smultron or TextMate. Smultron is a freeware and supports Pascal syntax. TextMate is a shareware and supports Pascal syntax and many other features. The Pascal bundle can be downloaded in here.
 * The SwinGame SDK - download [[Media:SGSDK-1-1-3-Pascal-Mac-FPC.dmg|SGSDK-1-1-3-Pascal-Mac-FPC.dmg]]

Instructional Video
Watch the video of process for installing, compiling, and starting your game.

Installing
The [[Media:SGSDK-1-1-3-Pascal-Mac-FPC.dmg|SGSDK-1-1-3-Pascal-Mac-FPC.dmg]] file contains all the files you need to start making the game. You will not need to install this, just copy the Mac_Pascal folder to wherever you like. The following files are included in the SDK.
 * GameLogic.pas - The main game source file. You will be writing your game to this file.
 * GameLauncher.pas - Launches a game (You will never need to modify this file)
 * GameResources.pas - Resource manager (Explained in here)
 * build.sh - A script to compile the game.
 * bin folder - A compiled game will go in here.
 * lib folder - Contains the SwinGame libraries.
 * Resources filer - Contains the resources used in a game.

Starting a Game
In order to run the game you need to do the following:
 * 1) Open the Terminal
 * 2) Move to the SwinGame SDK directory (use cd command)
 * 3) Compile the game using the build.sh script. (execute ./build.sh "game's name here")
 * 4) Run the .app file in the bin folder.

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

Upgrading
The following instructions indicate how to upgrade an existing project to a new version of the SDK.
 * To 1.1.4 - from 1.1.3
 * Delete the lib folder in your project
 * Copy lib folder from v1.1.4 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

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 Mac. 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 Windows or Linux. To do this you will need to compile the game on Windows or Linux. You need to get the SwinGame and copy all of your Pascal source code files (*.pas) to the Linux or Windows version of the SDK. Then run the scripts that accompany these SDKs and you will have a native Windows or Linux application!

Enjoy programming with SwinGame!

Also See
Compiling SwinGame SDK on Mac (YouTube)