joystick-info vbox 3 hbox 1 true true var value = func(p, default = "") { return p != nil and (var v = p.getValue()) != nil ? v : default; } var items = func(it, name) { var t = ""; foreach (var x; it) { t ~= " ["; t ~= value(x.getNode("name"), name ~ " #" ~ x.getIndex()); t ~= "] ... "; t ~= value(x.getNode("desc"), "???"); t ~= "\n"; } return t; } var t = ""; var joysticks = props.globals.getNode("/input/joysticks").getChildren("js"); var numjs = size(joysticks); forindex (var i; joysticks) { var js = joysticks[i]; var id = value(js.getNode("id"), "[unnamed]"); var source = value(js.getNode("source"), "[user defined]"); var names = js.getChildren("name"); t ~= "Joystick #" ~ js.getIndex() ~ ": \"" ~ id ~ "\"\n\n"; t ~= " Driver: " ~ source ~ "\n"; if (size(names)) { t ~= " Used for: "; var last = pop(names); foreach (var n; names) t ~= '"' ~ value(n) ~ '", '; t ~= '"' ~ value(last) ~ '"'; } t ~= "\n\n"; t ~= items(js.getChildren("axis"), "Axis"); t ~= "\n"; t ~= items(js.getChildren("button"), "Button"); var help = value(js.getNode("help"), nil); if (help != nil) t ~= "\n\n" ~ help; if (numjs > 1 and i < numjs - 1) t ~= "\n\n\n----------------------------------------\n\n\n"; } var text = props.globals.getNode("/sim/gui/dialogs/joystick-info/text", 1); text.setValue(t); text.setValue(""); table 2 150 0 0 right 1 0 left %.5f /controls/flight/aileron 1 2 0 right 1 1 left %.5f /controls/flight/elevator 1 2 1 right 3 0 left %.5f /controls/flight/rudder 1 4 0 right 3 1 left %.5f /controls/engines/engine/throttle 1 4 1 150 5 0 fill 640 480 20 true false /sim/gui/dialogs/joystick-info/text