Updated WalkView:
- Added a default key binding file. - Improved the documentation.
This commit is contained in:
parent
be61cc6e89
commit
1ff1469fc1
2 changed files with 203 additions and 2 deletions
198
Aircraft/Generic/WalkView/walk-view-keys.xml
Normal file
198
Aircraft/Generic/WalkView/walk-view-keys.xml
Normal file
|
@ -0,0 +1,198 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Walk view module for FlightGear.
|
||||
|
||||
Copyright (C) 2010 Anders Gidenstam (anders(at)gidenstam.org)
|
||||
This file is licensed under the GPL license v2 or later.
|
||||
-->
|
||||
<PropertyList>
|
||||
|
||||
<!--
|
||||
This module can be used to add suitable key bindings for walk views
|
||||
to any aircraft.
|
||||
|
||||
Usage example:
|
||||
|
||||
Include it in the keybord section of the aircraft's -set file.
|
||||
|
||||
<keyboard include="../Generic/WalkView/walk-view-keys.xml">
|
||||
|
||||
|
||||
Note: If the aircraft use other custom key bindings for the same keys
|
||||
the walk view bindings should be merged into the aircraft specific
|
||||
bindings. The walk view API commands return false if not currently
|
||||
in a walk view so the other alternative action can be put in an
|
||||
if statement. E.g.
|
||||
if (!walkview.forward(4.0)) {
|
||||
# Perform the non-walk view action of this key.
|
||||
}
|
||||
-->
|
||||
|
||||
<!-- Keyboard commands -->
|
||||
<key n="87">
|
||||
<name>W</name>
|
||||
<desc>Walk view: Run forward.</desc>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
if (!walkview.forward(4.0)) {
|
||||
}
|
||||
</script>
|
||||
</binding>
|
||||
<mod-up>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
walkview.forward(0);
|
||||
</script>
|
||||
</binding>
|
||||
</mod-up>
|
||||
</key>
|
||||
|
||||
<key n="119">
|
||||
<name>w</name>
|
||||
<desc>Walk view: Walk forward.</desc>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
if (!walkview.forward(1.0)) {
|
||||
}
|
||||
</script>
|
||||
</binding>
|
||||
<mod-up>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
walkview.forward(0);
|
||||
</script>
|
||||
</binding>
|
||||
</mod-up>
|
||||
</key>
|
||||
|
||||
<key n="100">
|
||||
<name>d</name>
|
||||
<desc>Walk view: Side step right.</desc>
|
||||
<repeatable type="bool">true</repeatable>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
if (!walkview.side_step(0.5)) {
|
||||
}
|
||||
</script>
|
||||
</binding>
|
||||
<mod-up>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
walkview.side_step(0);
|
||||
</script>
|
||||
</binding>
|
||||
</mod-up>
|
||||
</key>
|
||||
|
||||
<key n="68">
|
||||
<name>D</name>
|
||||
<desc>Walk view: Fast side step right.</desc>
|
||||
<repeatable type="bool">true</repeatable>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
if (!walkview.side_step(1.0)) {
|
||||
}
|
||||
</script>
|
||||
</binding>
|
||||
<mod-up>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
walkview.side_step(0);
|
||||
</script>
|
||||
</binding>
|
||||
</mod-up>
|
||||
</key>
|
||||
|
||||
<key n="97">
|
||||
<name>a</name>
|
||||
<desc>Walk view: Side step left.</desc>
|
||||
<repeatable type="bool">true</repeatable>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
if (!walkview.side_step(-0.5)) {
|
||||
}
|
||||
</script>
|
||||
</binding>
|
||||
<mod-up>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
walkview.side_step(0);
|
||||
</script>
|
||||
</binding>
|
||||
</mod-up>
|
||||
</key>
|
||||
<key n="65">
|
||||
<name>A</name>
|
||||
<desc>Walk view: Fast side step left.</desc>
|
||||
<repeatable type="bool">true</repeatable>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
if (!walkview.side_step(-1.0)) {
|
||||
}
|
||||
</script>
|
||||
</binding>
|
||||
<mod-up>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
walkview.side_step(0);
|
||||
</script>
|
||||
</binding>
|
||||
</mod-up>
|
||||
</key>
|
||||
|
||||
<key n="115">
|
||||
<name>s</name>
|
||||
<desc>Walk view: Walk backwards.</desc>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
if (!walkview.forward(-1.0)) {
|
||||
controls.startEngine(1);
|
||||
}
|
||||
</script>
|
||||
</binding>
|
||||
<mod-up>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
walkview.forward(0);
|
||||
controls.startEngine(0);
|
||||
</script>
|
||||
</binding>
|
||||
</mod-up>
|
||||
</key>
|
||||
<!-- Remove this if you for some reason have 2d panels and want the default
|
||||
Swap panels function on 'S'.
|
||||
-->
|
||||
<!-- key n="83">
|
||||
<name>S</name>
|
||||
<desc>Walk view: Walk backwards.</desc>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
walkview.forward(-1.0);
|
||||
</script>
|
||||
</binding>
|
||||
<mod-up>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
walkview.forward(0);
|
||||
</script>
|
||||
</binding>
|
||||
</mod-up>
|
||||
</key -->
|
||||
|
||||
</PropertyList>
|
|
@ -100,7 +100,8 @@ var active_walker = func {
|
|||
# NOTES:
|
||||
# Currently there can only be one view manager per view so the
|
||||
# walk view should not have any other view manager.
|
||||
#
|
||||
# See Aircraft/Nordstern, Aircraft/Short_Empire or Aircraft/ZLT-NT
|
||||
# for working examples of walk views.
|
||||
var walker = {
|
||||
new : func (view_name, constraints = nil, managers = nil) {
|
||||
var obj = { parents : [walker] };
|
||||
|
@ -124,7 +125,7 @@ var walker = {
|
|||
view.manager.register(view_name, obj);
|
||||
walkers[obj.view.getPath()] = obj;
|
||||
|
||||
debug.dump(obj);
|
||||
#debug.dump(obj);
|
||||
return obj;
|
||||
},
|
||||
active : func {
|
||||
|
@ -216,6 +217,8 @@ var walker = {
|
|||
|
||||
###############################################################################
|
||||
# Constraint classes. Determines where the view can walk.
|
||||
#
|
||||
|
||||
|
||||
# The union of two constraints.
|
||||
# c1, c2 - the constraints : constraint
|
||||
|
|
Loading…
Add table
Reference in a new issue