Canvas view camera element: Difference between revisions

Line 64: Line 64:
<syntaxhighlight lang="nasal">
<syntaxhighlight lang="nasal">
var (width,height) = (512,512);
var (width,height) = (512,512);
var ELEMENT_NAME = "viewcamera";
var ELEMENT_NAME = "viewcam";


var display_view = func(view=0)  
var display_view = func(view=0) {
var title = 'Canvas test:' ~ ELEMENT_NAME;
var title = 'Canvas test:' ~ ELEMENT_NAME;
var window = canvas.Window.new([width,height],"dialog").set('title',title);
var window = canvas.Window.new([width,height],"dialog").set('title',title);
Line 73: Line 73:


var child = root.createChild( ELEMENT_NAME );
var child = root.createChild( ELEMENT_NAME );
child.set("view-number", view);
# child.set("view-number", view);
} # display_view()
} # display_view()


var totalViews = props.getNode("sim").getChildren("view");
var totalViews = props.getNode("sim").getChildren("view");
print(size(totalViews));
forindex(var v;totalViews) {
display_view(view: 3);
display_view(view: v);
 
}</syntaxhighlight>
</syntaxhighlight>


Aircraft developers can use the new Canvas '''view''' element simply by using the conventional approach to replace a static texture with a Canvas using a cockpit placement.
Aircraft developers can use the new Canvas '''view''' element simply by using the conventional approach to replace a static texture with a Canvas using a cockpit placement.