]> git.mxchange.org Git - flightgear.git/commitdiff
Documentation on adding new built-in commands to FlightGear.
authordavid <david>
Sat, 26 Oct 2002 01:18:52 +0000 (01:18 +0000)
committerdavid <david>
Sat, 26 Oct 2002 01:18:52 +0000 (01:18 +0000)
docs-mini/README.commands [new file with mode: 0644]

diff --git a/docs-mini/README.commands b/docs-mini/README.commands
new file mode 100644 (file)
index 0000000..25b1543
--- /dev/null
@@ -0,0 +1,32 @@
+Binding New Commands in FlightGear
+----------------------------------
+
+
+To add a new command to FlightGear, you first need to create a
+function that takes a single SGPropertyNode const pointer as an
+argument:
+
+  void
+  do_something (SGPropertyNode * arg)
+  {
+    something();
+  }
+
+Next, you need to register it with the command manager:
+
+  globals->get_commands()->addCommand("something", do_something);
+
+Now, the command "something" is available to any mouse, joystick,
+panel, or keyboard bindings.  If the bindings pass any arguments, they
+will be children of the SGPropertyNode passed in:
+
+  void
+  do_something (const SGPropertyNode * arg)
+  {
+    something(arg->getStringValue("foo"), arg->getDoubleValue("bar"));
+  }
+
+That's pretty-much it.  Apologies in advance for not making things any
+more complicated.
+
+