* Drew -- Wednesday 20 April 2005 21:56:
> I'm trying to find an easy way to make the screen go black in the
> FlightGear window...sort of like a camera failure for a UAV.

You can show a black and opaque dialog. Save the attached file to
$FG_ROOT/Nasal/ and call it from any Nasal context, for example:

    <key n="96">
        <name>Backtick</name>
        <desc>Toggle blackout.</desc>
        <binding>
            <command>nasal</command>
            <script>black.beauty()</script>
        </binding>
    </key>

m.
dialog = nil;

beauty = func {
        name = "boohoo";

        if (dialog != nil) {
                fgcommand("dialog-close", props.Node.new({ "dialog-name" : name 
}));
                dialog = nil;
                return;
        }

        dialog = gui.Widget.new();
        dialog.set("name", name);
        dialog.set("width", props.globals.getNode("/sim/startup/xsize"));
        dialog.set("height", props.globals.getNode("/sim/startup/ysize"));

        color = dialog.prop().getNode("color", 1);
        color.getNode("red", 1).setValue(0);
        color.getNode("green", 1).setValue(0);
        color.getNode("blue", 1).setValue(0);
        color.getNode("alpha", 1).setValue(1);

        fgcommand("dialog-new", dialog.prop());
        gui.showDialog(name);
}
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@flightgear.org
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d

Reply via email to