Namespace globals screen
on-screen displays ==============================================================================
Classes
display
screen.display ------------------------------------------------------------------------------ Class that manages a dialog, which displays an arbitrary number of properties periodically updating the values. Property names are abbreviated to the shortest possible unique part. Example: var dpy = screen.display.new(20, 10); # x/y coordinate dpy.setcolor(1, 0, 1); # magenta (default: white) dpy.setfont("SANS_12B",12); # see $FG_ROOT/gui/styles/*.xml dpy.add("/position/latitude-deg", "/position/longitude-deg"); dpy.add(props.globals.getNode("/orientation").getChildren()); The add() method takes one or more property paths or props.Nodes, or a vector containing those, or a hash with properties, or vectors with properties, etc. Internal "public" parameters may be set directly: dpy.interval = 0; # update every frame dpy.format = "%.3g"; # max. 3 digits fractional part dpy.tagformat = "%-12s"; # align prop names to 12 spaces dpy.redraw(); # pick up new settings The open() method should only be used to undo a close() call. In all other cases this is done implicitly. redraw() is automatically called by an add(), but can be used to let the dialog pick up new settings of internal variables. Methods add(), setfont() and setcolor() can be appended to the new() constructor (-> show big yellow frame rate counter in upper right corner): screen.display.new(-15, -5, 0).setfont("TIMES_24").setcolor(1, 0.9, 0).add("/sim/frame-rate");
window
screen.window ------------------------------------------------------------------------------ Class that manages a dialog with fixed number of lines, where you can push in text at the bottom, which then (optionally) scrolls up after some time. simple use: var window = screen.window.new(); window.write("message in the middle of the screen"); advanced use: var window = screen.window.new(nil, -100, 3, 10); window.fg = [1, 1, 1, 1]; # choose white default color window.align = "left"; window.write("first line"); window.write("second line (red)", 1, 0, 0); arguments: x ... x coordinate y ... y coordinate positive coords position relative to the left/lower corner, negative coords from the right/upper corner, nil centers maxlines ... max number of displayed lines; if more are pushed into the screen, then the ones on top fall off autoscroll ... seconds that each line should be shown; can be less if a message falls off; if 0 then don't scroll at all
Functions
msg_mp
highlights messages with the multiplayer callsign in the text
sanitize
convert string for output; replaces tabs by spaces, and skips delimiters and the voice part in "{text|voice}" constructions
Variables
fdm_init_listener
--prop:display=sim/frame-rate ... adds this property to the property display --prop:display=position/ ... adds all properties under /position/ (ends with slash!) --prop:display=position/,orientation/ ... separate multiple properties with comma