You can download Lazarus with Free Pascal for OS X here:
http://sourceforge.net/projects/lazarus/files/
Select the "Lazarus Mac OS X i386" folder and select the latest version. You will see three .dmg files here (lazarus*, fpcsrc* and fpc*). Download all 3.
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.
sudo ln -s /Applications/Xcode.app/Contents/Developer /
(Note the space before the last slash).
sudo chmod 777 /Applications/Xcode.app/Contents/Developer
The easiest way to start a Lazarus AGK application is to use a template. The template can be found in the /Developer/AgkPas/Templates/OSX_Lazarus directory.
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" the you probably have not installed AGK for Pascal in the /Developer/AgkPas directory. In that case you will need to modify the search paths. Go to "Project | Options... | Compiler Options | Paths" and update all the paths containing /Developer/AgkPas to match your installation.
OS X applications expect that its resources (like images, sounds etc.) are packaged into the application bundle, inside the /Contents/Resources folder. The Lazarus template project takes care of copying the resources for you by executing the osx_post_build.sh script after each compile and build. This script contains the commands needed to copy resources to the application bundle. It contains lines like this:
cp agk.png $1.app/Contents/Resources
This example copies the agk.png file from the source directory to the Resources folder in the bundle.
When you add resources to your project, you must update the shell script and add the appropriate lines to copy your resources.
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 with the "_macos" suffix (the other ones are for building Windows and Android applications).
Copyright (c) 2012. All rights reserved.
|