AGK for Pascal
ContentsIndexHome
PreviousUpNext
3. Getting Started for Windows

You can use AGK for Pascal with Delphi or Free Pascal with Lazarus. Both approaches use Agk.dll, which is a DLL version of the native AGK library. You can find this DLL in the Examples\Bin directory. You need to deploy this DLL with your Windows applications (put it inside the same directory as the application). 

 

Using Delphi

Requirements:

  • Delphi 2010 or later.

 

To make AGK readily available to all Delphi applications, it is easiest to add the AGK directory to the search path. In Delphi, pick the "Tools | Options.." menu option and go to "Environment Options | Delphi Options| Library". Add the AGK for Pascal Source directory to the Library Path (for example C:\AgkPas\Source). 

The easiest way to start a Delphi AGK application is to use a template. The template can be found in the Templates\Windows_Delphi directory. 

 

  1. Copy the files in the Templates\Windows_Delphi directory to your application directory.
  2. Copy Agk.dll to your application directory (or the directory you want to build to).
  3. Open the copied project in Delphi.
  4. Choose "File | Save Project As..." and save the project under a new name. You can now delete the copied AgkTemplate.dpr, AgkTemplate.dproj and AgkTemplate.res files.
  5. Build and run the application.

If you are using Delphi XE2 or later, then set your target platform to 32-bit Windows. You cannot use XE2 to create 64-bit Windows (or OS X) executables with AGK for Pascal. 

You should now see a small 480x320 pixel window showing the text "Hello AGK for Pascal!". You can now modify the unit uMain and change the application settings and add your game code. 

If you want to check out some examples, then look at the Examples directory. It contains a large number of sample applications, categorized in various subdirectories. Each subdirectory contains a Delphi Project Group with all the sample projects for that category. 

 

Using Free Pascal with Lazarus

Requirements:

  • Free Pascal 2.5.1 (32-bit) or later.
  • Lazarus 0.9.30 or later.

 

You can download the combined package here: 

http://sourceforge.net/projects/lazarus/files/ 

Download and install the "Windows 32 bits" package (even if you have a 64-bit Windows version, since you will be building 32-bit executables; 64-bit executables will not work with AGK for Pascal). 

Alternatively, you can download the latest development snapshots here: 

http://freepascal.dfmk.hu/test/lazarus/ 

but be aware that those are untested and may contain bugs. 

It is recommended (although not required) to place the AGK for Pascal library in the directory C:\AgkPas. That will make it easier for the Lazarus templates to find the source code. 

The easiest way to start a Lazarus AGK application is to use a template. The template can be found in the C:\AgkPas\Templates\Windows_Lazarus directory. 

 

  1. Copy the files in the C:\AgkPas\Templates\Windows_Lazarus directory to your application directory.
  2. Copy Agk.dll to your application directory (or the directory you want to build to).
  3. Open the copied project in Lazarus.
  4. Choose "Project | Save Project As..." and save the project under a new name. You can now delete the copied AgkTemplate.lpi, AgkTemplate.lpr and AgkTemplate.res files.
  5. Build and run the application.

 

You should now see a small 480x320 pixel window showing the text "Hello AGK for Pascal!". You can now modify the unit uMain and change the application settings and add your game code. 

Note: if you get a compiler error like "Can't open include file "AGK.inc" then you probably have not installed AGK for Pascal in the C:\AgkPas directory. In that case you will need to modify the search paths. Go to "Project | Options... | Compiler Options | Paths" and update the paths under "Other Unit Files" and "Include Files" to match your installation. 

 

Examples

If you want to check out some examples, then look at the Examples directory. It contains a large number of sample applications, categorized in various subdirectories. Each subdirectory contains further subdirectories for each sample application. In those subdirectories you will find 3 Lazarus projects. Open the one without the "_macos" or "_android" suffix (those are for building Mac OS X and Android applications).

Copyright (c) 2012. All rights reserved.