Howto:Add new fgcommands to FlightGear: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
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].
{{FGCquote
  |I’d prefer we not multiplex commands. Having more command names costs us nothing, so I’d prefer separate real commands for connect, disconnect and refresh. (eg, ‘multiplayer-connect’, ‘multiplayer-disconnect’)
And then we don’t need a sub-‘command’ argument to a command<br/>
Of course I suppose we have other commands that violate this rule, but it would be good to follow it for the future, in my opinion.
  |{{cite web |url=http://sourceforge.net/p/flightgear/mailman/message/33586829/
    |title=<nowiki>Re: [Flightgear-devel] [Flightgear-commitlogs] FlightGear branch,
next, updated. f5f82c461f39ce27c2b2a4c2d3310122576e408f</nowiki>
    |author=<nowiki>James Turner</nowiki>
    |date=<nowiki>2015-03-11</nowiki>
  }}
}}


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:

Navigation menu