I'm learning canvas and i tried to implement the code of the wiki : "Howto:Add a 2D canvas instrument to your aircraft".
I created a simple rectangle with a texture (black) named “ND.screenL” and I wrote the code of the wiki in the aircraft console :
- Code: Select all
var my_canvas = canvas.new({
"name": "MFD-Test",
"size": [1024, 1024],
"view": [768, 1024],
"mipmapping": 1
});
my_canvas.addPlacement({"node": "ND.screenL"});
var group = my_canvas.createGroup();
var text = group.createChild("text", "optional-id-for element")
.setTranslation(10, 20)
.setAlignment("left-center")
.setFont("LiberationFonts/LiberationSans-Regular.ttf")
.setFontSize(14, 1.2)
.setColor(1,0,0)
.setText("This is a text element");
text.hide();
text.setText("Hello!").show();
But nothing is written in the rectangle … Which error I made?