20,741
edits
Line 54: | Line 54: | ||
== Accessing the Canvas Desktop == | == Accessing the Canvas Desktop == | ||
Sometimes you may want to render to the main screen, without creating a separate Canvas window - this can be accomplished by using the Canvas desktop: | |||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
Line 61: | Line 61: | ||
| [[Special:UploadWizard|Upload requested]] || | | [[Special:UploadWizard|Upload requested]] || | ||
<syntaxhighlight lang="nasal" enclose="div"> | <syntaxhighlight lang="nasal" enclose="div"> | ||
var myNode = canvas.getDesktop().createChild("text") | |||
.setText("Hello FlightGear Desktop") | |||
.setFontSize(25, 1.0) # font size (in texels) and font aspect ratio | |||
.setColor(1,0,0,1) # red, fully opaque | |||
.setAlignment("center-center") # how the text is aligned to where you place it | |||
.setTranslation(160, 80); # where to place the text | |||
</syntaxhighlight> | </syntaxhighlight> | ||
|} | |} |