20,741
edits
m (→A simple tile map: add cleanup code to stop the timer (untested for now)) |
m (clipping: http://forum.flightgear.org/viewtopic.php?f=4&t=25747&p=276965&hilit=clipping#p276965) |
||
Line 114: | Line 114: | ||
# create an image child for the texture | # create an image child for the texture | ||
var child=root.createChild("image") | var child=root.createChild("image") | ||
.setFile( url ) | |||
.setTranslation(45,22) # centered, in relation to dialog coordinates | |||
.setSize(310,155); # image dimensions | |||
</syntaxhighlight> | |||
|} | |||
== Clipping == | |||
lorem ipsum ... | |||
{| class="wikitable" | |||
|- | |||
! Screenshot !! Code | |||
|- | |||
| MISSING || | |||
<syntaxhighlight lang="nasal" enclose="div"> | |||
# create a new window, dimensions are 400 x 200, using the dialog decoration (i.e. titlebar) | |||
var window = canvas.Window.new([400,200],"dialog"); | |||
# adding a canvas to the new window and setting up background colors/transparency | |||
var myCanvas = window.createCanvas().set("background", canvas.style.getColor("bg_color")); | |||
# Using specific css colors would also be possible: | |||
# myCanvas.set("background", "#ffaac0"); | |||
# creating the top-level/root group which will contain all other elements/group | |||
var root = myCanvas.createGroup(); | |||
# create an image child for the texture | |||
var child=root.createChild(".........") | |||
.setFile( url ) | .setFile( url ) | ||
.setTranslation(45,22) # centered, in relation to dialog coordinates | .setTranslation(45,22) # centered, in relation to dialog coordinates |