Howto:Dynamic Liveries via Canvas: Difference between revisions

m
→‎Canvas Code: untested - demonstrate how to move the canvas out of the window
m (→‎Canvas Code: untested - demonstrate how to move the canvas out of the window)
Line 30: Line 30:


<syntaxhighlight lang="nasal">
<syntaxhighlight lang="nasal">
# Create a Canvas dialog window to hold the canvas and show that it's working
# Create a Canvas  
var window = canvas.Window.new([512,512],"dialog");
var myCanvas = canvas.new({
  "name": "Livery Test",  # The name is optional but allow for easier identification
  "size": [2048, 2048], # Size of the underlying texture (should be a power of 2, required) [Resolution]
  "view": [2048, 2048],  # Virtual resolution (Defines the coordinate system of the canvas [Dimensions]
                        # which will be stretched the size of the texture, required)
  "mipmapping": 1      # Enable mipmapping (optional)
});


# Create a Canvas in the window and create a containing group called root
var myCanvas = window.createCanvas();
var root = myCanvas.createGroup();
var root = myCanvas.createGroup();


Line 44: Line 48:
     .setFile("Aircraft/EF2000/Models/EF2000.png")
     .setFile("Aircraft/EF2000/Models/EF2000.png")
     .setSize(2048,2048);
     .setSize(2048,2048);
# Create a Canvas dialog window to hold the canvas and show that it's working
var window = canvas.Window.new([512,512],"dialog");
window.setCanvas(myCanvas);
</syntaxhighlight>
</syntaxhighlight>