20,741
edits
m (→Background) |
|||
Line 24: | Line 24: | ||
Obviously, not all fgcommands can be implemented in Nasal, which is why you may sometimes still have to use C++ - creating a new fgcommand using C++ is also fairly simple actually. The source code you need to look at is in [http://gitorious.org/fg/flightgear/blobs/next/src/Main/fg_commands.cxx $FG_SRC/Main/fg_commands.cxx]. | Obviously, not all fgcommands can be implemented in Nasal, which is why you may sometimes still have to use C++ - creating a new fgcommand using C++ is also fairly simple actually. The source code you need to look at is in [http://gitorious.org/fg/flightgear/blobs/next/src/Main/fg_commands.cxx $FG_SRC/Main/fg_commands.cxx]. | ||
All commands are listed there, beginning in [http://gitorious.org/fg/flightgear/blobs/next/src/Main/fg_commands.cxx#line160 line #160]. The signature of these callback functions is always such that they: | All commands are listed there, beginning in [http://gitorious.org/fg/flightgear/blobs/next/src/Main/fg_commands.cxx#line160 line #160]. The signature of these callback functions is always such that they: | ||
Line 31: | Line 30: | ||
* return a bool (true/false, 1/0) | * return a bool (true/false, 1/0) | ||
* accept one const pointer to a SGPropertyNode (const SGPropertyNode * arg) | * accept one const pointer to a SGPropertyNode (const SGPropertyNode * arg) | ||
{{IO Restrictions}} | |||
The simplest command can be found in [http://gitorious.org/fg/flightgear/blobs/next/src/Main/fg_commands.cxx#line167 line 167], the do_null() command which does nothing: | The simplest command can be found in [http://gitorious.org/fg/flightgear/blobs/next/src/Main/fg_commands.cxx#line167 line 167], the do_null() command which does nothing: |