Canvas view camera element: Difference between revisions
Jump to navigation
Jump to search
m (→Base Package) |
|||
Line 12: | Line 12: | ||
## | ## | ||
# constructor | # constructor | ||
new: func( | new: func(view=0, width=640,height=480) { | ||
var m = { parents: [myElementTest] }; | var m = { parents: [myElementTest] }; | ||
m.dlg = canvas.Window.new([ | m.dlg = canvas.Window.new([width,height],"dialog"); | ||
m.canvas = m.dlg.createCanvas().setColorBackground(1,1,1,1); | m.canvas = m.dlg.createCanvas().setColorBackground(1,1,1,1); | ||
m.root = m.canvas.createGroup(); | m.root = m.canvas.createGroup(); | ||
Line 29: | Line 29: | ||
var test = myElementTest.new(); | var test = myElementTest.new(); | ||
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 ); | |||
} | |||
</syntaxhighlight> | </syntaxhighlight> |
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 test = myElementTest.new();
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
|