20,741
edits
m (→Nasal dialog: fix the fps/latency counters, which should really be using sprintf()) |
|||
Line 328: | Line 328: | ||
{{Note|The following Nasal script can be executed via the Nasal Console or put in a separate file and executed via a menu item to easily test different aspects of reset/re-init. This is intended to be a stress test, by allowing people to easily switch aircraft, relocate repeatedly and/or stop/restart and suspend/resume different subsystems. For the time being, you are likely to trigger segfaults/crashes or other undefined behavior (e.g., memory leaks), so it is recommended to run FlightGear in a GNU Debugger (GDB) session to obtain a backtrace. If you manage to cause a bug or crash, please file a bug report: {{Tickets}} }} | {{Note|The following Nasal script can be executed via the Nasal Console or put in a separate file and executed via a menu item to easily test different aspects of reset/re-init. This is intended to be a stress test, by allowing people to easily switch aircraft, relocate repeatedly and/or stop/restart and suspend/resume different subsystems. For the time being, you are likely to trigger segfaults/crashes or other undefined behavior (e.g., memory leaks), so it is recommended to run FlightGear in a GNU Debugger (GDB) session to obtain a backtrace. If you manage to cause a bug or crash, please file a bug report: {{Tickets}} }} | ||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript">canvas.MessageBox.warning( | ||
canvas.MessageBox.warning( | |||
"Developer Feature", | "Developer Feature", | ||
"This dialog is mainly intended for people familiar with FlightGear/core internals to help troubleshoot reset/re-init related bugs. You will probably want to run FlightGear inside a GNU Debugger (GDB) session when using this dialog", | "This dialog is mainly intended for people familiar with FlightGear/core internals to help troubleshoot reset/re-init related bugs. You will probably want to run FlightGear inside a GNU Debugger (GDB) session when using this dialog", | ||
Line 500: | Line 499: | ||
var subsystemMonitor = func(){ | var subsystemMonitor = func(){ | ||
# frame rate & frame spacing | |||
# update labels showing frame rate & frame spacing | |||
foreach(var d; dynamicLabels) { | foreach(var d; dynamicLabels) { | ||
# FIXME: dynamic labels should probably be using sprintf() style format strings | |||
d.label.setText( d.cb() ); | d.label.setText( d.cb() ); | ||
} | } | ||
Line 529: | Line 530: | ||
fps.setText("45 fps"); | fps.setText("45 fps"); | ||
statusbar.addItem(fps); | statusbar.addItem(fps); | ||
append(dynamicLabels, {label:fps, cb:func getprop("/sim | append(dynamicLabels, {label:fps, cb:func() {return ""~ getprop("/sim/frame-rate");}, suffix:' fps' }); | ||
var ms=canvas.gui.widgets.Label.new(root, canvas.style, {wordWrap: 0}); | var ms=canvas.gui.widgets.Label.new(root, canvas.style, {wordWrap: 0}); | ||
ms.setText("35 ms"); | ms.setText("35 ms"); | ||
statusbar.addItem(ms); | statusbar.addItem(ms); | ||
append(dynamicLabels, {label:ms, cb:func getprop("/sim | append(dynamicLabels, {label:ms, cb:func() {return ""~ getprop("/sim/frame-latency-max-ms");}, suffix:' ms' }); | ||
Line 559: | Line 560: | ||
canvas.MessageBox.Ok |canvas.MessageBox.Cancel | canvas.MessageBox.DontShowAgain | canvas.MessageBox.Ok |canvas.MessageBox.Cancel | canvas.MessageBox.DontShowAgain | ||
); | ); | ||
</syntaxhighlight> | </syntaxhighlight> |