Canvas view camera element

From FlightGear wiki
Jump to navigation Jump to search
This article is a stub. You can help the wiki by expanding it.

C++

Base Package


Nasal Console

After patching and rebuilding SimGear/FlightGear respectively, and applying the changes to to api.nas in the base package, the following can be pasted into the Nasal Console for testing purposes:

var ELEMENT_NAME ="view-camera"; # to be adapted according to the C++ changes

var myElementTest = {
 ##
 # constructor
 new: func(view=0, width=640,height=480) {
  var m = { parents: [myElementTest] };
  m.dlg = canvas.Window.new([width,height],"dialog");
  m.canvas = m.dlg.createCanvas().setColorBackground(1,1,1,1);
  m.root = m.canvas.createGroup();

  ##
  # instantiate a new element
  m.myElement = m.root.createChild( ELEMENT_NAME );

  m.init();
  return m;
 }, # new
 
}; # end of myElementTest

var cameras = [
 {view: 0, width : 640, height: 480},
 {view: 1, width : 640, height: 480},
 {view: 2, width : 640, height: 480},
];

foreach(var cam; camers) {
 var newCam = myElementTest.new( view: cam.view, width: cam.width, height: cam.height );
}

Related

References