AGK for Pascal
8. Hints and Tips

Some hints and tips you may find helpful for cross platform development.

  • To simplify the creation of cross platform projects, you can put all your application code into a single (main) directory. You can place multiple project files in this directory for different platforms. For example, you can place a Delphi project in this directory for Windows development. You can place a Lazarus project in the same directory for Windows, Mac OS X or Android developement. And you can also put an Xcode project in the same directory for iOS development. The actual game code is still in the same Pascal units and is shared by all the projects.
  • See the sample applications for an example of this. In each sample directory there is a set of .dpr/.dproj files containing the Delphi project and 3 sets of .lpi/.lpr files, containing Lazarus projects for Windows, OS X and Android. You will also find an .xcodeproj bundle here with the Xcode project for iOS.
  • With AGK for Pascal you can do most of your development and testing on the Windows or Mac OS X platform (using Delphi and/or Lazarus), even if you are mainly developing for the iOS or Android platform. For iOS, even though it is possible to write Pascal code in Xcode and set break points for debugging, it is usually much easier to develop and debug with Delphi or Lazarus instead. Just make sure that you test regularly in the iOS simulator, or preferably an actual iOS device. Note that AGK applications can run much slower in the simulator than on a device. For Android, you can only test AGK applications on actual devices. The Android simulator is (currently) unsupported.
  • If you develop in Windows for the iOS platform, then you should put your source code in a shared directory that you can access on your Mac. That way you don't have to worry about transferring files and keeping source code in sync.
  • With AGK, you should rarely have to write any platform specific code. AGK hides most of the platform specific details for you. However, if you find yourself in a situation that you need some specific code just for the Windows or the iOS platform, then you should include into your units. This include file defines several conditional defines, such as MSWINDOWS, OSX, IOS and ANDROID that you can use for this purpose.
Copyright (c) 2012. All rights reserved.