<PropertyList>

<name>Nintendo Wiimote</name>

<axis n="0">
	<desc>Aileron</desc>
	<binding>
		<command>property-scale</command>
		<property>/controls/flight/aileron</property>
		<power type="double">2</power>
	</binding>
</axis>

<axis n="1">
	<desc>Elevator</desc>
	<binding>
		<command>property-scale</command>
		<property>/controls/flight/elevator</property>
		<factor type="double">-1.0</factor>
		<power type="double">2</power>
	</binding>
</axis>

<button>
	<desc>Brakes</desc>
	<repeatable type="bool">true</repeatable>
	<binding>
		<command>nasal</command>
		<script>
                mod = getprop("/input/joystick/js[0]/wiimote-mod");
                if(mod == nil or mod == 0) {
                    controls.applyBrakes(1);
                } elsif(mod == 1) {
                    controls.gearDown(-1);
                }
                </script>
	</binding>
	<mod-up>
	<repeatable type="bool">true</repeatable>
	<binding>
		<command>nasal</command>
		<script>
                mod = getprop("/input/joystick/js[0]/wiimote-mod");
                if(mod == nil or mod == 0) {
                    controls.applyBrakes(0);
                } elsif(mod == 1) {
                    controls.gearDown(0);
                }
		</script>
	</binding>
	</mod-up>
</button>

<button n="1">
        <desc>Modifier</desc>
        <repeatable type="bool">false</repeatable>
        <binding>
                <command>nasal</command>
                <script>setprop("/input/joystick/js[0]/wiimote-mod", 1)</script>
        </binding>
        <mod-up>
            <binding>
                <command>nasal</command>
                <script>setprop("/input/joystick/js[0]/wiimote-mod", 0)</script>
            </binding>
        </mod-up>
</button>

<button n="2">
	<desc>Throttle up</desc>
	<repeatable type="bool">true</repeatable>
	<binding>
		<command>nasal</command>
		<script>
                mod = getprop("/input/joystick/js[0]/wiimote-mod");
                if(mod == nil or mod == 0) {
                    controls.incThrottle(0.01, 1.0);
                } elsif(mod == 1) {
                    view.panViewPitch(2);
                }
		</script>
	</binding>
</button>

<button n="3">
	<desc>Throttle down</desc>
	<repeatable type="bool">true</repeatable>
	<binding>
		<command>nasal</command>
		<script>
                mod = getprop("/input/joystick/js[0]/wiimote-mod");
                if(mod == nil or mod == 0) {
                    controls.incThrottle(-0.01, -1.0);
                } elsif(mod == 1) {
                    view.panViewPitch(-2);
                }
                </script>
	</binding>
</button>

<button n="4">
	<desc>Rudder left</desc>
	<repeatable type="bool">true</repeatable>
	<binding>
		<command>nasal</command>
		<script>
                mod = getprop("/input/joystick/js[0]/wiimote-mod");
                if(mod == nil or mod == 0) {
                    setprop("/controls/flight/rudder", getprop("/controls/flight/rudder") - 0.05);
                } elsif(mod == 1) {
                    view.panViewDir(2);
                }
                </script>
	</binding>
</button>

<button n="5">
	<desc>Rudder right</desc>
	<repeatable type="bool">true</repeatable>
	<binding>
		<command>nasal</command>
		<script>
                mod = getprop("/input/joystick/js[0]/wiimote-mod");
                if(mod == nil or mod == 0) {
                    setprop("/controls/flight/rudder", getprop("/controls/flight/rudder") + 0.05);
                } elsif(mod == 1) {
                    view.panViewDir(-2);
                }
                </script>
	</binding>
</button>

<button n="6">
	<repeatable type="bool">true</repeatable>
	<binding>
		<command>nasal</command>
                <script>view.decrease()</script>
	</binding>
</button>

<button n="7">
	<repeatable type="bool">true</repeatable>
	<binding>
		<command>nasal</command>
                <script>view.increase()</script>
	</binding>
</button>

<button n="8">
	<desc>Change view</desc>
	<repeatable type="bool">false</repeatable>
	<binding>
		<command>nasal</command>
                <script>view.stepView(1)</script>
	</binding>
</button>

<button n="9">
	<desc>Change view</desc>
	<repeatable type="bool">false</repeatable>
	<binding>
		<command>nasal</command>
                <script>view.stepView(-1)</script>
	</binding>
</button>

</PropertyList>

