Changes

Jump to navigation Jump to search
m
no edit summary
Line 97: Line 97:  
Thus the key is found at index 14.
 
Thus the key is found at index 14.
   −
If the key isn't listed in keyboard.xml, the last option is to look in glut.h, which is a pretty common file, and one online...
+
If the key isn't listed in keyboard.xml, the last option is to enable some helpful output to see what the correct keycode is. Uncomment {{git file|gitorious|fg/fgdata|master|keyboard.xml|39|pre=line #34 of <nowiki> </nowiki> }} and run with the <tt>--console</tt> option, if on windows, and look at the console to see each keycode for each key. Make sure you can see the output as you press keys, or you won't know which is which! When I press and release {{key press|a}}, I get this output:
 +
<syntaxhighlight lang="nasal">
 +
{ key: 97, modifier: { meta: 0, shift: 0, alt: 0, super: 0, ctrl: 0, hyper: 0 }, pressed: 1 }
 +
{ key: 97, modifier: { meta: 0, shift: 0, alt: 0, super: 0, ctrl: 0, hyper: 0 }, pressed: 0 }
 +
</syntaxhighlight>
 +
This shows that key 97 was pressed (without any modifiers) and then released. This view can also help with combining modifiers, like mod-meta above.
 +
 
 +
== Adding custom bindings ==
 +
The "easiest" option for many is to edit keyboard.xml in place, because it just works. If you do this, make sure to keep a backup of it, in case you need to revert back to the default setup, or simply download it from [https://gitorious.org/fg/fgdata/raw/release/3.0.0:keyboard.xml gitorious (v3.0)] or [https://gitorious.org/fg/fgdata/raw/master:keyboard.xml gitorious (master)].
 +
 
 +
Another option, that ends up cleaner, is using a config file. These are specified on the commandline with '''<tt>--config</tt>''', like this:
 +
<syntaxhighlight lang="bash">fgfs --config=/Users/philosopher/Documents/FlightGear/keyboard-config.xml</syntaxhighlight>
 +
These can be formatted in the same way as keyboard.xml, with the exception of requiring input and keyboard tags, so it looks like this:
 +
<syntaxhighlight lang="xml">
 +
<?xml version="1.0"?>
 +
<PropertyList>
 +
<input><keyboard>
 +
    <key n="....">...</key>
 +
    <!-- etc. -->
 +
</keyboard></input>
 +
</PropertyList>
 +
</syntaxhighlight>
 +
This makes sure it writes to the correct place in the tree, viz. /input/keyboard/.
 +
 
 +
This allows you to more easily keep several different files for different types of setups, without having to rename them before starting FG, you only need to change the filename passed in the <tt>--config=</tt> option.
395

edits

Navigation menu