20,741
edits
No edit summary |
|||
Line 28: | Line 28: | ||
<syntaxhighlight lang="nasal" enclose="div"> | <syntaxhighlight lang="nasal" enclose="div"> | ||
var (width, height) = (512,512); | |||
# Create a standalone Canvas (not attached to any GUI dialog/aircraft etc) | # Create a standalone Canvas (not attached to any GUI dialog/aircraft etc) | ||
var myCanvas = canvas.new({ | var myCanvas = canvas.new({ | ||
"name": "Livery Test", # The name is optional but allow for easier identification | "name": "Livery Test", # The name is optional but allow for easier identification | ||
"size": [ | "size": [width, height], # Size of the underlying texture (should be a power of 2, required) [Resolution] | ||
"view": [ | "view": [width, height], # Virtual resolution (Defines the coordinate system of the canvas [Dimensions] | ||
# which will be stretched the size of the texture, required) | # which will be stretched the size of the texture, required) | ||
"mipmapping": 1 # Enable mipmapping (optional) | "mipmapping": 1 # Enable mipmapping (optional) | ||
Line 45: | Line 46: | ||
# OPTIONAL: Create a Canvas dialog window to hold the canvas and show that it's working | # OPTIONAL: Create a Canvas dialog window to hold the canvas and show that it's working | ||
# the Canvas is now standalone, i.e. continues to live once the dialog is closed! | # the Canvas is now standalone, i.e. continues to live once the dialog is closed! | ||
var window = canvas.Window.new([ | var window = canvas.Window.new([width,height],"dialog"); | ||
window.setCanvas(myCanvas); | window.setCanvas(myCanvas); | ||
</syntaxhighlight> | </syntaxhighlight> |