~ubuntu-branches/ubuntu/utopic/castle-game-engine/utopic

« back to all changes in this revision

Viewing changes to packages/README.txt

  • Committer: Package Import Robot
  • Author(s): Abou Al Montacir
  • Date: 2013-04-27 18:06:40 UTC
  • Revision ID: package-import@ubuntu.com-20130427180640-eink4nmwzuivez1c
Tags: upstream-4.0.1
ImportĀ upstreamĀ versionĀ 4.0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
In this directory you can find Lazarus packages that allow you
 
2
to easily use Castle Game Engine in Lazarus programs.
 
3
 
 
4
Short instructions: just compile and install castle_base and castle_components.
 
5
*Do not* install castle_window in Lazarus (only compile it).
 
6
castle_components depends on standard Lazarus package LazOpenGLContext.
 
7
 
 
8
----------------------------------------
 
9
Usage:
 
10
 
 
11
  1. Open wanted castle_xxx.lpk file in Lazarus and compile the package.
 
12
 
 
13
  2. When you want to use the units included in castle_xxx.lpk
 
14
     in your program, just add this castle_xxx package
 
15
     as a "Required Package" for your project
 
16
     (using "Project" -> "Project Inspector" dialog).
 
17
 
 
18
     That's it. Lazarus will automatically take care of such things as
 
19
     recompiling the units in the package when needed (and with
 
20
     proper command-line options) or adding
 
21
     appropriate -Fu command-line options for FPC so that FPC
 
22
     "sees" units in the package when compiling your program.
 
23
 
 
24
  3. For castle_base and castle_components: you usually want to install
 
25
     these packages in Lazarus. This way you get our components
 
26
     in the Lazarus palette (tab "Castle"), you can drop them on the form,
 
27
     operate with the object inspector etc.
 
28
 
 
29
     Installing isn't really stricly required (you could just create
 
30
     all components by code, and add package to "Required Package"
 
31
     of your project) but usually it's much more comfortable to have them
 
32
     installed.
 
33
 
 
34
     Note that "castle_components" package depends on standard Lazarus
 
35
     package "LazOpenGLContext". So compile LazOpenGLContext first.
 
36
     Just open components/opengl/lazopenglcontext.lpk from Lazarus sources,
 
37
     and compile + install it under Lazarus.
 
38
     You can then try examples/openglcontrol/openglcontrol_demo.lpk,
 
39
     also in Lazarus sources, to check that "LazOpenGLContext" works Ok.
 
40
 
 
41
     For castle_window: *do not* install this in Lazarus.
 
42
     This package uses CastleWindow unit, and merely using this unit
 
43
     will cause the program to initialize TGLApplication instance,
 
44
     which in turn initiates some talk with WindowManager, GTK toolkit, etc.
 
45
     This would conflict with what Lazarus IDE (and LCL) does,
 
46
     causing unpredictable results.
 
47
 
 
48
     So castle_window package is supposed only to be "used" (by adding
 
49
     it to "Required Packages" in project inspector),
 
50
     never installed in Lazarus IDE.
 
51
 
 
52
Mini-FAQ about these packages:
 
53
 
 
54
- Do I need Lazarus to compile Castle Game Engine?
 
55
 
 
56
  No. Packages here are provided to easily compile and use the engine
 
57
  with Lazarus. But actually units in castle_game_engine don't use
 
58
  any Lazarus units (LCL) (besides Lazarus-specific components in
 
59
  ../src/components/ subdirectory, corresponding to castle_components package).
 
60
 
 
61
  So all you actually need is bare FPC installation.
 
62
  Use castle_game_engine/Makefile to compile all units and use compile.sh
 
63
  scripts to compile each particular program. If you need more flexibility,
 
64
  take a look at castle_game_engine/castle-fpc.cfg, this specifies actual options
 
65
  used by castle_game_engine/Makefile and all compile.sh scripts.
 
66
 
 
67
- What is the difference between castle_base and castle_components:
 
68
 
 
69
  castle_components has classes (components) depending on Lazarus LCL.
 
70
  You really cannot use them without Lazarus.
 
71
 
 
72
  castle_base doesn't depend on Lazarus LCL. This is the stuff available
 
73
  to you also when you don't use Lazarus (or even LCL) at all.
 
74
 
 
75
  castle_components requires (that is, automatically installs) also castle_base
 
76
  package --- that's OK.
 
77
 
 
78
See ../examples/lazarus/ for demo Lazarus programs using these packages.
 
79
 
 
80
------------------------------------------------------------------------------
 
81
Development notes:
 
82
 
 
83
How to cope with system-specific units and include files inside
 
84
a single Lazarus package file?
 
85
 
 
86
  (This concerns stuff inside */unix/, */windows/ subdirectories,
 
87
  like base/unix|windows, opengl/unix|windows).
 
88
 
 
89
  - Add all files, even the system-specific, to the package
 
90
    (this way e.g. dependency checking for .compiled files will be Ok).
 
91
    This also means that we have to add all paths,
 
92
    both for unix/ and windows/, to the package.
 
93
 
 
94
  - All include/units files must have unique names.
 
95
 
 
96
    I used to have a hack like this: place file unix/xxx.inc
 
97
    and windows/xxx.inc, and then using {$I xxx.inc}
 
98
    I knew that the correct (for current platform) xxx.inc would be included.
 
99
    This is not possible anymore --- both unix/ and windows/ will be
 
100
    on the include path for all of the platforms,
 
101
    so you cannot depend on include path to select the proper file.
 
102
 
 
103
    Not a real problem, I used this hack only in one place actually...
 
104
 
 
105
  - For units in platform-specific dirs, it's crucial to set
 
106
    AddToUsesPkgSection Value="False". This means that they
 
107
    will be compiled only when pulled by dependencies from other units,
 
108
    and all will be Ok.
 
109
 
 
110
Michalis