Canvas view camera element: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
Line 27: Line 27:
   
   
}; # end of myElementTest
}; # end of myElementTest
var test = myElementTest.new();


var cameras = [
var cameras = [
Line 37: Line 35:


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



Revision as of 09:28, 27 August 2017

This article is a stub. You can help the wiki by expanding it.

C++

Base Package

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